Bug 903212 - Remove nsIXPCScriptNotify machinery. r=mrbkap

This commit is contained in:
Bobby Holley 2013-08-14 14:00:03 -07:00
Родитель 0846601377
Коммит 03c1b0ddf4
8 изменённых файлов: 2 добавлений и 87 удалений

Просмотреть файл

@ -929,8 +929,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsJSContext)
NS_INTERFACE_MAP_ENTRY(nsIScriptContext)
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptNotify)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptContext)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
@ -1921,12 +1920,6 @@ nsJSContext::SetProcessingScriptTag(bool aFlag)
mProcessingScriptTag = aFlag;
}
NS_IMETHODIMP
nsJSContext::ScriptExecuted()
{
return NS_OK;
}
void
FullGCTimerFired(nsITimer* aTimer, void* aClosure)
{

Просмотреть файл

@ -12,7 +12,6 @@
#include "jsapi.h"
#include "jsfriendapi.h"
#include "nsIObserver.h"
#include "nsIXPCScriptNotify.h"
#include "prtime.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIXPConnect.h"
@ -32,8 +31,7 @@ template <class> class Maybe;
// a page) and doing the actual GC.
#define NS_GC_DELAY 4000 // ms
class nsJSContext : public nsIScriptContext,
public nsIXPCScriptNotify
class nsJSContext : public nsIScriptContext
{
public:
nsJSContext(JSRuntime* aRuntime, bool aGCOnDestruction,
@ -81,8 +79,6 @@ public:
virtual nsresult Deserialize(nsIObjectInputStream* aStream,
JS::MutableHandle<JSScript*> aResult) MOZ_OVERRIDE;
NS_DECL_NSIXPCSCRIPTNOTIFY
static void LoadStart();
static void LoadEnd();

Просмотреть файл

@ -24,7 +24,6 @@
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsIXPConnect.h"
#include "nsIXPCScriptNotify.h"
#include "nsPrintfCString.h"
#include "nsHostObjectProtocolHandler.h"
@ -842,8 +841,6 @@ public:
void PostRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aRunResult)
{
// Notify before WorkerRunnable::PostRun, since that can kill aWorkerPrivate
NotifyScriptExecutedIfNeeded();
WorkerRunnable::PostRun(aCx, aWorkerPrivate, aRunResult);
}
};
@ -990,8 +987,6 @@ public:
void PostRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aRunResult)
{
// Notify before WorkerRunnable::PostRun, since that can kill aWorkerPrivate
NotifyScriptExecutedIfNeeded();
WorkerRunnable::PostRun(aCx, aWorkerPrivate, aRunResult);
}
@ -1738,18 +1733,6 @@ WorkerRunnable::PostRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
}
}
void
WorkerRunnable::NotifyScriptExecutedIfNeeded() const
{
// if we're on the main thread notify about the end of our script execution.
if (mTarget == ParentThread && !mWorkerPrivate->GetParent()) {
AssertIsOnMainThread();
if (mWorkerPrivate->GetScriptNotify()) {
mWorkerPrivate->GetScriptNotify()->ScriptExecuted();
}
}
}
struct WorkerPrivate::TimeoutInfo
{
TimeoutInfo()
@ -1939,7 +1922,6 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
mWindow.swap(aWindow);
mScriptContext.swap(aScriptContext);
mScriptNotify = do_QueryInterface(mScriptContext);
mBaseURI.swap(aBaseURI);
mPrincipal.swap(aPrincipal);
mChannel.swap(aChannel);
@ -2248,7 +2230,6 @@ WorkerPrivateParent<Derived>::ForgetMainThreadObjects(
SwapToISupportsArray(mWindow, aDoomed);
SwapToISupportsArray(mScriptContext, aDoomed);
SwapToISupportsArray(mScriptNotify, aDoomed);
SwapToISupportsArray(mBaseURI, aDoomed);
SwapToISupportsArray(mScriptURI, aDoomed);
SwapToISupportsArray(mPrincipal, aDoomed);

Просмотреть файл

@ -41,7 +41,6 @@ class nsIScriptContext;
class nsIURI;
class nsPIDOMWindow;
class nsITimer;
class nsIXPCScriptNotify;
namespace JS {
class RuntimeStats;
@ -110,8 +109,6 @@ protected:
virtual void
PostRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aRunResult);
void NotifyScriptExecutedIfNeeded() const;
public:
NS_DECL_NSIRUNNABLE
};
@ -267,7 +264,6 @@ private:
// Main-thread things.
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsIScriptContext> mScriptContext;
nsCOMPtr<nsIXPCScriptNotify> mScriptNotify;
nsCOMPtr<nsIURI> mBaseURI;
nsCOMPtr<nsIURI> mScriptURI;
nsCOMPtr<nsIPrincipal> mPrincipal;
@ -466,13 +462,6 @@ public:
return mScriptContext;
}
nsIXPCScriptNotify*
GetScriptNotify() const
{
AssertIsOnMainThread();
return mScriptNotify;
}
JSObject*
GetJSObject() const
{

Просмотреть файл

@ -9,7 +9,6 @@ XPIDL_SOURCES += [
'nsIJSEngineTelemetryStats.idl',
'nsIJSRuntimeService.idl',
'nsIScriptError.idl',
'nsIXPCScriptNotify.idl',
'nsIXPCScriptable.idl',
'nsIXPCSecurityManager.idl',
'nsIXPConnect.idl',

Просмотреть файл

@ -1,25 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/. */
/**
* nsIXPCScriptNotify is an interface that is used for notifying a client
* that the script has been evaluated by XPConnect. if any JSContext in our
* JSRuntime has set the JSOPTION_PRIVATE_IS_NSISUPPORTS option and the
* private context supports nsIXPCScriptNotify then this method is invoked
*/
#include "nsISupports.idl"
[uuid(13aceb15-812a-476a-9326-2adc00250b76)]
interface nsIXPCScriptNotify : nsISupports
{
/**
* Method invoked when a script has been executed by XPConnect
*/
void ScriptExecuted();
};

Просмотреть файл

@ -72,22 +72,6 @@ AutoScriptEvaluate::~AutoScriptEvaluate()
JS_EndRequest(mJSContext);
// If this is a JSContext that has a private context that provides a
// nsIXPCScriptNotify interface, then notify the object the script has
// been executed.
//
// Note: We rely on the rule that if any JSContext in our JSRuntime has
// private data that points to an nsISupports subclass, it has also set
// the JSOPTION_PRIVATE_IS_NSISUPPORTS option.
if (JS_GetOptions(mJSContext) & JSOPTION_PRIVATE_IS_NSISUPPORTS) {
nsCOMPtr<nsIXPCScriptNotify> scriptNotify =
do_QueryInterface(static_cast<nsISupports*>
(JS_GetContextPrivate(mJSContext)));
if (scriptNotify)
scriptNotify->ScriptExecuted();
}
if (mErrorReporterSet)
JS_SetErrorReporter(mJSContext, NULL);
}

Просмотреть файл

@ -159,8 +159,6 @@
#include "nsIScriptSecurityManager.h"
#include "nsNetUtil.h"
#include "nsIXPCScriptNotify.h" // used to notify: ScriptEvaluated
#include "nsIPrincipal.h"
#include "nsJSPrincipals.h"
#include "nsIScriptObjectPrincipal.h"