Bug 1111076 - Get rid of nsIScriptContext::GC(). r=smaug
authorAndrew McCreight <continuation@gmail.com>
Tue, 16 Dec 2014 08:02:27 -0800
changeset 219965 158a3009efa275256205514a1a8e1966640edea3
parent 219964 c5dfa513496befabfb263716835898071a3eeb7f
child 219966 6c05079b2aeec285ca3badf33f2317b8d8992555
push id27974
push userdgohman@mozilla.com
push dateWed, 17 Dec 2014 00:41:35 +0000
treeherdermozilla-central@b7eb1ce0237d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1111076
milestone37.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 1111076 - Get rid of nsIScriptContext::GC(). r=smaug
dom/base/nsGlobalWindow.cpp
dom/base/nsIScriptContext.h
dom/base/nsJSEnvironment.cpp
dom/base/nsJSEnvironment.h
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2693,17 +2693,17 @@ nsGlobalWindow::SetNewDocument(nsIDocume
       mArguments = nullptr;
     }
 
     // Give the new inner window our chrome event handler (since it
     // doesn't have one).
     newInnerWindow->mChromeEventHandler = mChromeEventHandler;
   }
 
-  mContext->GC(JS::gcreason::SET_NEW_DOCUMENT);
+  nsJSContext::PokeGC(JS::gcreason::SET_NEW_DOCUMENT);
   mContext->DidInitializeContext();
 
   // We wait to fire the debugger hook until the window is all set up and hooked
   // up with the outer. See bug 969156.
   if (createdInnerWindow) {
     // AutoEntryScript required to invoke debugger hook, which is a
     // Gecko-specific concept at present.
     AutoEntryScript aes(newInnerWindow);
@@ -2916,17 +2916,17 @@ nsGlobalWindow::DetachFromDocShell()
     mFocusedNode = nullptr;
   }
 
   ClearControllers();
 
   mChromeEventHandler = nullptr; // force release now
 
   if (mContext) {
-    mContext->GC(JS::gcreason::SET_DOC_SHELL);
+    nsJSContext::PokeGC(JS::gcreason::SET_DOC_SHELL);
     mContext = nullptr;
   }
 
   mDocShell = nullptr; // Weak Reference
 
   NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!");
 
   if (mFrames) {
--- a/dom/base/nsIScriptContext.h
+++ b/dom/base/nsIScriptContext.h
@@ -22,18 +22,18 @@ class nsIArray;
 class nsIVariant;
 class nsIObjectInputStream;
 class nsIObjectOutputStream;
 class nsIScriptObjectPrincipal;
 class nsIDOMWindow;
 class nsIURI;
 
 #define NS_ISCRIPTCONTEXT_IID \
-{ 0x274840b6, 0x7349, 0x4798, \
-  { 0xbe, 0x24, 0xbd, 0x75, 0xa6, 0x46, 0x99, 0xb7 } }
+{ 0x901f0d5e, 0x217a, 0x45fa, \
+  { 0x9a, 0xca, 0x45, 0x0f, 0xe7, 0x2f, 0x10, 0x9a } }
 
 class nsIOffThreadScriptReceiver;
 
 /**
  * It is used by the application to initialize a runtime and run scripts.
  * A script runtime would implement this interface.
  */
 class nsIScriptContext : public nsISupports
@@ -62,29 +62,21 @@ public:
    * Check to see if context is as yet intialized. Used to prevent
    * reentrancy issues during the initialization process.
    *
    * @return true if initialized, false if not
    *
    */
   virtual bool IsContextInitialized() = 0;
 
-  /**
-   * For garbage collected systems, do a synchronous collection pass.
-   * May be a no-op on other systems
-   *
-   * @return NS_OK if the method is successful
-   */
-  virtual void GC(JS::gcreason::Reason aReason) = 0;
-
   // SetProperty is suspect and jst believes should not be needed.  Currenly
   // used only for "arguments".
   virtual nsresult SetProperty(JS::Handle<JSObject*> aTarget,
                                const char* aPropName, nsISupports* aVal) = 0;
-  /** 
+  /**
    * Called to set/get information if the script context is
    * currently processing a script tag
    */
   virtual bool GetProcessingScriptTag() = 0;
   virtual void SetProcessingScriptTag(bool aResult) = 0;
 
   /**
    * Initialize DOM classes on aGlobalObj, always call
@@ -129,9 +121,8 @@ public:
    * rooted before any call which could trigger GC.
    */
   NS_IMETHOD OnScriptCompileComplete(JSScript* aScript, nsresult aStatus) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIOffThreadScriptReceiver, NS_IOFFTHREADSCRIPTRECEIVER_IID)
 
 #endif // nsIScriptContext_h__
-
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2297,22 +2297,16 @@ nsJSContext::KillICCTimer()
   sCCLockedOutTime = 0;
 
   if (sICCTimer) {
     sICCTimer->Cancel();
     NS_RELEASE(sICCTimer);
   }
 }
 
-void
-nsJSContext::GC(JS::gcreason::Reason aReason)
-{
-  PokeGC(aReason);
-}
-
 class NotifyGCEndRunnable : public nsRunnable
 {
   nsString mMessage;
 
 public:
   explicit NotifyGCEndRunnable(const nsString& aMessage) : mMessage(aMessage) {}
 
   NS_DECL_NSIRUNNABLE
--- a/dom/base/nsJSEnvironment.h
+++ b/dom/base/nsJSEnvironment.h
@@ -120,18 +120,16 @@ public:
   static void KillCCTimer();
   static void KillICCTimer();
   static void KillFullGCTimer();
   static void KillInterSliceGCTimer();
 
   // Calling LikelyShortLivingObjectCreated() makes a GC more likely.
   static void LikelyShortLivingObjectCreated();
 
-  virtual void GC(JS::gcreason::Reason aReason) MOZ_OVERRIDE;
-
   static uint32_t CleanupsSinceLastGC();
 
   nsIScriptGlobalObject* GetCachedGlobalObject()
   {
     // Verify that we have a global so that this
     // does always return a null when GetGlobalObject() is null.
     JSObject* global = GetWindowProxy();
     return global ? mGlobalObjectRef.get() : nullptr;