bug 801466 - part 3.1 remove some prmem usage from dom/ and content/ r=mounir
authorTrevor Saunders <trev.saunders@gmail.com>
Wed, 05 Dec 2012 02:55:37 -0500
changeset 115105 61b7d462bc9e49130dd16f442f8d31930cc68dc8
parent 115104 5488aa7e3fc3855cb481addac7e8f9532e277d72
child 115106 7407abfdf8aed80fd8121f1b04769d66ea25e25d
push id23973
push useremorley@mozilla.com
push dateThu, 06 Dec 2012 10:04:18 +0000
treeherdermozilla-central@ddda5400c826 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs801466
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 801466 - part 3.1 remove some prmem usage from dom/ and content/ r=mounir
content/media/AudioStream.cpp
content/media/webrtc/MediaEngineDefault.cpp
content/media/webrtc/MediaEngineDefault.h
content/media/webrtc/MediaEngineWebRTC.h
content/xslt/src/base/txLog.h
content/xul/document/src/nsXULContentSink.cpp
docshell/base/nsDocShell.cpp
dom/base/nsGlobalWindow.cpp
dom/file/ArchiveZipEvent.cpp
dom/plugins/base/nsPluginDirServiceProvider.cpp
--- a/content/media/AudioStream.cpp
+++ b/content/media/AudioStream.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include <stdio.h>
 #include <math.h>
 #include "prlog.h"
-#include "prmem.h"
 #include "prdtoa.h"
 #include "AudioStream.h"
 #include "nsAlgorithm.h"
 #include "VideoUtils.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Mutex.h"
 extern "C" {
 #include "sydneyaudio/sydney_audio.h"
--- a/content/media/webrtc/MediaEngineDefault.cpp
+++ b/content/media/webrtc/MediaEngineDefault.cpp
@@ -5,16 +5,17 @@
 #include "MediaEngineDefault.h"
 
 #include "nsCOMPtr.h"
 #include "nsDOMFile.h"
 #include "nsILocalFile.h"
 #include "Layers.h"
 #include "ImageContainer.h"
 #include "ImageTypes.h"
+#include "prmem.h"
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #include "nsISupportsUtils.h"
 #endif
 
 #define CHANNELS 1
 #define VIDEO_RATE USECS_PER_S
--- a/content/media/webrtc/MediaEngineDefault.h
+++ b/content/media/webrtc/MediaEngineDefault.h
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MEDIAENGINEDEFAULT_H_
 #define MEDIAENGINEDEFAULT_H_
 
-#include "prmem.h"
 #include "nsITimer.h"
 
 #include "nsCOMPtr.h"
 #include "nsDOMMediaStream.h"
 #include "nsComponentManagerUtils.h"
 
 #include "VideoUtils.h"
 #include "MediaEngine.h"
--- a/content/media/webrtc/MediaEngineWebRTC.h
+++ b/content/media/webrtc/MediaEngineWebRTC.h
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MEDIAENGINEWEBRTC_H_
 #define MEDIAENGINEWEBRTC_H_
 
-#include "prmem.h"
 #include "prcvar.h"
 #include "prthread.h"
 #include "nsIThread.h"
 #include "nsIRunnable.h"
 
 #include "mozilla/Mutex.h"
 #include "nsCOMPtr.h"
 #include "nsDOMFile.h"
--- a/content/xslt/src/base/txLog.h
+++ b/content/xslt/src/base/txLog.h
@@ -2,17 +2,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef txLog_h__
 #define txLog_h__
 
 #include "prlog.h"
-#include "prmem.h"
 #endif
 
 #ifdef PR_LOGGING
 class txLog
 {
 public:
     static PRLogModuleInfo *xpath;
     static PRLogModuleInfo *xslt;
--- a/content/xul/document/src/nsXULContentSink.cpp
+++ b/content/xul/document/src/nsXULContentSink.cpp
@@ -165,17 +165,17 @@ XULContentSinkImpl::XULContentSinkImpl()
 XULContentSinkImpl::~XULContentSinkImpl()
 {
     NS_IF_RELEASE(mParser); // XXX should've been released by now, unless error.
 
     // The context stack _should_ be empty, unless something has gone wrong.
     NS_ASSERTION(mContextStack.Depth() == 0, "Context stack not empty?");
     mContextStack.Clear();
 
-    PR_FREEIF(mText);
+    moz_free(mText);
 }
 
 //----------------------------------------------------------------------
 // nsISupports interface
 
 NS_IMPL_ISUPPORTS3(XULContentSinkImpl,
                    nsIXMLContentSink,
                    nsIContentSink,
@@ -1046,17 +1046,17 @@ XULContentSinkImpl::AddAttributes(const 
 }
 
 nsresult
 XULContentSinkImpl::AddText(const PRUnichar* aText, 
                             int32_t aLength)
 {
   // Create buffer when we first need it
   if (0 == mTextSize) {
-      mText = (PRUnichar *) PR_MALLOC(sizeof(PRUnichar) * 4096);
+      mText = (PRUnichar *) moz_malloc(sizeof(PRUnichar) * 4096);
       if (nullptr == mText) {
           return NS_ERROR_OUT_OF_MEMORY;
       }
       mTextSize = 4096;
   }
 
   // Copy data from string into our buffer; flush buffer when it fills up
   int32_t offset = 0;
@@ -1069,17 +1069,17 @@ XULContentSinkImpl::AddText(const PRUnic
       if (mConstrainSize) {
         nsresult rv = FlushText();
         if (NS_OK != rv) {
             return rv;
         }
       }
       else {
         mTextSize += aLength;
-        mText = (PRUnichar *) PR_REALLOC(mText, sizeof(PRUnichar) * mTextSize);
+        mText = (PRUnichar *) moz_realloc(mText, sizeof(PRUnichar) * mTextSize);
         if (nullptr == mText) {
             return NS_ERROR_OUT_OF_MEMORY;
         }
       }
     }
     memcpy(&mText[mTextLength],aText + offset, sizeof(PRUnichar) * amount);
     
     mTextLength += amount;
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -156,17 +156,16 @@
 
 #include "nsFocusManager.h"
 
 #include "nsITextToSubURI.h"
 
 #include "nsIJARChannel.h"
 
 #include "prlog.h"
-#include "prmem.h"
 
 #include "nsISelectionDisplay.h"
 
 #include "nsIGlobalHistory2.h"
 
 #include "nsEventStateManager.h"
 
 #include "nsIFrame.h"
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -27,17 +27,16 @@
 #ifdef GetClassName
 #undef GetClassName
 #endif // GetClassName
 #endif // XP_WIN
 
 // Helper Classes
 #include "nsXPIDLString.h"
 #include "nsJSUtils.h"
-#include "prmem.h"
 #include "jsapi.h"              // for JSAutoRequest
 #include "jsdbgapi.h"           // for JS_ClearWatchPointsForObject
 #include "jsfriendapi.h"        // for JS_GetGlobalForFrame
 #include "jswrapper.h"
 #include "nsReadableUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsJSEnvironment.h"
 #include "nsCharSeparatedTokenizer.h" // for Accept-Language parsing
--- a/dom/file/ArchiveZipEvent.cpp
+++ b/dom/file/ArchiveZipEvent.cpp
@@ -186,29 +186,27 @@ ArchiveReaderZipEvent::Exec()
 
     // Point to the next item at the top of loop
     centralOffset += ZIPCENTRAL_SIZE + filenameLen + extraLen + commentLen;
     if (filenameLen == 0 || filenameLen >= PATH_MAX || centralOffset >= size) {
       return RunShare(NS_ERROR_FILE_CORRUPTED);
     }
 
     // Read the name:
-    char* filename = (char*)PR_Malloc(filenameLen + 1);
+    nsAutoArrayPtr<char> filename(new char[filenameLen + 1]);
     rv = inputStream->Read(filename, filenameLen, &ret);
     if (NS_FAILED(rv) || ret != filenameLen) {
       return RunShare(NS_ERROR_UNEXPECTED);
     }
 
     filename[filenameLen] = 0;
 
     // We ignore the directories:
     if (filename[filenameLen - 1] != '/') {
       mFileList.AppendElement(new ArchiveZipItem(filename, centralStruct, mOptions));
     }
 
-    PR_Free(filename);
-
     // Ignore the rest
     seekableStream->Seek(nsISeekableStream::NS_SEEK_CUR, extraLen + commentLen);
   }
 
   return RunShare(NS_OK);
 }
--- a/dom/plugins/base/nsPluginDirServiceProvider.cpp
+++ b/dom/plugins/base/nsPluginDirServiceProvider.cpp
@@ -3,17 +3,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsPluginDirServiceProvider.h"
 
 #include "nsCRT.h"
 #include "nsIFile.h"
 #include "nsDependentString.h"
-#include "prmem.h"
 #include "nsArrayEnumerator.h"
 #include "mozilla/Preferences.h"
 
 #include <windows.h>
 #include "nsIWindowsRegKey.h"
 
 using namespace mozilla;