From 7115335ed68051104252f1a58d9699886ff76b79 Mon Sep 17 00:00:00 2001 From: "dbaron%fas.harvard.edu" Date: Wed, 31 Oct 2001 02:46:21 +0000 Subject: [PATCH] Clean up un-needed string copying. r=jag sr=hyatt b=106108 git-svn-id: svn://10.0.0.236/trunk@106789 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpfe/appshell/src/nsXULWindow.cpp | 16 +++++++++------- mozilla/xpfe/appshell/src/nsXULWindow.h | 4 +++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.cpp b/mozilla/xpfe/appshell/src/nsXULWindow.cpp index d6952b8eff8..bcb92852b72 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsXULWindow.cpp @@ -1168,7 +1168,7 @@ NS_IMETHODIMP nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell, PRBool aPrimary, const PRUnichar* aID) { nsContentShellInfo* shellInfo = nsnull; - nsAutoString newID(aID); + nsDependentString newID(aID); PRBool resetTreeOwner = PR_FALSE; @@ -1179,7 +1179,6 @@ NS_IMETHODIMP nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell, PRInt32 i; for (i = 0; i < count; i++) { nsContentShellInfo* info = (nsContentShellInfo*)mContentShells.ElementAt(i); - nsAutoString srcID(info->id); if (info->child == aContentShell) { info->child = nsnull; resetTreeOwner = PR_TRUE; @@ -1189,9 +1188,8 @@ NS_IMETHODIMP nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell, // Now find the appropriate entry and put ourselves in as the content shell. for (i = 0; i < count; i++) { nsContentShellInfo* info = (nsContentShellInfo*)mContentShells.ElementAt(i); - nsAutoString srcID(info->id); - if (info->primary == aPrimary && srcID.Equals(newID)) { + if (info->primary == aPrimary && info->id.Equals(newID)) { // We already exist. Do a replace. info->child = aContentShell; shellInfo = info; @@ -1200,7 +1198,7 @@ NS_IMETHODIMP nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell, } if (!shellInfo) { - shellInfo = new nsContentShellInfo(nsAutoString(aID), aPrimary, aContentShell); + shellInfo = new nsContentShellInfo(newID, aPrimary, aContentShell); mContentShells.AppendElement((void*)shellInfo); } @@ -1596,8 +1594,12 @@ void nsXULWindow::SetContentScrollbarVisibility(PRBool aVisible) { //*** nsContentShellInfo: Object Management //***************************************************************************** -nsContentShellInfo::nsContentShellInfo(const nsString& aID, PRBool aPrimary, - nsIDocShellTreeItem* aContentShell) : id(aID), primary(aPrimary), child(aContentShell) +nsContentShellInfo::nsContentShellInfo(const nsAString& aID, + PRBool aPrimary, + nsIDocShellTreeItem* aContentShell) + : id(aID), + primary(aPrimary), + child(aContentShell) { } diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.h b/mozilla/xpfe/appshell/src/nsXULWindow.h index ecb52bb36d0..19b52720836 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.h +++ b/mozilla/xpfe/appshell/src/nsXULWindow.h @@ -130,7 +130,9 @@ protected: class nsContentShellInfo { public: - nsContentShellInfo(const nsString& aID, PRBool aPrimary, nsIDocShellTreeItem* aContentShell); + nsContentShellInfo(const nsAString& aID, + PRBool aPrimary, + nsIDocShellTreeItem* aContentShell); ~nsContentShellInfo(); public: