Bug 904826 - Remove some unneeded nsLayoutStatics calls. r=smaug,bholley,bz

This commit is contained in:
Andrew McCreight 2013-08-27 15:39:02 -07:00
parent bb164a9906
commit d168e85a9e
18 changed files with 13 additions and 54 deletions

View File

@ -117,7 +117,6 @@
#include "nsWrapperCacheInlines.h"
#include "xpcpublic.h"
#include "nsIScriptError.h"
#include "nsLayoutStatics.h"
#include "mozilla/Telemetry.h"
#include "mozilla/CORSMode.h"

View File

@ -116,7 +116,6 @@
#include "nsCycleCollector.h"
#include "xpcpublic.h"
#include "nsIScriptError.h"
#include "nsLayoutStatics.h"
#include "mozilla/Telemetry.h"
#include "mozilla/CORSMode.h"
@ -1041,21 +1040,19 @@ class ContentUnbinder : public nsRunnable
public:
ContentUnbinder()
{
nsLayoutStatics::AddRef();
mLast = this;
}
~ContentUnbinder()
{
Run();
nsLayoutStatics::Release();
}
void UnbindSubtree(nsIContent* aNode)
{
if (aNode->NodeType() != nsIDOMNode::ELEMENT_NODE &&
aNode->NodeType() != nsIDOMNode::DOCUMENT_FRAGMENT_NODE) {
return;
return;
}
FragmentOrElement* container = static_cast<FragmentOrElement*>(aNode);
uint32_t childCount = container->mAttrsAndChildren.ChildCount();

View File

@ -29,7 +29,6 @@
#include "nsIPrompt.h"
#include "nsIStringBundle.h"
#include "nsIConsoleService.h"
#include "nsLayoutStatics.h"
#include "nsIDOMCloseEvent.h"
#include "nsICryptoHash.h"
#include "jsdbgapi.h"
@ -459,7 +458,6 @@ WebSocket::WebSocket()
mInnerWindowID(0)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
nsLayoutStatics::AddRef();
SetIsDOMBinding();
}
@ -472,7 +470,6 @@ WebSocket::~WebSocket()
if (!mDisconnected) {
Disconnect();
}
nsLayoutStatics::Release();
}
JSObject*

View File

@ -141,7 +141,6 @@
#include "nsIWordBreaker.h"
#include "nsIXPConnect.h"
#include "nsJSUtils.h"
#include "nsLayoutStatics.h"
#include "nsLWBrkCIID.h"
#include "nsMutationEvent.h"
#include "nsNetCID.h"
@ -5612,35 +5611,14 @@ nsContentUtils::WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
NS_ENSURE_TRUE(sXPConnect, NS_ERROR_UNEXPECTED);
// Keep sXPConnect alive. If we're on the main
// thread then this can be done simply and cheaply by adding a reference to
// nsLayoutStatics. If we're not on the main thread then we need to add a
// more expensive reference sXPConnect directly. We have to use manual
// AddRef and Release calls so don't early-exit from this function after we've
// added the reference!
bool isMainThread = NS_IsMainThread();
if (isMainThread) {
nsLayoutStatics::AddRef();
}
else {
sXPConnect->AddRef();
if (!NS_IsMainThread()) {
MOZ_CRASH();
}
nsresult rv = NS_OK;
{
AutoPushJSContext context(cx);
rv = sXPConnect->WrapNativeToJSVal(context, scope, native, cache, aIID,
aAllowWrapping, vp, aHolder);
}
if (isMainThread) {
nsLayoutStatics::Release();
}
else {
sXPConnect->Release();
}
AutoPushJSContext context(cx);
rv = sXPConnect->WrapNativeToJSVal(context, scope, native, cache, aIID,
aAllowWrapping, vp, aHolder);
return rv;
}

View File

@ -33,7 +33,6 @@
#include "nsCExternalHandlerService.h"
#include "nsIStreamConverterService.h"
#include "nsCycleCollectionParticipant.h"
#include "nsLayoutStatics.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsHostObjectProtocolHandler.h"
#include "mozilla/Base64.h"
@ -105,7 +104,6 @@ nsDOMFileReader::nsDOMFileReader()
mDataLen(0), mDataFormat(FILE_AS_BINARY),
mResultArrayBuffer(nullptr)
{
nsLayoutStatics::AddRef();
SetDOMStringToNull(mResult);
SetIsDOMBinding();
}
@ -115,7 +113,6 @@ nsDOMFileReader::~nsDOMFileReader()
FreeFileData();
mResultArrayBuffer = nullptr;
NS_DROP_JS_OBJECTS(this, nsDOMFileReader);
nsLayoutStatics::Release();
}

View File

@ -76,7 +76,6 @@
#include "nsViewManager.h"
#include "nsIWebNavigation.h"
#include "nsIWidget.h"
#include "nsLayoutStatics.h"
#include "nsLayoutUtils.h"
#include "nsMutationEvent.h"
#include "nsNetUtil.h"

View File

@ -42,7 +42,6 @@
#include "nsIContentPolicy.h"
#include "nsContentPolicyUtils.h"
#include "nsError.h"
#include "nsLayoutStatics.h"
#include "nsCrossSiteListenerProxy.h"
#include "nsIHTMLDocument.h"
#include "nsIStorageStream.h"
@ -302,8 +301,6 @@ nsXMLHttpRequest::nsXMLHttpRequest()
mResultArrayBuffer(nullptr),
mXPCOMifier(nullptr)
{
nsLayoutStatics::AddRef();
mAlreadySetHeaders.Init();
SetIsDOMBinding();
@ -327,8 +324,6 @@ nsXMLHttpRequest::~nsXMLHttpRequest()
mResultJSON = JSVAL_VOID;
mResultArrayBuffer = nullptr;
NS_DROP_JS_OBJECTS(this, nsXMLHttpRequest);
nsLayoutStatics::Release();
}
void

View File

@ -5,7 +5,7 @@
#include "mozilla/dom/EventTarget.h"
#include "nsEventListenerManager.h"
#include "nsThreadUtils.h"
namespace mozilla {
namespace dom {

View File

@ -13,6 +13,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsEventListenerManager.h"
#include "nsIScriptContext.h"
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/EventTarget.h"

View File

@ -24,6 +24,7 @@
#include "mozilla/Util.h"
#include "nsCycleCollector.h"
#include "nsIXPConnect.h"
#include "nsThreadUtils.h" // Hacky work around for some bindings needing NS_IsMainThread.
#include "nsTraceRefcnt.h"
#include "qsObjectHelper.h"
#include "xpcpublic.h"

View File

@ -29,7 +29,6 @@
#include "nsWrapperCache.h"
#include "nsJSEnvironment.h"
#include "xpcpublic.h"
#include "nsLayoutStatics.h"
namespace mozilla {
namespace dom {

View File

@ -9,8 +9,6 @@
#include "ArchiveEvent.h"
#include "ArchiveZipEvent.h"
#include "nsLayoutStatics.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
@ -52,13 +50,11 @@ ArchiveReader::ArchiveReader(nsIDOMBlob* aBlob, nsPIDOMWindow* aWindow,
MOZ_ASSERT(aBlob);
MOZ_ASSERT(aWindow);
nsLayoutStatics::AddRef();
SetIsDOMBinding();
}
ArchiveReader::~ArchiveReader()
{
nsLayoutStatics::Release();
}
/* virtual */ JSObject*

View File

@ -9,7 +9,6 @@
#include "mozilla/dom/ArchiveRequestBinding.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsLayoutStatics.h"
#include "nsEventDispatcher.h"
USING_FILE_NAMESPACE
@ -55,7 +54,6 @@ ArchiveRequest::ArchiveRequest(nsIDOMWindow* aWindow,
MOZ_ASSERT(aReader);
MOZ_COUNT_CTOR(ArchiveRequest);
nsLayoutStatics::AddRef();
/* An event to make this request asynchronous: */
nsRefPtr<ArchiveRequestEvent> event = new ArchiveRequestEvent(this);
@ -65,7 +63,6 @@ ArchiveRequest::ArchiveRequest(nsIDOMWindow* aWindow,
ArchiveRequest::~ArchiveRequest()
{
MOZ_COUNT_DTOR(ArchiveRequest);
nsLayoutStatics::Release();
}
nsresult

View File

@ -13,6 +13,7 @@
#include "mozilla/dom/IDBIndexBinding.h"
#include "mozilla/dom/IDBObjectStoreBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "nsThreadUtils.h"
#include "mozilla/dom/indexedDB/IDBRequest.h"
#include "mozilla/dom/indexedDB/IDBTransaction.h"

View File

@ -13,6 +13,7 @@
#include "nsPIDOMWindow.h"
#include "WorkerPrivate.h"
#include "nsJSPrincipals.h"
#include "nsThreadUtils.h"
namespace mozilla {
namespace dom {

View File

@ -7,6 +7,7 @@
#include "mozilla/dom/PromiseResolver.h"
#include "mozilla/dom/PromiseBinding.h"
#include "mozilla/dom/Promise.h"
#include "nsThreadUtils.h"
#include "PromiseCallback.h"
namespace mozilla {

View File

@ -25,7 +25,6 @@
#include "mozilla/Telemetry.h"
#include "mozilla/Services.h"
#include "nsLayoutStatics.h"
#include "nsContentUtils.h"
#include "nsCxPusher.h"
#include "nsCCUncollectableMarker.h"

View File

@ -64,6 +64,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCycleCollector.h"
#include "nsDOMJSUtils.h"
#include "nsThreadUtils.h"
#include "xpcpublic.h"
using namespace mozilla;