Bug 987923: Add autorelease pool locally in GetTempDir on OS X, and also to non-main-thread event loop. r=smichaud,bent
authorJosh Aas <joshmoz@gmail.com>
Tue, 25 Mar 2014 15:27:12 -0500
changeset 175277 8a7b41d26e66827903780090e1c77cfd3d673bd1
parent 175276 40206fb386d90a22ea216bc61fbe295e113f27d8
child 175278 d9e136a02980e46143fce67c8ac1efe58acfae66
push id26485
push userkwierso@gmail.com
push dateWed, 26 Mar 2014 02:55:13 +0000
treeherdermozilla-central@196bf8197122 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmichaud, bent
bugs987923
milestone31.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 987923: Add autorelease pool locally in GetTempDir on OS X, and also to non-main-thread event loop. r=smichaud,bent
ipc/chromium/src/base/file_util_mac.mm
ipc/glue/MessagePump.cpp
--- a/ipc/chromium/src/base/file_util_mac.mm
+++ b/ipc/chromium/src/base/file_util_mac.mm
@@ -5,20 +5,22 @@
 #include "base/file_util.h"
 
 #import <Cocoa/Cocoa.h>
 #include <copyfile.h>
 
 #include "base/file_path.h"
 #include "base/logging.h"
 #include "base/string_util.h"
+#include "base/scoped_nsautorelease_pool.h"
 
 namespace file_util {
 
 bool GetTempDir(FilePath* path) {
+  base::ScopedNSAutoreleasePool autorelease_pool;
   NSString* tmp = NSTemporaryDirectory();
   if (tmp == nil)
     return false;
   *path = FilePath([tmp fileSystemRepresentation]);
   return true;
 }
 
 bool GetShmemTempDir(FilePath* path) {
--- a/ipc/glue/MessagePump.cpp
+++ b/ipc/glue/MessagePump.cpp
@@ -294,17 +294,21 @@ MessagePumpForNonMainThreads::Run(base::
 
   mDelayedWorkTimer = do_CreateInstance(kNS_TIMER_CID);
   MOZ_ASSERT(mDelayedWorkTimer);
 
   if (NS_FAILED(mDelayedWorkTimer->SetTarget(mThread))) {
     MOZ_CRASH("Failed to set timer target!");
   }
 
+  base::ScopedNSAutoreleasePool autoReleasePool;
+
   for (;;) {
+    autoReleasePool.Recycle();
+
     bool didWork = NS_ProcessNextEvent(mThread, false) ? true : false;
     if (!keep_running_) {
       break;
     }
 
     didWork |= aDelegate->DoDelayedWork(&delayed_work_time_);
 
     if (didWork && delayed_work_time_.is_null()) {