Bug 1052052 - Convert AutoJSContext to AutoJSAPI. r=gabor
☠☠ backed out by 1d41a9159e58 ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Thu, 14 Aug 2014 12:54:37 -0700
changeset 221268 5b1a3161f614a13ef848454ece81866a61955bbc
parent 221267 17a9673ed7828da59142f66a63ea3ea7a95233d5
child 221269 d79ed36df3ac9fc8f2a90294a6123b23b3258ae4
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
@@ -294,17 +294,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 {