Bug 1052052 - Convert AutoJSContext to AutoJSAPI. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Thu, 14 Aug 2014 18:47:16 -0700
changeset 221292 f9c51223ffc9764486a5438872a2832f06641734
parent 221291 55783b8e332ce82b6652f8917319cfa7b00bc031
child 221293 028c43cd12a5de4a37439c1872319426ff633e06
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs1052052
milestone34.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 1052052 - Convert AutoJSContext to AutoJSAPI. r=gabor With this change, the only cx push left in the tree happens inside of AutoJSAPI. \o/
dom/base/ScriptSettings.cpp
dom/base/ScriptSettings.h
--- a/dom/base/ScriptSettings.cpp
+++ b/dom/base/ScriptSettings.cpp
@@ -460,18 +460,18 @@ AutoJSContext::Init(bool aSafe MOZ_GUARD
   MOZ_GUARD_OBJECT_NOTIFIER_INIT;
 
   nsXPConnect *xpc = nsXPConnect::XPConnect();
   if (!aSafe) {
     mCx = xpc->GetCurrentJSContext();
   }
 
   if (!mCx) {
-    mCx = xpc->GetSafeJSContext();
-    mPusher.emplace(mCx);
+    mJSAPI.Init();
+    mCx = mJSAPI.cx();
   }
 }
 
 AutoJSContext::operator JSContext*() const
 {
   return mCx;
 }
 
--- a/dom/base/ScriptSettings.h
+++ b/dom/base/ScriptSettings.h
@@ -295,17 +295,17 @@ protected:
   explicit AutoJSContext(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
 
   // We need this Init() method because we can't use delegating constructor for
   // the moment. It is a C++11 feature and we do not require C++11 to be
   // supported to be able to compile Gecko.
   void Init(bool aSafe MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
 
   JSContext* mCx;
-  Maybe<dom::danger::AutoCxPusher> mPusher;
+  dom::AutoJSAPI mJSAPI;
   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 /**
  * Use ThreadsafeAutoJSContext when you want an AutoJSContext but might be
  * running on a worker thread.
  */
 class MOZ_STACK_CLASS ThreadsafeAutoJSContext {