From 1bb7f2a9083e54920e57c062f9e129ce32e96e84 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:26 +0100 Subject: [PATCH 01/69] Bug 888338 - 1 - Add TenuredHeap class r=terrence r=bz --- content/base/src/nsContentUtils.cpp | 1 + dom/base/nsGlobalWindow.cpp | 16 ++- dom/base/nsGlobalWindow.h | 4 +- js/public/RootingAPI.h | 133 ++++++++++++++++++++++--- js/src/jsapi.cpp | 7 +- js/src/jsapi.h | 8 +- js/src/jsgc.cpp | 7 ++ js/src/jsgc.h | 2 +- js/xpconnect/src/XPCWrappedNative.cpp | 34 ++++--- js/xpconnect/src/xpcprivate.h | 48 ++++----- xpcom/base/CycleCollectedJSRuntime.cpp | 1 + 11 files changed, 190 insertions(+), 71 deletions(-) diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index dce857800d4..f3749a7cdc0 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -1650,6 +1650,7 @@ nsContentUtils::TraceSafeJSContext(JSTracer* aTrc) return; } if (JSObject* global = js::GetDefaultGlobalForContext(cx)) { + JS::AssertGCThingMustBeTenured(global); JS_CallObjectTracer(aTrc, &global, "safe context"); MOZ_ASSERT(global == js::GetDefaultGlobalForContext(cx)); } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 390e75fe428..f97ba94e603 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1027,7 +1027,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow) mTimeoutInsertionPoint(nullptr), mTimeoutPublicIdCounter(1), mTimeoutFiringDepth(0), - mJSObject(nullptr), mTimeoutsSuspendDepth(0), mFocusMethod(0), mSerial(0), @@ -1865,7 +1864,7 @@ void nsGlobalWindow::TraceGlobalJSObject(JSTracer* aTrc) { if (mJSObject) { - JS_CallObjectTracer(aTrc, &mJSObject, "active window global"); + JS_CallTenuredObjectTracer(aTrc, &mJSObject, "active window global"); } } @@ -2117,14 +2116,13 @@ CreateNativeGlobalForInner(JSContext* aCx, nsGlobalWindow* aNewInner, nsIURI* aURI, nsIPrincipal* aPrincipal, - JSObject** aNativeGlobal, + JS::TenuredHeap& aNativeGlobal, nsIXPConnectJSObjectHolder** aHolder) { MOZ_ASSERT(aCx); MOZ_ASSERT(aNewInner); MOZ_ASSERT(aNewInner->IsInnerWindow()); MOZ_ASSERT(aPrincipal); - MOZ_ASSERT(aNativeGlobal); MOZ_ASSERT(aHolder); nsGlobalWindow *top = NULL; @@ -2154,13 +2152,13 @@ CreateNativeGlobalForInner(JSContext* aCx, NS_ENSURE_SUCCESS(rv, rv); MOZ_ASSERT(jsholder); - *aNativeGlobal = jsholder->GetJSObject(); + aNativeGlobal = jsholder->GetJSObject(); jsholder.forget(aHolder); // Set the location information for the new global, so that tools like // about:memory may use that information - MOZ_ASSERT(*aNativeGlobal); - xpc::SetLocationForGlobal(*aNativeGlobal, aURI); + MOZ_ASSERT(aNativeGlobal.getPtr()); + xpc::SetLocationForGlobal(aNativeGlobal, aURI); return NS_OK; } @@ -2353,7 +2351,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, rv = CreateNativeGlobalForInner(cx, newInnerWindow, aDocument->GetDocumentURI(), aDocument->NodePrincipal(), - &newInnerWindow->mJSObject, + newInnerWindow->mJSObject, getter_AddRefs(mInnerWindowHolder)); NS_ASSERTION(NS_SUCCEEDED(rv) && newInnerWindow->mJSObject && mInnerWindowHolder, "Failed to get script global and holder"); @@ -3153,7 +3151,7 @@ nsGlobalWindow::PoisonOuterWindowProxy(JSObject *aObject) { MOZ_ASSERT(IsOuterWindow()); if (aObject == mJSObject) { - mJSObject = reinterpret_cast(0x1); + mJSObject.setToCrashOnTouch(); } } diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 38a5619eba3..b70109d4fc6 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1225,7 +1225,9 @@ protected: // These member variables are used on both inner and the outer windows. nsCOMPtr mDocumentPrincipal; - JSObject* mJSObject; + + // The JS global object. Global objects are always allocated tenured. + JS::TenuredHeap mJSObject; typedef nsCOMArray nsDOMStorageEventArray; nsDOMStorageEventArray mPendingStorageEvents; diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index db244c0c4b4..f0315d810e4 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -169,21 +169,19 @@ struct JS_PUBLIC_API(NullPtr) }; /* - * An encapsulated pointer class for heap based GC thing pointers. + * The Heap class is a C/C++ heap-stored reference to a JS GC thing. All + * members of heap classes that refer to GC thing should use Heap (or + * possibly TenuredHeap, described below). * - * This implements post-barriers for GC thing pointers stored on the heap. It is - * designed to be used for all heap-based GC thing pointers outside the JS - * engine. + * Heap wraps the complex mechanisms required to ensure GC safety for the + * contained reference into a C++ class that behaves similarly to a normal + * pointer. * - * The template parameter T must be a JS GC thing pointer, masked pointer or - * possible pointer, such as a JS::Value or jsid. + * GC references stored on the C/C++ stack must use Rooted/Handle/MutableHandle + * instead. * - * The class must be used to declare data members of heap classes only. - * Stack-based GC thing pointers should used Rooted. - * - * Write barriers are implemented by overloading the assingment operator. - * Assiging to a Heap triggers the appropriate calls into the GC to notify it - * of the change. + * Requirements for type T: + * - Must be one of: Value, jsid, JSObject*, JSString*, JSScript* */ template class Heap : public js::HeapBase @@ -257,6 +255,117 @@ class Heap : public js::HeapBase T ptr; }; +#ifdef DEBUG +/* + * For generational GC, assert that an object is in the tenured generation as + * opposed to being in the nursery. + */ +extern JS_FRIEND_API(void) +AssertGCThingMustBeTenured(JSObject* obj); +#else +inline void +AssertGCThingMustBeTenured(JSObject *obj) {} +#endif + +/* + * The TenuredHeap class is similar to the Heap class above in that it + * encapsulates the GC concerns of an on-heap reference to a JS object. However, + * it has two important differences: + * + * 1) Pointers which are statically known to only reference "tenured" objects + * can avoid the extra overhead of SpiderMonkey's write barriers. + * + * 2) Objects in the "tenured" heap have stronger alignment restrictions than + * those in the "nursery", so it is possible to store flags in the lower + * bits of pointers known to be tenured. TenuredHeap wraps a normal tagged + * pointer with a nice API for accessing the flag bits and adds various + * assertions to ensure that it is not mis-used. + * + * GC things are said to be "tenured" when they are located in the long-lived + * heap: e.g. they have gained tenure as an object by surviving past at least + * one GC. For performance, SpiderMonkey allocates some things which are known + * to normally be long lived directly into the tenured generation; for example, + * global objects. Additionally, SpiderMonkey does not visit individual objects + * when deleting non-tenured objects, so object with finalizers are also always + * tenured; for instance, this includes most DOM objects. + * + * The considerations to keep in mind when using a TenuredHeap vs a normal + * Heap are: + * + * - It is invalid for a TenuredHeap to refer to a non-tenured thing. + * - It is however valid for a Heap to refer to a tenured thing. + * - It is not possible to store flag bits in a Heap. + */ +template +class TenuredHeap : public js::HeapBase +{ + public: + TenuredHeap() : bits(0) { + MOZ_STATIC_ASSERT(sizeof(T) == sizeof(TenuredHeap), + "TenuredHeap must be binary compatible with T."); + } + explicit TenuredHeap(T p) : bits(0) { setPtr(p); } + explicit TenuredHeap(const TenuredHeap &p) : bits(0) { setPtr(p.ptr); } + + bool operator==(const TenuredHeap &other) { return bits == other.bits; } + bool operator!=(const TenuredHeap &other) { return bits != other.bits; } + + void setPtr(T newPtr) { + JS_ASSERT((reinterpret_cast(newPtr) & flagsMask) == 0); + JS_ASSERT(!js::GCMethods::poisoned(newPtr)); + if (newPtr) + AssertGCThingMustBeTenured(newPtr); + bits = (bits & flagsMask) | reinterpret_cast(newPtr); + } + + void setFlags(uintptr_t flagsToSet) { + JS_ASSERT((flagsToSet & ~flagsMask) == 0); + bits |= flagsToSet; + } + + void unsetFlags(uintptr_t flagsToUnset) { + JS_ASSERT((flagsToUnset & ~flagsMask) == 0); + bits &= ~flagsToUnset; + } + + bool hasFlag(uintptr_t flag) const { + JS_ASSERT((flag & ~flagsMask) == 0); + return (bits & flag) != 0; + } + + T getPtr() const { return reinterpret_cast(bits & ~flagsMask); } + uintptr_t getFlags() const { return bits & flagsMask; } + + operator T() const { return getPtr(); } + T operator->() const { return getPtr(); } + + TenuredHeap &operator=(T p) { + setPtr(p); + return *this; + } + + /* + * Set the pointer to a value which will cause a crash if it is + * dereferenced. + */ + void setToCrashOnTouch() { + bits = (bits & flagsMask) | crashOnTouchPointer; + } + + bool isSetToCrashOnTouch() { + return (bits & ~flagsMask) == crashOnTouchPointer; + } + + private: + enum { + maskBits = 3, + flagsMask = (1 << maskBits) - 1, + crashOnTouchPointer = 1 << maskBits + }; + + uintptr_t bits; +}; + /* * Reference to a T that has been rooted elsewhere. This is most useful * as a parameter type, which guarantees that the T lvalue is properly diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index d6fc513651e..67431a5b022 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -2362,17 +2362,16 @@ JS_CallObjectTracer(JSTracer *trc, JSObject **objp, const char *name) } JS_PUBLIC_API(void) -JS_CallMaskedObjectTracer(JSTracer *trc, uintptr_t *objp, uintptr_t flagMask, const char *name) +JS_CallTenuredObjectTracer(JSTracer *trc, JS::TenuredHeap *objp, const char *name) { - uintptr_t flags = *objp & flagMask; - JSObject *obj = reinterpret_cast(*objp & ~flagMask); + JSObject *obj = objp->getPtr(); if (!obj) return; JS_SET_TRACING_LOCATION(trc, (void*)objp); MarkObjectUnbarriered(trc, &obj, name); - *objp = uintptr_t(obj) | flags; + objp->setPtr(obj); } JS_PUBLIC_API(void) diff --git a/js/src/jsapi.h b/js/src/jsapi.h index c9a4d71d0b9..947a754bf63 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -2586,13 +2586,11 @@ JS_CallHashSetObjectTracer(JSTracer *trc, HashSetEnum &e, JSObject *const &key, } /* - * The JS_CallMaskedObjectTracer variant traces a JSObject* that is stored - * with flags embedded in the low bits of the word. The flagMask parameter - * expects |*objp & flagMask| to yield the flags with the pointer value - * stripped and |*objp & ~flagMask| to yield a valid GC pointer. + * Trace an object that is known to always be tenured. No post barriers are + * required in this case. */ extern JS_PUBLIC_API(void) -JS_CallMaskedObjectTracer(JSTracer *trc, uintptr_t *objp, uintptr_t flagMask, const char *name); +JS_CallTenuredObjectTracer(JSTracer *trc, JS::TenuredHeap *objp, const char *name); /* * API for JSTraceCallback implementations. diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 2d272615387..27b165f66bf 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -5107,4 +5107,11 @@ AutoDisableProxyCheck::AutoDisableProxyCheck(JSRuntime *rt MOZ_GUARD_OBJECT_NOTIFIER_INIT; count++; } + +JS_FRIEND_API(void) +JS::AssertGCThingMustBeTenured(JSObject *obj) +{ + JS_ASSERT((!IsNurseryAllocable(obj->tenuredGetAllocKind()) || obj->getClass()->finalize) && + obj->isTenured()); +} #endif diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 60121e11638..079bea86886 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -151,7 +151,7 @@ template <> struct MapTypeToTraceKind { const static JSGCTrace template <> struct MapTypeToTraceKind { const static JSGCTraceKind kind = JSTRACE_STRING; }; template <> struct MapTypeToTraceKind { const static JSGCTraceKind kind = JSTRACE_IONCODE; }; -#ifdef JSGC_GENERATIONAL +#if defined(JSGC_GENERATIONAL) || defined(DEBUG) static inline bool IsNurseryAllocable(AllocKind kind) { diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 35a954dcfaf..b92d405dbd1 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -367,6 +367,7 @@ XPCWrappedNative::WrapNewGlobal(xpcObjectHelper &nativeHelper, // Set the JS object to the global we already created. wrapper->mFlatJSObject = global; + wrapper->mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID); // Set the private to the XPCWrappedNative. JS_SetPrivate(global, wrapper); @@ -757,11 +758,10 @@ XPCWrappedNative::XPCWrappedNative(already_AddRefed aIdentity, XPCWrappedNativeProto* aProto) : mMaybeProto(aProto), mSet(aProto->GetSet()), - mFlatJSObject(INVALID_OBJECT), // non-null to pass IsValid() test - mScriptableInfo(nullptr), - mWrapperWord(0) + mScriptableInfo(nullptr) { mIdentity = aIdentity.get(); + mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID); NS_ASSERTION(mMaybeProto, "bad ctor param"); NS_ASSERTION(mSet, "bad ctor param"); @@ -776,11 +776,10 @@ XPCWrappedNative::XPCWrappedNative(already_AddRefed aIdentity, : mMaybeScope(TagScope(aScope)), mSet(aSet), - mFlatJSObject(INVALID_OBJECT), // non-null to pass IsValid() test - mScriptableInfo(nullptr), - mWrapperWord(0) + mScriptableInfo(nullptr) { mIdentity = aIdentity.get(); + mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID); NS_ASSERTION(aScope, "bad ctor param"); NS_ASSERTION(aSet, "bad ctor param"); @@ -795,8 +794,6 @@ XPCWrappedNative::~XPCWrappedNative() Destroy(); } -static const intptr_t WRAPPER_WORD_POISON = 0xa8a8a8a8; - void XPCWrappedNative::Destroy() { @@ -835,14 +832,14 @@ XPCWrappedNative::Destroy() * The only time GetRuntime() will be NULL is if Destroy is called a second * time on a wrapped native. Since we already unregistered the pointer the * first time, there's no need to unregister again. Unregistration is safe - * the first time because mWrapperWord isn't used afterwards. + * the first time because mWrapper isn't used afterwards. */ if (XPCJSRuntime *rt = GetRuntime()) { if (IsIncrementalBarrierNeeded(rt->Runtime())) IncrementalObjectBarrier(GetWrapperPreserveColor()); - mWrapperWord = WRAPPER_WORD_POISON; + mWrapper.setToCrashOnTouch(); } else { - MOZ_ASSERT(mWrapperWord == WRAPPER_WORD_POISON); + MOZ_ASSERT(mWrapper.isSetToCrashOnTouch()); } mMaybeScope = nullptr; @@ -1033,9 +1030,12 @@ XPCWrappedNative::Init(HandleObject parent, } mFlatJSObject = JS_NewObject(cx, jsclazz, protoJSObject, parent); - if (!mFlatJSObject) + if (!mFlatJSObject) { + mFlatJSObject.unsetFlags(FLAT_JS_OBJECT_VALID); return false; + } + mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID); JS_SetPrivate(mFlatJSObject, this); return FinishInit(); @@ -1179,8 +1179,8 @@ XPCWrappedNative::FlatJSObjectFinalized() if (cache) cache->ClearWrapper(); - // This makes IsValid return false from now on... mFlatJSObject = nullptr; + mFlatJSObject.unsetFlags(FLAT_JS_OBJECT_VALID); NS_ASSERTION(mIdentity, "bad pointer!"); #ifdef XP_WIN @@ -1227,7 +1227,8 @@ XPCWrappedNative::SystemIsBeingShutDown() // short circuit future finalization JS_SetPrivate(mFlatJSObject, nullptr); - mFlatJSObject = nullptr; // This makes 'IsValid()' return false. + mFlatJSObject = nullptr; + mFlatJSObject.unsetFlags(FLAT_JS_OBJECT_VALID); XPCWrappedNativeProto* proto = GetProto(); @@ -1472,7 +1473,10 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCWrappedNativeScope* aOldScope, MOZ_CRASH(); } + MOZ_ASSERT(flat); wrapper->mFlatJSObject = flat; + wrapper->mFlatJSObject.setFlags(FLAT_JS_OBJECT_VALID); + if (cache) { bool preserving = cache->PreservingWrapper(); cache->SetPreservingWrapper(false); @@ -2934,7 +2938,7 @@ NS_IMETHODIMP XPCWrappedNative::DebugDump(int16_t depth) else XPC_LOG_ALWAYS(("mSet @ %x", mSet)); - XPC_LOG_ALWAYS(("mFlatJSObject of %x", mFlatJSObject)); + XPC_LOG_ALWAYS(("mFlatJSObject of %x", mFlatJSObject.getPtr())); XPC_LOG_ALWAYS(("mIdentity of %x", mIdentity)); XPC_LOG_ALWAYS(("mScriptableInfo @ %x", mScriptableInfo)); diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index b7e3c84a364..6c13af47353 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -1385,6 +1385,8 @@ public: js::SystemAllocPolicy> DOMExpandoSet; bool RegisterDOMExpandoObject(JSObject *expando) { + // Expandos are proxy objects, and proxies are always tenured. + JS::AssertGCThingMustBeTenured(expando); if (!mDOMExpandoSet) { mDOMExpandoSet = new DOMExpandoSet(); mDOMExpandoSet->init(8); @@ -2259,7 +2261,7 @@ public: nsIPrincipal* GetObjectPrincipal() const; JSBool - IsValid() const {return nullptr != mFlatJSObject;} + IsValid() const { return mFlatJSObject.hasFlag(FLAT_JS_OBJECT_VALID); } #define XPC_SCOPE_WORD(s) (intptr_t(s)) #define XPC_SCOPE_MASK (intptr_t(0x3)) @@ -2309,8 +2311,7 @@ public: */ JSObject* GetFlatJSObject() const - {if (mFlatJSObject != INVALID_OBJECT) - xpc_UnmarkGrayObject(mFlatJSObject); + {xpc_UnmarkGrayObject(mFlatJSObject); return mFlatJSObject;} /** @@ -2443,8 +2444,7 @@ public: else GetScope()->TraceSelf(trc); TraceWrapper(trc); - if (mFlatJSObject && mFlatJSObject != INVALID_OBJECT && - JS_IsGlobalObject(mFlatJSObject)) + if (mFlatJSObject && JS_IsGlobalObject(mFlatJSObject)) { TraceXPCGlobal(trc, mFlatJSObject); } @@ -2460,9 +2460,9 @@ public: // This is the only time we should be tracing our mFlatJSObject, // normally somebody else is doing that. Be careful not to trace the // bogus INVALID_OBJECT value we can have during init, though. - if (mFlatJSObject && mFlatJSObject != INVALID_OBJECT) { - JS_CallObjectTracer(trc, &mFlatJSObject, - "XPCWrappedNative::mFlatJSObject"); + if (mFlatJSObject) { + JS_CallTenuredObjectTracer(trc, &mFlatJSObject, + "XPCWrappedNative::mFlatJSObject"); } } @@ -2490,13 +2490,12 @@ public: JSBool HasExternalReference() const {return mRefCnt > 1;} - JSBool NeedsSOW() { return !!(mWrapperWord & NEEDS_SOW); } - void SetNeedsSOW() { mWrapperWord |= NEEDS_SOW; } - JSBool NeedsCOW() { return !!(mWrapperWord & NEEDS_COW); } - void SetNeedsCOW() { mWrapperWord |= NEEDS_COW; } + JSBool NeedsSOW() { return mWrapper.hasFlag(WRAPPER_NEEDS_SOW); } + void SetNeedsSOW() { mWrapper.setFlags(WRAPPER_NEEDS_SOW); } + JSBool NeedsCOW() { return mWrapper.hasFlag(WRAPPER_NEEDS_COW); } + void SetNeedsCOW() { mWrapper.setFlags(WRAPPER_NEEDS_COW); } - JSObject* GetWrapperPreserveColor() const - {return (JSObject*)(mWrapperWord & (size_t)~(size_t)FLAG_MASK);} + JSObject* GetWrapperPreserveColor() const { return mWrapper.getPtr(); } JSObject* GetWrapper() { @@ -2511,20 +2510,18 @@ public: void SetWrapper(JSObject *obj) { JS::IncrementalObjectBarrier(GetWrapperPreserveColor()); - intptr_t newval = intptr_t(obj) | (mWrapperWord & FLAG_MASK); - mWrapperWord = newval; + mWrapper.setPtr(obj); } void TraceWrapper(JSTracer *trc) { - JS_CallMaskedObjectTracer(trc, reinterpret_cast(&mWrapperWord), - (uintptr_t)FLAG_MASK, "XPCWrappedNative::mWrapper"); + JS_CallTenuredObjectTracer(trc, &mWrapper, "XPCWrappedNative::mWrapper"); } // Returns the relevant same-compartment security if applicable, or // mFlatJSObject otherwise. // - // This takes care of checking mWrapperWord to see if we already have such + // This takes care of checking mWrapper to see if we already have such // a wrapper. JSObject *GetSameCompartmentSecurityWrapper(JSContext *cx); @@ -2550,9 +2547,12 @@ protected: private: enum { - NEEDS_SOW = JS_BIT(0), - NEEDS_COW = JS_BIT(1), - FLAG_MASK = JS_BITMASK(3) + // Flags bits for mWrapper: + WRAPPER_NEEDS_SOW = JS_BIT(0), + WRAPPER_NEEDS_COW = JS_BIT(1), + + // Flags bits for mFlatJSObject: + FLAT_JS_OBJECT_VALID = JS_BIT(0) }; private: @@ -2581,10 +2581,10 @@ private: XPCWrappedNativeProto* mMaybeProto; }; XPCNativeSet* mSet; - JSObject* mFlatJSObject; + JS::TenuredHeap mFlatJSObject; XPCNativeScriptableInfo* mScriptableInfo; XPCWrappedNativeTearOffChunk mFirstChunk; - intptr_t mWrapperWord; + JS::TenuredHeap mWrapper; }; /*************************************************************************** diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index 1a103408a72..f2ce633b9f6 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -563,6 +563,7 @@ CycleCollectedJSRuntime::MaybeTraceGlobals(JSTracer* aTracer) const } if (JSObject* global = js::GetDefaultGlobalForContext(acx)) { + JS::AssertGCThingMustBeTenured(global); JS_CallObjectTracer(aTracer, &global, "Global Object"); } } From d8798632f11964e3646398e6d8b204eac8d2ed0c Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:26 +0100 Subject: [PATCH 02/69] Bug 888338 - 2 - give post barrier callback function an extra data argument r=terrence --- js/src/gc/StoreBuffer.h | 12 +++++++----- js/src/jsfriendapi.cpp | 14 ++++++++++++-- js/src/jsfriendapi.h | 18 ++++++++++++++++-- js/xpconnect/src/XPCMaps.h | 13 ++++++------- 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/js/src/gc/StoreBuffer.h b/js/src/gc/StoreBuffer.h index b734b97082c..137f9d7b1f6 100644 --- a/js/src/gc/StoreBuffer.h +++ b/js/src/gc/StoreBuffer.h @@ -356,17 +356,18 @@ class StoreBuffer class CallbackRef : public BufferableRef { public: - typedef void (*MarkCallback)(JSTracer *trc, void *key); + typedef void (*MarkCallback)(JSTracer *trc, void *key, void *data); - CallbackRef(MarkCallback cb, void *k) : callback(cb), key(k) {} + CallbackRef(MarkCallback cb, void *k, void *d) : callback(cb), key(k), data(d) {} virtual void mark(JSTracer *trc) { - callback(trc, key); + callback(trc, key, data); } private: MarkCallback callback; void *key; + void *data; }; MonoTypeBuffer bufferVal; @@ -451,8 +452,9 @@ class StoreBuffer } /* Insert or update a callback entry. */ - void putCallback(CallbackRef::MarkCallback callback, void *key) { - bufferGeneric.put(CallbackRef(callback, key)); + void putCallback(CallbackRef::MarkCallback callback, Cell *key, void *data) { + if (!key->isTenured()) + bufferGeneric.put(CallbackRef(callback, key, data)); } /* Mark the source of all edges in the store buffer. */ diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index 483b818eae9..11ee2d207c9 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -1121,8 +1121,18 @@ js::IsInRequest(JSContext *cx) #ifdef JSGC_GENERATIONAL JS_FRIEND_API(void) -JS_StorePostBarrierCallback(JSContext* cx, void (*callback)(JSTracer *trc, void *key), void *key) +JS_StoreObjectPostBarrierCallback(JSContext* cx, + void (*callback)(JSTracer *trc, void *key, void *data), + JSObject *key, void *data) { - cx->runtime()->gcStoreBuffer.putCallback(callback, key); + cx->runtime()->gcStoreBuffer.putCallback(callback, key, data); +} + +extern JS_FRIEND_API(void) +JS_StoreStringPostBarrierCallback(JSContext* cx, + void (*callback)(JSTracer *trc, void *key, void *data), + JSString *key, void *data) +{ + cx->runtime()->gcStoreBuffer.putCallback(callback, key, data); } #endif /* JSGC_GENERATIONAL */ diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index be8613c9048..9339dd7ee21 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -1794,10 +1794,24 @@ js_ReportIsNotFunction(JSContext *cx, const JS::Value& v); #ifdef JSGC_GENERATIONAL extern JS_FRIEND_API(void) -JS_StorePostBarrierCallback(JSContext* cx, void (*callback)(JSTracer *trc, void *key), void *key); +JS_StoreObjectPostBarrierCallback(JSContext* cx, + void (*callback)(JSTracer *trc, void *key, void *data), + JSObject *key, void *data); + +extern JS_FRIEND_API(void) +JS_StoreStringPostBarrierCallback(JSContext* cx, + void (*callback)(JSTracer *trc, void *key, void *data), + JSString *key, void *data); #else inline void -JS_StorePostBarrierCallback(JSContext* cx, void (*callback)(JSTracer *trc, void *key), void *key) {} +JS_StoreObjectPostBarrierCallback(JSContext* cx, + void (*callback)(JSTracer *trc, void *key, void *data), + JSObject *key, void *data) {} + +inline void +JS_StoreStringPostBarrierCallback(JSContext* cx, + void (*callback)(JSTracer *trc, void *key, void *data), + JSString *key, void *data) {} #endif /* JSGC_GENERATIONAL */ #endif /* jsfriendapi_h */ diff --git a/js/xpconnect/src/XPCMaps.h b/js/xpconnect/src/XPCMaps.h index 2978af41966..1a8152658f4 100644 --- a/js/xpconnect/src/XPCMaps.h +++ b/js/xpconnect/src/XPCMaps.h @@ -54,7 +54,7 @@ public: return p->value; if (!mTable.add(p, obj, wrapper)) return nullptr; - JS_StorePostBarrierCallback(cx, KeyMarkCallback, obj); + JS_StoreObjectPostBarrierCallback(cx, KeyMarkCallback, obj, this); return wrapper; } @@ -87,12 +87,11 @@ private: * This function is called during minor GCs for each key in the HashMap that * has been moved. */ - static void KeyMarkCallback(JSTracer *trc, void *k) { + static void KeyMarkCallback(JSTracer *trc, void *k, void *d) { JSObject *key = static_cast(k); + JSObject2WrappedJSMap* self = static_cast(d); JSObject *prior = key; JS_CallObjectTracer(trc, &key, "XPCJSRuntime::mWrappedJSMap key"); - XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance(); - JSObject2WrappedJSMap* self = rt->GetWrappedJSMap(); self->mTable.rekey(prior, key); } @@ -650,7 +649,7 @@ public: if (!mTable.add(p, key, value)) return nullptr; MOZ_ASSERT(xpc::GetObjectScope(key)->mWaiverWrapperMap == this); - JS_StorePostBarrierCallback(cx, KeyMarkCallback, key); + JS_StoreObjectPostBarrierCallback(cx, KeyMarkCallback, key, this); return value; } @@ -697,11 +696,11 @@ private: * This function is called during minor GCs for each key in the HashMap that * has been moved. */ - static void KeyMarkCallback(JSTracer *trc, void *k) { + static void KeyMarkCallback(JSTracer *trc, void *k, void *d) { JSObject *key = static_cast(k); + JSObject2JSObjectMap *self = static_cast(d); JSObject *prior = key; JS_CallObjectTracer(trc, &key, "XPCWrappedNativeScope::mWaiverWrapperMap key"); - JSObject2JSObjectMap *self = xpc::GetObjectScope(key)->mWaiverWrapperMap; self->mTable.rekey(prior, key); } From f8a6950a3bb135ecc5cee2143014753f282c53f8 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:26 +0100 Subject: [PATCH 03/69] Bug 888338 - 3 - don't call gray root tracer for minor GCs r=terrence --- js/src/gc/RootMarking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index 70a19188ebe..e382b3a747b 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -771,7 +771,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots) /* During GC, we don't mark gray roots at this stage. */ if (JSTraceDataOp op = rt->gcGrayRootTracer.op) { - if (!IS_GC_MARKING_TRACER(trc)) + if (!IS_GC_MARKING_TRACER(trc) && !trc->runtime->isHeapMinorCollecting()) (*op)(trc, rt->gcGrayRootTracer.data); } } From 54dcfe4766bd27952104dc56ba2023176464502a Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:27 +0100 Subject: [PATCH 04/69] Bug 888338 - 4 - post barrier CTypes r=terrence --- js/src/ctypes/CTypes.cpp | 32 ++++++++++++++++++++++---------- js/src/ctypes/CTypes.h | 30 +++++++++++++++--------------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 3f458de335b..12c2278eb44 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -3325,11 +3325,12 @@ CType::Trace(JSTracer* trc, JSObject* obj) FieldInfoHash* fields = static_cast(JSVAL_TO_PRIVATE(slot)); - for (FieldInfoHash::Range r = fields->all(); !r.empty(); r.popFront()) { - JSString *key = r.front().key; + for (FieldInfoHash::Enum e(*fields); !e.empty(); e.popFront()) { + JSString *key = e.front().key; JS_CallStringTracer(trc, &key, "fieldName"); - JS_ASSERT(key == r.front().key); - JS_CallObjectTracer(trc, &r.front().value.mType, "fieldType"); + if (key != e.front().key) + e.rekeyFront(JS_ASSERT_STRING_IS_FLAT(key)); + JS_CallHeapObjectTracer(trc, &e.front().value.mType, "fieldType"); } break; @@ -3344,10 +3345,10 @@ CType::Trace(JSTracer* trc, JSObject* obj) JS_ASSERT(fninfo); // Identify our objects to the tracer. - JS_CallObjectTracer(trc, &fninfo->mABI, "abi"); - JS_CallObjectTracer(trc, &fninfo->mReturnType, "returnType"); + JS_CallHeapObjectTracer(trc, &fninfo->mABI, "abi"); + JS_CallHeapObjectTracer(trc, &fninfo->mReturnType, "returnType"); for (size_t i = 0; i < fninfo->mArgTypes.length(); ++i) - JS_CallObjectTracer(trc, &fninfo->mArgTypes[i], "argType"); + JS_CallHeapObjectTracer(trc, &fninfo->mArgTypes[i], "argType"); break; } @@ -4733,6 +4734,16 @@ StructType::Create(JSContext* cx, unsigned argc, jsval* vp) return JS_TRUE; } +static void +PostBarrierCallback(JSTracer *trc, void *k, void *d) +{ + JSString *prior = static_cast(k); + FieldInfoHash *table = static_cast(d); + JSString *key = prior; + JS_CallStringTracer(trc, &key, "CType fieldName"); + table->rekey(JS_ASSERT_STRING_IS_FLAT(prior), JS_ASSERT_STRING_IS_FLAT(key)); +} + JSBool StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsObj_) { @@ -4823,6 +4834,7 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb info.mIndex = i; info.mOffset = fieldOffset; ASSERT_OK(fields->add(entryPtr, name, info)); + JS_StoreStringPostBarrierCallback(cx, PostBarrierCallback, name, fields.get()); structSize = fieldOffset + fieldSize; @@ -6082,10 +6094,10 @@ CClosure::Trace(JSTracer* trc, JSObject* obj) // Identify our objects to the tracer. (There's no need to identify // 'closureObj', since that's us.) - JS_CallObjectTracer(trc, &cinfo->typeObj, "typeObj"); - JS_CallObjectTracer(trc, &cinfo->jsfnObj, "jsfnObj"); + JS_CallHeapObjectTracer(trc, &cinfo->typeObj, "typeObj"); + JS_CallHeapObjectTracer(trc, &cinfo->jsfnObj, "jsfnObj"); if (cinfo->thisObj) - JS_CallObjectTracer(trc, &cinfo->thisObj, "thisObj"); + JS_CallHeapObjectTracer(trc, &cinfo->thisObj, "thisObj"); } void diff --git a/js/src/ctypes/CTypes.h b/js/src/ctypes/CTypes.h index dfc650ea06c..ff0be8285f0 100644 --- a/js/src/ctypes/CTypes.h +++ b/js/src/ctypes/CTypes.h @@ -211,9 +211,9 @@ enum TypeCode { // as the key to the hash entry. struct FieldInfo { - JSObject* mType; // CType of the field - size_t mIndex; // index of the field in the struct (first is 0) - size_t mOffset; // offset of the field in the struct, in bytes + JS::Heap mType; // CType of the field + size_t mIndex; // index of the field in the struct (first is 0) + size_t mOffset; // offset of the field in the struct, in bytes }; // Hash policy for FieldInfos. @@ -255,14 +255,14 @@ struct FunctionInfo // Calling convention of the function. Convert to ffi_abi using GetABI // and OBJECT_TO_JSVAL. Stored as a JSObject* for ease of tracing. - JSObject* mABI; + JS::Heap mABI; // The CType of the value returned by the function. - JSObject* mReturnType; + JS::Heap mReturnType; // A fixed array of known parameter types, excluding any variadic // parameters (if mIsVariadic). - Array mArgTypes; + Array > mArgTypes; // A variable array of ffi_type*s corresponding to both known parameter // types and dynamic (variadic) parameter types. Longer than mArgTypes @@ -277,15 +277,15 @@ struct FunctionInfo // Parameters necessary for invoking a JS function from a C closure. struct ClosureInfo { - JSContext* cx; // JSContext to use - JSRuntime* rt; // Used in the destructor, where cx might have already - // been GCed. - JSObject* closureObj; // CClosure object - JSObject* typeObj; // FunctionType describing the C function - JSObject* thisObj; // 'this' object to use for the JS function call - JSObject* jsfnObj; // JS function - void* errResult; // Result that will be returned if the closure throws - ffi_closure* closure; // The C closure itself + JSContext* cx; // JSContext to use + JSRuntime* rt; // Used in the destructor, where cx might have already + // been GCed. + JS::Heap closureObj; // CClosure object + JS::Heap typeObj; // FunctionType describing the C function + JS::Heap thisObj; // 'this' object to use for the JS function call + JS::Heap jsfnObj; // JS function + void* errResult; // Result that will be returned if the closure throws + ffi_closure* closure; // The C closure itself // Anything conditionally freed in the destructor should be initialized to // NULL here. From e8d192d169dffcc1f266118d736c59ae29f05343 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:27 +0100 Subject: [PATCH 05/69] Bug 888338 - 5 - post barrier remaining heap-based GC things in XPConnect r=bholley --- js/xpconnect/src/XPCVariant.cpp | 2 +- js/xpconnect/src/XPCWrappedNative.cpp | 2 +- js/xpconnect/src/xpcprivate.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/xpconnect/src/XPCVariant.cpp b/js/xpconnect/src/XPCVariant.cpp index 814aa52c80e..972630c9859 100644 --- a/js/xpconnect/src/XPCVariant.cpp +++ b/js/xpconnect/src/XPCVariant.cpp @@ -69,7 +69,7 @@ void XPCTraceableVariant::TraceJS(JSTracer* trc) { MOZ_ASSERT(JSVAL_IS_TRACEABLE(mJSVal)); JS_SET_TRACING_DETAILS(trc, GetTraceName, this, 0); - JS_CallValueTracer(trc, &mJSVal, "XPCTraceableVariant::mJSVal"); + JS_CallHeapValueTracer(trc, &mJSVal, "XPCTraceableVariant::mJSVal"); } // static diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index b92d405dbd1..2b2f3097881 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -3403,7 +3403,7 @@ void XPCJSObjectHolder::TraceJS(JSTracer *trc) { JS_SET_TRACING_DETAILS(trc, GetTraceName, this, 0); - JS_CallObjectTracer(trc, &mJSObj, "XPCJSObjectHolder::mJSObj"); + JS_CallHeapObjectTracer(trc, &mJSObj, "XPCJSObjectHolder::mJSObj"); } // static diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 6c13af47353..ef464488bd7 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -2829,7 +2829,7 @@ private: XPCJSObjectHolder(JSObject* obj); XPCJSObjectHolder(); // not implemented - JSObject* mJSObj; + JS::Heap mJSObj; }; /*************************************************************************** @@ -3640,7 +3640,7 @@ protected: protected: nsDiscriminatedUnion mData; - jsval mJSVal; + JS::Heap mJSVal; bool mReturnRawObject : 1; uint32_t mCCGeneration : 31; }; From c561caee589c53c15ba79fb8151e778e8442548b Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:27 +0100 Subject: [PATCH 06/69] Bug 888338 - 6 - more browser post barriers r=mccr8 --- .../xul/document/src/nsXULPrototypeCache.cpp | 4 ++-- .../xul/document/src/nsXULPrototypeCache.h | 14 ++++++------ dom/bindings/BindingUtils.cpp | 6 ++--- dom/bindings/BindingUtils.h | 15 ++++++------- dom/bindings/Codegen.py | 6 ++--- dom/bindings/DOMJSClass.h | 4 ++-- dom/plugins/base/nsJSNPRuntime.cpp | 22 +++++++++---------- 7 files changed, 34 insertions(+), 37 deletions(-) diff --git a/content/xul/document/src/nsXULPrototypeCache.cpp b/content/xul/document/src/nsXULPrototypeCache.cpp index 933d5f2d65a..615dd7a6843 100644 --- a/content/xul/document/src/nsXULPrototypeCache.cpp +++ b/content/xul/document/src/nsXULPrototypeCache.cpp @@ -656,10 +656,10 @@ nsXULPrototypeCache::MarkInCCGeneration(uint32_t aGeneration) } static PLDHashOperator -MarkScriptsInGC(nsIURI* aKey, JSScript*& aScript, void* aClosure) +MarkScriptsInGC(nsIURI* aKey, JS::Heap& aScript, void* aClosure) { JSTracer* trc = static_cast(aClosure); - JS_CallScriptTracer(trc, &aScript, "nsXULPrototypeCache script"); + JS_CallHeapScriptTracer(trc, &aScript, "nsXULPrototypeCache script"); return PL_DHASH_NEXT; } diff --git a/content/xul/document/src/nsXULPrototypeCache.h b/content/xul/document/src/nsXULPrototypeCache.h index c052cbb3b76..b51e80ca66a 100644 --- a/content/xul/document/src/nsXULPrototypeCache.h +++ b/content/xul/document/src/nsXULPrototypeCache.h @@ -9,7 +9,7 @@ #include "nsCOMPtr.h" #include "nsIObserver.h" #include "nsXBLDocumentInfo.h" -#include "nsDataHashtable.h" +#include "nsJSThingHashtable.h" #include "nsInterfaceHashtable.h" #include "nsRefPtrHashtable.h" #include "nsURIHashKey.h" @@ -123,14 +123,14 @@ protected: void FlushSkinFiles(); - nsRefPtrHashtable mPrototypeTable; // owns the prototypes - nsRefPtrHashtable mStyleSheetTable; - nsDataHashtable mScriptTable; - nsRefPtrHashtable mXBLDocTable; + nsRefPtrHashtable mPrototypeTable; // owns the prototypes + nsRefPtrHashtable mStyleSheetTable; + nsJSThingHashtable mScriptTable; + nsRefPtrHashtable mXBLDocTable; - nsTHashtable mCacheURITable; + nsTHashtable mCacheURITable; - nsInterfaceHashtable mOutputStreamTable; + nsInterfaceHashtable mOutputStreamTable; nsInterfaceHashtable mInputStreamTable; // Bootstrap caching service diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp index 8d32901a653..2f3ca6f1589 100644 --- a/dom/bindings/BindingUtils.cpp +++ b/dom/bindings/BindingUtils.cpp @@ -553,11 +553,11 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle global, void CreateInterfaceObjects(JSContext* cx, JS::Handle global, JS::Handle protoProto, - JSClass* protoClass, JSObject** protoCache, + JSClass* protoClass, JS::Heap* protoCache, JS::Handle constructorProto, JSClass* constructorClass, const JSNativeHolder* constructor, unsigned ctorNargs, const NamedConstructor* namedConstructors, - JSObject** constructorCache, const DOMClass* domClass, + JS::Heap* constructorCache, const DOMClass* domClass, const NativeProperties* properties, const NativeProperties* chromeOnlyProperties, const char* name) @@ -990,7 +990,7 @@ ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle wrapper, JS::Rooted global(cx, js::GetGlobalForObjectCrossCompartment(obj)); { JSAutoCompartment ac(cx, global); - JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(global); + JS::Heap* protoAndIfaceArray = GetProtoAndIfaceArray(global); JSObject* protoOrIface = protoAndIfaceArray[protoAndIfaceArrayIndex]; if (!protoOrIface) { return false; diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index e0a21134072..98681beed0f 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -277,8 +277,7 @@ AllocateProtoAndIfaceCache(JSObject* obj) MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL); MOZ_ASSERT(js::GetReservedSlot(obj, DOM_PROTOTYPE_SLOT).isUndefined()); - // Important: The () at the end ensure zero-initialization - JSObject** protoAndIfaceArray = new JSObject*[kProtoAndIfaceCacheCount](); + JS::Heap* protoAndIfaceArray = new JS::Heap[kProtoAndIfaceCacheCount]; js::SetReservedSlot(obj, DOM_PROTOTYPE_SLOT, JS::PrivateValue(protoAndIfaceArray)); @@ -291,10 +290,10 @@ TraceProtoAndIfaceCache(JSTracer* trc, JSObject* obj) if (!HasProtoAndIfaceArray(obj)) return; - JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(obj); + JS::Heap* protoAndIfaceArray = GetProtoAndIfaceArray(obj); for (size_t i = 0; i < kProtoAndIfaceCacheCount; ++i) { if (protoAndIfaceArray[i]) { - JS_CallObjectTracer(trc, &protoAndIfaceArray[i], "protoAndIfaceArray[i]"); + JS_CallHeapObjectTracer(trc, &protoAndIfaceArray[i], "protoAndIfaceArray[i]"); } } } @@ -304,7 +303,7 @@ DestroyProtoAndIfaceCache(JSObject* obj) { MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL); - JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(obj); + JS::Heap* protoAndIfaceArray = GetProtoAndIfaceArray(obj); delete [] protoAndIfaceArray; } @@ -371,11 +370,11 @@ struct NamedConstructor void CreateInterfaceObjects(JSContext* cx, JS::Handle global, JS::Handle protoProto, - JSClass* protoClass, JSObject** protoCache, + JSClass* protoClass, JS::Heap* protoCache, JS::Handle interfaceProto, JSClass* constructorClass, const JSNativeHolder* constructor, unsigned ctorNargs, const NamedConstructor* namedConstructors, - JSObject** constructorCache, const DOMClass* domClass, + JS::Heap* constructorCache, const DOMClass* domClass, const NativeProperties* regularProperties, const NativeProperties* chromeOnlyProperties, const char* name); @@ -2048,7 +2047,7 @@ ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle obj); inline JSObject* GetUnforgeableHolder(JSObject* aGlobal, prototypes::ID aId) { - JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal); + JS::Heap* protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal); JSObject* interfaceProto = protoAndIfaceArray[aId]; return &js::GetReservedSlot(interfaceProto, DOM_INTERFACE_PROTO_SLOTS_BASE).toObject(); diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 7c8375d5406..0591184a45b 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1684,7 +1684,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod): def __init__(self, descriptor, properties): args = [Argument('JSContext*', 'aCx'), Argument('JS::Handle', 'aGlobal'), - Argument('JSObject**', 'protoAndIfaceArray')] + Argument('JS::Heap*', 'protoAndIfaceArray')] CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args) self.properties = properties def definition_body(self): @@ -1887,13 +1887,13 @@ class CGGetPerInterfaceObject(CGAbstractMethod): return JS::NullPtr(); } /* Check to see whether the interface objects are already installed */ - JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal); + JS::Heap* protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal); if (!protoAndIfaceArray[%s]) { CreateInterfaceObjects(aCx, aGlobal, protoAndIfaceArray); } /* The object might _still_ be null, but that's OK */ - return JS::Handle::fromMarkedLocation(&protoAndIfaceArray[%s]);""" % + return JS::Handle(protoAndIfaceArray[%s]);""" % (self.id, self.id)) class CGGetProtoObjectMethod(CGGetPerInterfaceObject): diff --git a/dom/bindings/DOMJSClass.h b/dom/bindings/DOMJSClass.h index f884cca75f2..c6548f5ddd5 100644 --- a/dom/bindings/DOMJSClass.h +++ b/dom/bindings/DOMJSClass.h @@ -260,11 +260,11 @@ HasProtoAndIfaceArray(JSObject* global) return !js::GetReservedSlot(global, DOM_PROTOTYPE_SLOT).isUndefined(); } -inline JSObject** +inline JS::Heap* GetProtoAndIfaceArray(JSObject* global) { MOZ_ASSERT(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL); - return static_cast( + return static_cast*>( js::GetReservedSlot(global, DOM_PROTOTYPE_SLOT).toPrivate()); } diff --git a/dom/plugins/base/nsJSNPRuntime.cpp b/dom/plugins/base/nsJSNPRuntime.cpp index af721c99ea5..4dbb5f2b218 100644 --- a/dom/plugins/base/nsJSNPRuntime.cpp +++ b/dom/plugins/base/nsJSNPRuntime.cpp @@ -164,9 +164,9 @@ JSClass sNPObjectJSWrapperClass = }; typedef struct NPObjectMemberPrivate { - JSObject *npobjWrapper; - JS::Value fieldValue; - NPIdentifier methodName; + JS::Heap npobjWrapper; + JS::Heap fieldValue; + JS::Heap methodName; NPP npp; } NPObjectMemberPrivate; @@ -2017,7 +2017,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj, memberPrivate->npobjWrapper = obj; memberPrivate->fieldValue = fieldValue; - memberPrivate->methodName = identifier; + memberPrivate->methodName = id; memberPrivate->npp = npp; ::JS_RemoveValueRoot(cx, vp); @@ -2124,7 +2124,7 @@ NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp) NPVariant npv; JSBool ok; - ok = npobj->_class->invoke(npobj, memberPrivate->methodName, + ok = npobj->_class->invoke(npobj, JSIdToNPIdentifier(memberPrivate->methodName), npargs, argc, &npv); // Release arguments. @@ -2162,20 +2162,18 @@ NPObjectMember_Trace(JSTracer *trc, JSObject *obj) return; // Our NPIdentifier is not always interned, so we must root it explicitly. - jsid id = NPIdentifierToJSId(memberPrivate->methodName); - JS_CallIdTracer(trc, &id, "NPObjectMemberPrivate.methodName"); - memberPrivate->methodName = JSIdToNPIdentifier(id); + JS_CallHeapIdTracer(trc, &memberPrivate->methodName, "NPObjectMemberPrivate.methodName"); if (!JSVAL_IS_PRIMITIVE(memberPrivate->fieldValue)) { - JS_CallValueTracer(trc, &memberPrivate->fieldValue, - "NPObject Member => fieldValue"); + JS_CallHeapValueTracer(trc, &memberPrivate->fieldValue, + "NPObject Member => fieldValue"); } // There's no strong reference from our private data to the // NPObject, so make sure to mark the NPObject wrapper to keep the // NPObject alive as long as this NPObjectMember is alive. if (memberPrivate->npobjWrapper) { - JS_CallObjectTracer(trc, &memberPrivate->npobjWrapper, - "NPObject Member => npobjWrapper"); + JS_CallHeapObjectTracer(trc, &memberPrivate->npobjWrapper, + "NPObject Member => npobjWrapper"); } } From f9660af75a9705f058419992911e92f6351cad76 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:27 +0100 Subject: [PATCH 07/69] Bug 888338 - 7 - add post barriers to workers r=smaug --- dom/workers/EventListenerManager.cpp | 8 ++--- dom/workers/WorkerPrivate.cpp | 21 ++++++++----- dom/workers/WorkerScope.cpp | 4 +-- dom/workers/XMLHttpRequest.cpp | 44 +++++++++++++++++++++++----- dom/workers/XMLHttpRequest.h | 4 +-- 5 files changed, 57 insertions(+), 24 deletions(-) diff --git a/dom/workers/EventListenerManager.cpp b/dom/workers/EventListenerManager.cpp index 2633c6b5775..08934d62790 100644 --- a/dom/workers/EventListenerManager.cpp +++ b/dom/workers/EventListenerManager.cpp @@ -60,7 +60,7 @@ private: struct ListenerData : LinkedListElement { - JSObject* mListener; + JS::Heap mListener; EventListenerManager::Phase mPhase; bool mWantsUntrusted; @@ -184,9 +184,9 @@ EventListenerManager::TraceInternal(JSTracer* aTrc) const for (const ListenerData* listenerElem = collection->mListeners.getFirst(); listenerElem; listenerElem = listenerElem->getNext()) { - JS_CallObjectTracer(aTrc, - &const_cast(listenerElem)->mListener, - "EventListenerManager listener object"); + JS_CallHeapObjectTracer(aTrc, + &const_cast(listenerElem)->mListener, + "EventListenerManager listener object"); } } } diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 8d926a36328..7ca592c5ab1 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -1763,8 +1763,8 @@ struct WorkerPrivate::TimeoutInfo return mTargetTime < aOther.mTargetTime; } - JS::Value mTimeoutVal; - nsTArray mExtraArgVals; + JS::Heap mTimeoutVal; + nsTArray > mExtraArgVals; mozilla::TimeStamp mTargetTime; mozilla::TimeDuration mInterval; nsCString mFilename; @@ -3398,11 +3398,11 @@ WorkerPrivate::TraceInternal(JSTracer* aTrc) for (uint32_t index = 0; index < mTimeouts.Length(); index++) { TimeoutInfo* info = mTimeouts[index]; - JS_CallValueTracer(aTrc, &info->mTimeoutVal, - "WorkerPrivate timeout value"); + JS_CallHeapValueTracer(aTrc, &info->mTimeoutVal, + "WorkerPrivate timeout value"); for (uint32_t index2 = 0; index2 < info->mExtraArgVals.Length(); index2++) { - JS_CallValueTracer(aTrc, &info->mExtraArgVals[index2], - "WorkerPrivate timeout extra argument value"); + JS_CallHeapValueTracer(aTrc, &info->mExtraArgVals[index2], + "WorkerPrivate timeout extra argument value"); } } } @@ -3952,7 +3952,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx, unsigned aArgc, jsval* aVp, newInfo->mInterval = TimeDuration::FromMilliseconds(intervalMS); if (aArgc > 2 && newInfo->mTimeoutVal.isObject()) { - nsTArray extraArgVals(aArgc - 2); + nsTArray > extraArgVals(aArgc - 2); for (unsigned index = 2; index < aArgc; index++) { extraArgVals.AppendElement(argv[index]); } @@ -4104,9 +4104,14 @@ WorkerPrivate::RunExpiredTimeouts(JSContext* aCx) } else { JS::Rooted rval(aCx); + /* + * unsafeGet() is needed below because the argument is a not a const + * pointer, even though values are not modified. + */ if (!JS_CallFunctionValue(aCx, global, info->mTimeoutVal, info->mExtraArgVals.Length(), - info->mExtraArgVals.Elements(), rval.address()) && + info->mExtraArgVals.Elements()->unsafeGet(), + rval.address()) && !JS_ReportPendingException(aCx)) { retval = false; break; diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 885330c20ba..62fe51d318a 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -77,7 +77,7 @@ class WorkerGlobalScope : public workers::EventTarget }; // Must be traced! - jsval mSlots[SLOT_COUNT]; + JS::Heap mSlots[SLOT_COUNT]; enum { @@ -128,7 +128,7 @@ protected: _trace(JSTracer* aTrc) MOZ_OVERRIDE { for (int32_t i = 0; i < SLOT_COUNT; i++) { - JS_CallValueTracer(aTrc, &mSlots[i], "WorkerGlobalScope instance slot"); + JS_CallHeapValueTracer(aTrc, &mSlots[i], "WorkerGlobalScope instance slot"); } mWorker->TraceInternal(aTrc); EventTarget::_trace(aTrc); diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 52fdabe2083..1fb32a396e2 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -520,7 +520,7 @@ class EventRunnable : public MainThreadProxyRunnable nsString mResponseType; JSAutoStructuredCloneBuffer mResponseBuffer; nsTArray > mClonedObjects; - jsval mResponse; + JS::Heap mResponse; nsString mResponseText; nsCString mStatusText; uint64_t mLoaded; @@ -607,6 +607,28 @@ public: return true; } + class StateDataAutoRooter : private JS::CustomAutoRooter + { + public: + explicit StateDataAutoRooter(JSContext* aCx, XMLHttpRequest::StateData* aData + MOZ_GUARD_OBJECT_NOTIFIER_PARAM) + : CustomAutoRooter(aCx), mStateData(aData), mSkip(aCx, mStateData) + { + MOZ_GUARD_OBJECT_NOTIFIER_INIT; + } + + private: + virtual void trace(JSTracer* aTrc) + { + JS_CallHeapValueTracer(aTrc, &mStateData->mResponse, + "XMLHttpRequest::StateData::mResponse"); + } + + XMLHttpRequest::StateData* mStateData; + js::SkipRoot mSkip; + MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER + }; + bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) { @@ -665,8 +687,7 @@ public: } XMLHttpRequest::StateData state; - // XXXbz there is no AutoValueRooter anymore? - JS::AutoArrayRooter rooter(aCx, 1, &state.mResponse); + StateDataAutoRooter rooter(aCx, &state); state.mResponseTextResult = mResponseTextResult; state.mResponseText = mResponseText; @@ -1423,9 +1444,9 @@ void XMLHttpRequest::_trace(JSTracer* aTrc) { if (mUpload) { - mUpload->TraceJSObject(aTrc, "mUpload"); + mUpload->TraceJSObject(aTrc, "XMLHttpRequest::mUpload"); } - JS_CallValueTracer(aTrc, &mStateData.mResponse, "mResponse"); + JS_CallHeapValueTracer(aTrc, &mStateData.mResponse, "XMLHttpRequest::mResponse"); XMLHttpRequestEventTarget::_trace(aTrc); } @@ -1510,13 +1531,19 @@ XMLHttpRequest::MaybePin(ErrorResult& aRv) JSContext* cx = GetJSContext(); - if (!JS_AddNamedObjectRoot(cx, &mJSObject, "XMLHttpRequest mJSObject")) { + /* + * It's safe to use unsafeGet() here: the unsafeness comes from the + * possibility of updating the value of mJSObject without triggering the post + * barriers. However if the value will always be marked, post barriers are + * unnecessary. + */ + if (!JS_AddNamedObjectRoot(cx, mJSObject.unsafeGet(), "XMLHttpRequest::mJSObjectRooted")) { aRv.Throw(NS_ERROR_FAILURE); return; } if (!mWorkerPrivate->AddFeature(cx, this)) { - JS_RemoveObjectRoot(cx, &mJSObject); + JS_RemoveObjectRoot(cx, mJSObject.unsafeGet()); aRv.Throw(NS_ERROR_FAILURE); return; } @@ -1635,7 +1662,8 @@ XMLHttpRequest::Unpin() JSContext* cx = GetJSContext(); - JS_RemoveObjectRoot(cx, &mJSObject); + /* See the comment in MaybePin() for why this is safe. */ + JS_RemoveObjectRoot(cx, mJSObject.unsafeGet()); mWorkerPrivate->RemoveFeature(cx, this); diff --git a/dom/workers/XMLHttpRequest.h b/dom/workers/XMLHttpRequest.h index 1ce15261e4d..46296790816 100644 --- a/dom/workers/XMLHttpRequest.h +++ b/dom/workers/XMLHttpRequest.h @@ -31,7 +31,7 @@ public: uint32_t mStatus; nsCString mStatusText; uint16_t mReadyState; - jsval mResponse; + JS::Heap mResponse; nsresult mResponseTextResult; nsresult mStatusResult; nsresult mResponseResult; @@ -44,7 +44,7 @@ public: }; private: - JSObject* mJSObject; + JS::Heap mJSObject; XMLHttpRequestUpload* mUpload; WorkerPrivate* mWorkerPrivate; nsRefPtr mProxy; From da4b383f2bb0fd89180e0a81fd0c0e32a28a8fae Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:27 +0100 Subject: [PATCH 08/69] Bug 891966 - 1 - Don't allow construction of Handle from Heap r=bz --- content/xbl/src/nsXBLProtoImplMethod.cpp | 8 ++++++-- content/xbl/src/nsXBLProtoImplProperty.cpp | 8 ++++++-- content/xul/content/src/nsXULElement.cpp | 7 ++++--- content/xul/content/src/nsXULElement.h | 2 +- dom/bindings/CallbackObject.h | 2 +- dom/bindings/Codegen.py | 4 ++-- js/public/RootingAPI.h | 4 ---- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/content/xbl/src/nsXBLProtoImplMethod.cpp b/content/xbl/src/nsXBLProtoImplMethod.cpp index 4aa0e36815f..e884bae5e90 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -261,7 +261,9 @@ nsXBLProtoImplMethod::Write(nsIScriptContext* aContext, rv = aStream->WriteWStringZ(mName); NS_ENSURE_SUCCESS(rv, rv); - return XBL_SerializeFunction(aContext, aStream, mMethod.AsHeapObject()); + JS::Handle method = + JS::Handle::fromMarkedLocation(mMethod.AsHeapObject().address()); + return XBL_SerializeFunction(aContext, aStream, method); } return NS_OK; @@ -364,7 +366,9 @@ nsXBLProtoImplAnonymousMethod::Write(nsIScriptContext* aContext, nsresult rv = aStream->Write8(aType); NS_ENSURE_SUCCESS(rv, rv); - rv = XBL_SerializeFunction(aContext, aStream, mMethod.AsHeapObject()); + JS::Handle method = + JS::Handle::fromMarkedLocation(mMethod.AsHeapObject().address()); + rv = XBL_SerializeFunction(aContext, aStream, method); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/content/xbl/src/nsXBLProtoImplProperty.cpp b/content/xbl/src/nsXBLProtoImplProperty.cpp index b1eafbb0f5a..b54bc8ec841 100644 --- a/content/xbl/src/nsXBLProtoImplProperty.cpp +++ b/content/xbl/src/nsXBLProtoImplProperty.cpp @@ -358,12 +358,16 @@ nsXBLProtoImplProperty::Write(nsIScriptContext* aContext, NS_ENSURE_SUCCESS(rv, rv); if (mJSAttributes & JSPROP_GETTER) { - rv = XBL_SerializeFunction(aContext, aStream, mGetter.AsHeapObject()); + JS::Handle function = + JS::Handle::fromMarkedLocation(mGetter.AsHeapObject().address()); + rv = XBL_SerializeFunction(aContext, aStream, function); NS_ENSURE_SUCCESS(rv, rv); } if (mJSAttributes & JSPROP_SETTER) { - rv = XBL_SerializeFunction(aContext, aStream, mSetter.AsHeapObject()); + JS::Handle function = + JS::Handle::fromMarkedLocation(mSetter.AsHeapObject().address()); + rv = XBL_SerializeFunction(aContext, aStream, function); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 7babc3b0ac0..d0ca194124c 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2381,7 +2381,9 @@ nsXULPrototypeScript::Serialize(nsIObjectOutputStream* aStream, rv = aStream->Write32(mLangVersion); if (NS_FAILED(rv)) return rv; // And delegate the writing to the nsIScriptContext - rv = context->Serialize(aStream, mScriptObject); + JS::Handle script = + JS::Handle::fromMarkedLocation(mScriptObject.address()); + rv = context->Serialize(aStream, script); if (NS_FAILED(rv)) return rv; return NS_OK; @@ -2406,8 +2408,7 @@ nsXULPrototypeScript::SerializeOutOfLine(nsIObjectOutputStream* aStream, "writing to the cache file, but the XUL cache is off?"); bool exists; cache->HasData(mSrcURI, &exists); - - + /* return will be NS_OK from GetAsciiSpec. * that makes no sense. * nor does returning NS_OK from HasMuxedDocument. diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 789e603cc01..63507d1f077 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -243,7 +243,7 @@ public: // &mScriptObject pointer can't go stale. JS::Handle GetScriptObject() { - return JS::Handle(mScriptObject); + return JS::Handle::fromMarkedLocation(mScriptObject.address()); } void TraceScriptObject(JSTracer* aTrc) diff --git a/dom/bindings/CallbackObject.h b/dom/bindings/CallbackObject.h index cd2ed8715c5..d0a24cd45ae 100644 --- a/dom/bindings/CallbackObject.h +++ b/dom/bindings/CallbackObject.h @@ -76,7 +76,7 @@ public: */ JS::Handle CallbackPreserveColor() const { - return mCallback; + return JS::Handle::fromMarkedLocation(mCallback.address()); } enum ExceptionHandling { diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 0591184a45b..59506b9cd14 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1893,7 +1893,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod): } /* The object might _still_ be null, but that's OK */ - return JS::Handle(protoAndIfaceArray[%s]);""" % + return JS::Handle::fromMarkedLocation(protoAndIfaceArray[%s].address());""" % (self.id, self.id)) class CGGetProtoObjectMethod(CGGetPerInterfaceObject): @@ -9842,7 +9842,7 @@ class CallbackOperationBase(CallbackMethod): # This relies on getCallableDecl declaring a boolean # isCallable in the case when we're a single-operation # interface. - return "isCallable ? aThisObj : mCallback" + return "isCallable ? aThisObj.get() : mCallback" def getCallableDecl(self): replacements = { diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index f0315d810e4..2d4c0899336 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -408,10 +408,6 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase ptr = handle.address(); } - Handle(const Heap &heapPtr) { - ptr = heapPtr.address(); - } - /* * This may be called only if the location of the T is guaranteed * to be marked (for some reason other than being a Rooted), From 3155328d9e77f136a14b9fc50a01452adbae0265 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:28 +0100 Subject: [PATCH 09/69] Bug 891966 - 2 - Comment calls to Handle::fromMarkedLocation r=bz --- content/xbl/src/nsXBLProtoImplMethod.cpp | 10 +++++++++- content/xbl/src/nsXBLProtoImplProperty.cpp | 5 +++++ content/xul/content/src/nsXULElement.cpp | 7 ++++++- content/xul/content/src/nsXULElement.h | 3 +++ dom/bindings/CallbackObject.h | 5 +++-- dom/bindings/Codegen.py | 8 +++++++- js/public/RootingAPI.h | 16 ++++++++++++---- 7 files changed, 45 insertions(+), 9 deletions(-) diff --git a/content/xbl/src/nsXBLProtoImplMethod.cpp b/content/xbl/src/nsXBLProtoImplMethod.cpp index e884bae5e90..b80d86808a3 100644 --- a/content/xbl/src/nsXBLProtoImplMethod.cpp +++ b/content/xbl/src/nsXBLProtoImplMethod.cpp @@ -237,6 +237,8 @@ nsresult nsXBLProtoImplMethod::Read(nsIScriptContext* aContext, nsIObjectInputStream* aStream) { + MOZ_ASSERT(!IsCompiled() && !GetUncompiledMethod()); + JS::Rooted methodObject(aContext->GetNativeContext()); nsresult rv = XBL_DeserializeFunction(aContext, aStream, &methodObject); if (NS_FAILED(rv)) { @@ -261,6 +263,9 @@ nsXBLProtoImplMethod::Write(nsIScriptContext* aContext, rv = aStream->WriteWStringZ(mName); NS_ENSURE_SUCCESS(rv, rv); + // Calling fromMarkedLocation() is safe because mMethod is traced by the + // Trace() method above, and because its value is never changed after it has + // been set to a compiled method. JS::Handle method = JS::Handle::fromMarkedLocation(mMethod.AsHeapObject().address()); return XBL_SerializeFunction(aContext, aStream, method); @@ -273,7 +278,7 @@ nsresult nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement) { NS_PRECONDITION(IsCompiled(), "Can't execute uncompiled method"); - + if (!GetCompiledMethod()) { // Nothing to do here return NS_OK; @@ -366,6 +371,9 @@ nsXBLProtoImplAnonymousMethod::Write(nsIScriptContext* aContext, nsresult rv = aStream->Write8(aType); NS_ENSURE_SUCCESS(rv, rv); + // Calling fromMarkedLocation() is safe because mMethod is traced by the + // Trace() method above, and because its value is never changed after it has + // been set to a compiled method. JS::Handle method = JS::Handle::fromMarkedLocation(mMethod.AsHeapObject().address()); rv = XBL_SerializeFunction(aContext, aStream, method); diff --git a/content/xbl/src/nsXBLProtoImplProperty.cpp b/content/xbl/src/nsXBLProtoImplProperty.cpp index b54bc8ec841..41f805bae47 100644 --- a/content/xbl/src/nsXBLProtoImplProperty.cpp +++ b/content/xbl/src/nsXBLProtoImplProperty.cpp @@ -357,6 +357,11 @@ nsXBLProtoImplProperty::Write(nsIScriptContext* aContext, rv = aStream->WriteWStringZ(mName); NS_ENSURE_SUCCESS(rv, rv); + // The calls to fromMarkedLocation() below are safe because mSetter and + // mGetter are traced by the Trace() method above, and because their values + // are never changed after they have been set to a compiled function. + MOZ_ASSERT_IF(mJSAttributes & (JSPROP_GETTER | JSPROP_SETTER), mIsCompiled); + if (mJSAttributes & JSPROP_GETTER) { JS::Handle function = JS::Handle::fromMarkedLocation(mGetter.AsHeapObject().address()); diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index d0ca194124c..c8b7356135e 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -2380,7 +2380,12 @@ nsXULPrototypeScript::Serialize(nsIObjectOutputStream* aStream, if (NS_FAILED(rv)) return rv; rv = aStream->Write32(mLangVersion); if (NS_FAILED(rv)) return rv; - // And delegate the writing to the nsIScriptContext + + // And delegate the writing to the nsIScriptContext. + // + // Calling fromMarkedLocation() is safe because we trace mScriptObject in + // TraceScriptObject() and because its value is never changed after it has + // been set. JS::Handle script = JS::Handle::fromMarkedLocation(mScriptObject.address()); rv = context->Serialize(aStream, script); diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 63507d1f077..0231a1a3eef 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -243,6 +243,9 @@ public: // &mScriptObject pointer can't go stale. JS::Handle GetScriptObject() { + // Calling fromMarkedLocation() is safe because we trace mScriptObject in + // TraceScriptObject() and because its value is never changed after it has + // been set. return JS::Handle::fromMarkedLocation(mScriptObject.address()); } diff --git a/dom/bindings/CallbackObject.h b/dom/bindings/CallbackObject.h index d0a24cd45ae..548e5b122e7 100644 --- a/dom/bindings/CallbackObject.h +++ b/dom/bindings/CallbackObject.h @@ -71,11 +71,11 @@ public: * This should only be called if you are certain that the return value won't * be passed into a JS API function and that it won't be stored without being * rooted (or otherwise signaling the stored value to the CC). - * - * This can return a handle because we trace our mCallback. */ JS::Handle CallbackPreserveColor() const { + // Calling fromMarkedLocation() is safe because we trace our mCallback, and + // because the value of mCallback cannot change after if has been set. return JS::Handle::fromMarkedLocation(mCallback.address()); } @@ -93,6 +93,7 @@ protected: private: inline void Init(JSObject* aCallback) { + MOZ_ASSERT(aCallback && !mCallback); // Set mCallback before we hold, on the off chance that a GC could somehow // happen in there... (which would be pretty odd, granted). mCallback = aCallback; diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 59506b9cd14..15bd23c2d85 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1892,7 +1892,13 @@ class CGGetPerInterfaceObject(CGAbstractMethod): CreateInterfaceObjects(aCx, aGlobal, protoAndIfaceArray); } - /* The object might _still_ be null, but that's OK */ + /* + * The object might _still_ be null, but that's OK. + * + * Calling fromMarkedLocation() is safe because protoAndIfaceArray is + * traced by TraceProtoAndIfaceCache() and its contents are never + * changed after they have been set. + */ return JS::Handle::fromMarkedLocation(protoAndIfaceArray[%s].address());""" % (self.id, self.id)) diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index 2d4c0899336..33fa075fb85 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -409,11 +409,19 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase } /* - * This may be called only if the location of the T is guaranteed - * to be marked (for some reason other than being a Rooted), - * e.g., if it is guaranteed to be reachable from an implicit root. + * Take care when calling this method! * - * Create a Handle from a raw location of a T. + * This creates a Handle from the raw location of a T. + * + * It should be called only if the following conditions hold: + * + * 1) the location of the T is guaranteed to be marked (for some reason + * other than being a Rooted), e.g., if it is guaranteed to be reachable + * from an implicit root. + * + * 2) the contents of the location are immutable, or at least cannot change + * for the lifetime of the handle, as its users may not expect its value + * to change underneath them. */ static Handle fromMarkedLocation(const T *p) { Handle h; From e4fdeb28cacca3d4dd77e4ada1f2125cb4404470 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:28 +0100 Subject: [PATCH 10/69] Bug 896398 - GC: Fix some reported rooting hazards in XPConnect r=bholley --- js/xpconnect/src/XPCConvert.cpp | 12 ++++++------ js/xpconnect/src/XPCWrappedJS.cpp | 3 +-- js/xpconnect/src/XPCWrappedJSClass.cpp | 6 +++--- js/xpconnect/src/XPCWrapper.cpp | 2 +- js/xpconnect/src/XPCWrapper.h | 2 +- js/xpconnect/src/nsXPConnect.cpp | 12 ++++++------ js/xpconnect/src/xpcprivate.h | 10 ++++------ 7 files changed, 22 insertions(+), 25 deletions(-) diff --git a/js/xpconnect/src/XPCConvert.cpp b/js/xpconnect/src/XPCConvert.cpp index 6b10f41acad..1689623da18 100644 --- a/js/xpconnect/src/XPCConvert.cpp +++ b/js/xpconnect/src/XPCConvert.cpp @@ -855,8 +855,9 @@ XPCConvert::NativeInterface2JSObject(jsval* d, // with objects that don't provide necessary QIs (such as objects under // the new DOM bindings). We expect the other side of the CPOW to have // the appropriate wrappers in place. - if (JSObject *cpow = UnwrapNativeCPOW(aHelper.Object())) { - if (!JS_WrapObject(cx, &cpow)) + RootedObject cpow(cx, UnwrapNativeCPOW(aHelper.Object())); + if (cpow) { + if (!JS_WrapObject(cx, cpow.address())) return false; *d = OBJECT_TO_JSVAL(cpow); return true; @@ -1113,13 +1114,12 @@ private: // static nsresult -XPCConvert::JSValToXPCException(jsval sArg, +XPCConvert::JSValToXPCException(MutableHandleValue s, const char* ifaceName, const char* methodName, nsIException** exceptn) { AutoJSContext cx; - RootedValue s(cx, sArg); AutoExceptionRestorer aer(cx, s); if (!JSVAL_IS_PRIMITIVE(s)) { @@ -1575,7 +1575,7 @@ XPCConvert::JSTypedArray2Native(void** d, // static JSBool -XPCConvert::JSArray2Native(void** d, JS::Value s, +XPCConvert::JSArray2Native(void** d, HandleValue s, uint32_t count, const nsXPTType& type, const nsID* iid, nsresult* pErr) { @@ -1759,7 +1759,7 @@ XPCConvert::NativeStringWithSize2JS(jsval* d, const void* s, // static JSBool -XPCConvert::JSStringWithSize2Native(void* d, jsval s, +XPCConvert::JSStringWithSize2Native(void* d, HandleValue s, uint32_t count, const nsXPTType& type, nsresult* pErr) { diff --git a/js/xpconnect/src/XPCWrappedJS.cpp b/js/xpconnect/src/XPCWrappedJS.cpp index b5e7a8d1e41..3c135ec0587 100644 --- a/js/xpconnect/src/XPCWrappedJS.cpp +++ b/js/xpconnect/src/XPCWrappedJS.cpp @@ -275,7 +275,7 @@ CheckMainThreadOnly(nsXPCWrappedJS *aWrapper) // static nsresult -nsXPCWrappedJS::GetNewOrUsed(JSObject* aJSObj, +nsXPCWrappedJS::GetNewOrUsed(JS::HandleObject jsObj, REFNSIID aIID, nsISupports* aOuter, nsXPCWrappedJS** wrapperResult) @@ -285,7 +285,6 @@ nsXPCWrappedJS::GetNewOrUsed(JSObject* aJSObj, MOZ_CRASH(); AutoJSContext cx; - JS::RootedObject jsObj(cx, aJSObj); JSObject2WrappedJSMap* map; nsXPCWrappedJS* root = nullptr; nsXPCWrappedJS* wrapper = nullptr; diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 209b705b6b0..25fe6290efe 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -960,13 +960,13 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx, // to run on this JSContext nsresult pending_result = xpcc->GetPendingResult(); - jsval js_exception; - JSBool is_js_exception = JS_GetPendingException(cx, &js_exception); + RootedValue js_exception(cx); + JSBool is_js_exception = JS_GetPendingException(cx, js_exception.address()); /* JS might throw an expection whether the reporter was called or not */ if (is_js_exception) { if (!xpc_exception) - XPCConvert::JSValToXPCException(js_exception, anInterfaceName, + XPCConvert::JSValToXPCException(&js_exception, anInterfaceName, aPropertyName, getter_AddRefs(xpc_exception)); diff --git a/js/xpconnect/src/XPCWrapper.cpp b/js/xpconnect/src/XPCWrapper.cpp index d59046b2027..da8a11a11e9 100644 --- a/js/xpconnect/src/XPCWrapper.cpp +++ b/js/xpconnect/src/XPCWrapper.cpp @@ -65,7 +65,7 @@ XrayWrapperConstructor(JSContext *cx, unsigned argc, jsval *vp) } // static bool -AttachNewConstructorObject(JSContext *aCx, JSObject *aGlobalObject) +AttachNewConstructorObject(JSContext *aCx, JS::HandleObject aGlobalObject) { // Pushing a JSContext calls ActivateDebugger which calls this function, so // we can't use an AutoJSContext here until JSD is gone. diff --git a/js/xpconnect/src/XPCWrapper.h b/js/xpconnect/src/XPCWrapper.h index 4ca23459085..712032418a0 100644 --- a/js/xpconnect/src/XPCWrapper.h +++ b/js/xpconnect/src/XPCWrapper.h @@ -23,7 +23,7 @@ namespace XPCNativeWrapper { (_wn)->GetScriptableInfo()->GetFlags()._flag()) bool -AttachNewConstructorObject(JSContext *aCx, JSObject *aGlobalObject); +AttachNewConstructorObject(JSContext *aCx, JS::HandleObject aGlobalObject); } // namespace XPCNativeWrapper diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index e9122a98227..30a2f5445b9 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -595,9 +595,9 @@ nsXPConnect::WrapNative(JSContext * aJSContext, NS_ASSERTION(aCOMObj, "bad param"); RootedObject aScope(aJSContext, aScopeArg); - jsval v; + RootedValue v(aJSContext); return NativeInterface2JSObject(aScope, aCOMObj, nullptr, &aIID, - false, &v, aHolder); + false, v.address(), aHolder); } /* void wrapNativeToJSVal (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsISupports aCOMObj, in nsIIDPtr aIID, out jsval aVal, out nsIXPConnectJSObjectHolder aHolder); */ @@ -1389,8 +1389,8 @@ Base64Encode(JSContext *cx, JS::Value val, JS::Value *out) MOZ_ASSERT(cx); MOZ_ASSERT(out); - JS::Value root = val; - xpc_qsACString encodedString(cx, root, &root, xpc_qsACString::eNull, + JS::RootedValue root(cx, val); + xpc_qsACString encodedString(cx, root, root.address(), xpc_qsACString::eNull, xpc_qsACString::eStringify); if (!encodedString.IsValid()) return false; @@ -1415,8 +1415,8 @@ Base64Decode(JSContext *cx, JS::Value val, JS::Value *out) MOZ_ASSERT(cx); MOZ_ASSERT(out); - JS::Value root = val; - xpc_qsACString encodedString(cx, root, &root, xpc_qsACString::eNull, + JS::RootedValue root(cx, val); + xpc_qsACString encodedString(cx, root, root.address(), xpc_qsACString::eNull, xpc_qsACString::eNull); if (!encodedString.IsValid()) return false; diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index ef464488bd7..57ec58efea5 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -2735,7 +2735,7 @@ public: */ static nsresult - GetNewOrUsed(JSObject* aJSObj, + GetNewOrUsed(JS::HandleObject aJSObj, REFNSIID aIID, nsISupports* aOuter, nsXPCWrappedJS** wrapper); @@ -2864,7 +2864,6 @@ public: /** * Convert a native object into a jsval. * - * @param ccx the context for the whole procedure * @param d [out] the resulting jsval * @param s the native object we're working with * @param type the type of object that s is @@ -2886,7 +2885,6 @@ public: /** * Convert a native nsISupports into a JSObject. * - * @param ccx the context for the whole procedure * @param dest [out] the resulting JSObject * @param src the native object we're working with * @param iid the interface of src that we want (may be null) @@ -2931,7 +2929,7 @@ public: const nsXPTType& type, const nsID* iid, uint32_t count, nsresult* pErr); - static JSBool JSArray2Native(void** d, jsval s, + static JSBool JSArray2Native(void** d, JS::HandleValue s, uint32_t count, const nsXPTType& type, const nsID* iid, nsresult* pErr); @@ -2946,11 +2944,11 @@ public: uint32_t count, nsresult* pErr); - static JSBool JSStringWithSize2Native(void* d, jsval s, + static JSBool JSStringWithSize2Native(void* d, JS::HandleValue s, uint32_t count, const nsXPTType& type, nsresult* pErr); - static nsresult JSValToXPCException(jsval s, + static nsresult JSValToXPCException(JS::MutableHandleValue s, const char* ifaceName, const char* methodName, nsIException** exception); From 2236c52eb668cdb3a29ec7060d52ac40ce67ae35 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 23 Jul 2013 10:58:28 +0100 Subject: [PATCH 11/69] Bug 896506 - GC: Fix a couple of rooting hazards in XUL code r=smaug --- content/xul/document/src/nsXULPrototypeCache.cpp | 9 ++------- content/xul/document/src/nsXULPrototypeDocument.cpp | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/content/xul/document/src/nsXULPrototypeCache.cpp b/content/xul/document/src/nsXULPrototypeCache.cpp index 615dd7a6843..35723811226 100644 --- a/content/xul/document/src/nsXULPrototypeCache.cpp +++ b/content/xul/document/src/nsXULPrototypeCache.cpp @@ -197,11 +197,7 @@ nsXULPrototypeCache::PutStyleSheet(nsCSSStyleSheet* aStyleSheet) JSScript* nsXULPrototypeCache::GetScript(nsIURI* aURI) { - JSScript* script; - if (!mScriptTable.Get(aURI, &script)) { - return nullptr; - } - return script; + return mScriptTable.Get(aURI); } nsresult @@ -209,8 +205,7 @@ nsXULPrototypeCache::PutScript(nsIURI* aURI, JS::Handle aScriptObject) { #ifdef DEBUG - JSScript* existingScript; - if (mScriptTable.Get(aURI, &existingScript)) { + if (JSScript* existingScript = mScriptTable.Get(aURI)) { nsAutoCString scriptName; aURI->GetSpec(scriptName); nsAutoCString message("Loaded script "); diff --git a/content/xul/document/src/nsXULPrototypeDocument.cpp b/content/xul/document/src/nsXULPrototypeDocument.cpp index 5651d021b87..e1210fee1b8 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -89,13 +89,8 @@ uint32_t nsXULPrototypeDocument::gRefCnt; void nsXULPDGlobalObject_finalize(JSFreeOp *fop, JSObject *obj) { - nsISupports *nativeThis = (nsISupports*)JS_GetPrivate(obj); - - nsCOMPtr sgo(do_QueryInterface(nativeThis)); - - if (sgo) { - sgo->OnFinalize(obj); - } + nsXULPDGlobalObject* nativeThis = static_cast(JS_GetPrivate(obj)); + nativeThis->OnFinalize(obj); // The addref was part of JSObject construction NS_RELEASE(nativeThis); From 2a40be40d9a4f949209b832c5fd699249aad88fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Tue, 23 Jul 2013 12:43:54 +0200 Subject: [PATCH 12/69] Bug 896918 - Add "Keyboard Shortcuts" item to the Help menu. r=mdeboer --- browser/base/content/baseMenuOverlay.xul | 5 +++++ browser/base/content/browser-appmenu.inc | 4 ++++ browser/locales/en-US/chrome/browser/baseMenuOverlay.dtd | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/browser/base/content/baseMenuOverlay.xul b/browser/base/content/baseMenuOverlay.xul index 4b8a7fd11ad..1b632712395 100644 --- a/browser/base/content/baseMenuOverlay.xul +++ b/browser/base/content/baseMenuOverlay.xul @@ -52,6 +52,11 @@ #else /> #endif + #ifdef MOZ_SERVICES_HEALTHREPORT + #ifdef MOZ_SERVICES_HEALTHREPORT + + + + From 2ecf31c80e1eaae626b0a9a8fe5bacc5b14de99a Mon Sep 17 00:00:00 2001 From: Michael Kohler Date: Tue, 23 Jul 2013 12:49:59 +0200 Subject: [PATCH 13/69] Bug 513165 - remove "Web Search" item from Tools menu. r=dao --- browser/base/content/browser-menubar.inc | 8 -------- browser/locales/en-US/chrome/browser/browser.dtd | 3 +-- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc index 56cf72ceb8d..9dad5048124 100644 --- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -488,14 +488,6 @@ onpopupshowing="gSyncUI.updateUI();" #endif > - - - - + From 831340b96d777f0f991a3462f39e8fa1edafe139 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 25 Jun 2013 14:28:42 -0400 Subject: [PATCH 14/69] bug 887483 - disallow FORCE_STATIC_LIB when LIBXUL_LIBRARY is set because its redundant r=gps --- config/config.mk | 3 +++ js/src/config/config.mk | 3 +++ 2 files changed, 6 insertions(+) diff --git a/config/config.mk b/config/config.mk index e2fa07f47ad..52ef398aa0d 100644 --- a/config/config.mk +++ b/config/config.mk @@ -240,6 +240,9 @@ endif ifdef MODULE_NAME $(error MODULE_NAME is $(MODULE_NAME) but MODULE_NAME and LIBXUL_LIBRARY are not compatible) endif +ifdef FORCE_STATIC_LIB +$(error Makefile sets FORCE_STATIC_LIB which was already implied by LIBXUL_LIBRARY) +endif FORCE_STATIC_LIB=1 ifneq ($(SHORT_LIBNAME),) $(error SHORT_LIBNAME is $(SHORT_LIBNAME) but SHORT_LIBNAME is not compatable with LIBXUL_LIBRARY) diff --git a/js/src/config/config.mk b/js/src/config/config.mk index e2fa07f47ad..52ef398aa0d 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -240,6 +240,9 @@ endif ifdef MODULE_NAME $(error MODULE_NAME is $(MODULE_NAME) but MODULE_NAME and LIBXUL_LIBRARY are not compatible) endif +ifdef FORCE_STATIC_LIB +$(error Makefile sets FORCE_STATIC_LIB which was already implied by LIBXUL_LIBRARY) +endif FORCE_STATIC_LIB=1 ifneq ($(SHORT_LIBNAME),) $(error SHORT_LIBNAME is $(SHORT_LIBNAME) but SHORT_LIBNAME is not compatable with LIBXUL_LIBRARY) From 45f882832c374e3b4e60e1586b24eb0711fdffef Mon Sep 17 00:00:00 2001 From: Mina Almasry Date: Tue, 23 Jul 2013 09:20:19 -0400 Subject: [PATCH 15/69] Bug 734861 - Expose stylesheets, including UA, for a document via inIDOMUtils. r=bz This patch adds an API to inspector utils that gets all stylesheets associated with a document, including UA sheets. --- layout/inspector/public/inIDOMUtils.idl | 3 ++ layout/inspector/src/inDOMUtils.cpp | 44 +++++++++++++++++++ layout/inspector/tests/Makefile.in | 1 + .../tests/test_get_all_style_sheets.html | 40 +++++++++++++++++ 4 files changed, 88 insertions(+) create mode 100644 layout/inspector/tests/test_get_all_style_sheets.html diff --git a/layout/inspector/public/inIDOMUtils.idl b/layout/inspector/public/inIDOMUtils.idl index 02243692197..18a78600083 100644 --- a/layout/inspector/public/inIDOMUtils.idl +++ b/layout/inspector/public/inIDOMUtils.idl @@ -20,6 +20,9 @@ interface nsIDOMCSSStyleSheet; interface inIDOMUtils : nsISupports { // CSS utilities + void getAllStyleSheets (in nsIDOMDocument aDoc, + [optional] out unsigned long aLength, + [array, size_is (aLength), retval] out nsISupports aSheets); nsISupportsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo); unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule); unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule); diff --git a/layout/inspector/src/inDOMUtils.cpp b/layout/inspector/src/inDOMUtils.cpp index 6990e7a1a25..eb166575235 100644 --- a/layout/inspector/src/inDOMUtils.cpp +++ b/layout/inspector/src/inDOMUtils.cpp @@ -36,6 +36,7 @@ #include "mozilla/dom/InspectorUtilsBinding.h" #include "nsCSSProps.h" #include "nsColor.h" +#include "nsStyleSet.h" using namespace mozilla; using namespace mozilla::css; @@ -56,6 +57,49 @@ NS_IMPL_ISUPPORTS1(inDOMUtils, inIDOMUtils) /////////////////////////////////////////////////////////////////////////////// // inIDOMUtils +NS_IMETHODIMP +inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength, + nsISupports ***aSheets) +{ + NS_ENSURE_ARG_POINTER(aDocument); + + nsCOMArray sheets; + + nsCOMPtr document = do_QueryInterface(aDocument); + MOZ_ASSERT(document); + + // Get the agent, then user sheets in the style set. + nsIPresShell* presShell = document->GetShell(); + if (presShell) { + nsStyleSet* styleSet = presShell->StyleSet(); + nsStyleSet::sheetType sheetType = nsStyleSet::eAgentSheet; + for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) { + sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i)); + } + sheetType = nsStyleSet::eUserSheet; + for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) { + sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i)); + } + } + + // Get the document sheets. + for (int32_t i = 0; i < document->GetNumberOfStyleSheets(); i++) { + sheets.AppendElement(document->GetStyleSheetAt(i)); + } + + nsISupports** ret = static_cast(NS_Alloc(sheets.Count() * + sizeof(nsISupports*))); + + for (int32_t i = 0; i < sheets.Count(); i++) { + NS_ADDREF(ret[i] = sheets[i]); + } + + *aLength = sheets.Count(); + *aSheets = ret; + + return NS_OK; +} + NS_IMETHODIMP inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode, bool *aReturn) diff --git a/layout/inspector/tests/Makefile.in b/layout/inspector/tests/Makefile.in index e28bc0a765f..27fa9d12388 100644 --- a/layout/inspector/tests/Makefile.in +++ b/layout/inspector/tests/Makefile.in @@ -24,6 +24,7 @@ MOCHITEST_FILES =\ bug856317.css \ test_isinheritableproperty.html \ test_bug877690.html \ + test_get_all_style_sheets.html \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/layout/inspector/tests/test_get_all_style_sheets.html b/layout/inspector/tests/test_get_all_style_sheets.html new file mode 100644 index 00000000000..a3a93572fcd --- /dev/null +++ b/layout/inspector/tests/test_get_all_style_sheets.html @@ -0,0 +1,40 @@ + + + + + + Test for Bug 734861 + + + + + +Mozilla Bug 734861 +

+ +
+
+ + From 61c1b351d35f0f140f6a8508dc9d31f6332d22c3 Mon Sep 17 00:00:00 2001 From: Yaron Tausky Date: Tue, 23 Jul 2013 09:20:38 -0400 Subject: [PATCH 16/69] Bug 771865 - Avoid creating NumberObject in (.1).toString. r=luke --- js/src/jsnum.cpp | 6 +++--- js/src/jsnum.h | 3 +++ js/src/vm/Interpreter.cpp | 29 ++++++++++++++++++++--------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index c350fb9f9f3..f06a214d13c 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -623,8 +623,8 @@ num_toString_impl(JSContext *cx, CallArgs args) return true; } -static JSBool -num_toString(JSContext *cx, unsigned argc, Value *vp) +JSBool +js_num_toString(JSContext *cx, unsigned argc, Value *vp) { CallArgs args = CallArgsFromVp(argc, vp); return CallNonGenericMethod(cx, args); @@ -911,7 +911,7 @@ static const JSFunctionSpec number_methods[] = { #if JS_HAS_TOSOURCE JS_FN(js_toSource_str, num_toSource, 0, 0), #endif - JS_FN(js_toString_str, num_toString, 1, 0), + JS_FN(js_toString_str, js_num_toString, 1, 0), #if ENABLE_INTL_API {js_toLocaleString_str, {NULL, NULL}, 0,0, "Number_toLocaleString"}, #else diff --git a/js/src/jsnum.h b/js/src/jsnum.h index d77380b0938..369344dc767 100644 --- a/js/src/jsnum.h +++ b/js/src/jsnum.h @@ -172,6 +172,9 @@ extern JSBool js_strtod(js::ExclusiveContext *cx, const jschar *s, const jschar *send, const jschar **ep, double *dp); +extern JSBool +js_num_toString(JSContext *cx, unsigned argc, js::Value *vp); + extern JSBool js_num_valueOf(JSContext *cx, unsigned argc, js::Value *vp); diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index 30657738410..5f9aa1c6c3f 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -264,20 +264,31 @@ GetPropertyOperation(JSContext *cx, StackFrame *fp, HandleScript script, jsbytec return true; } - JSObject *obj = ToObjectFromStack(cx, lval); - if (!obj) - return false; + RootedId id(cx, NameToId(script->getName(pc))); + RootedObject obj(cx); + + /* Optimize (.1).toString(). */ + if (lval.isNumber() && id == NameToId(cx->names().toString)) { + JSObject *proto = fp->global().getOrCreateNumberPrototype(cx); + if (!proto) + return false; + if (ClassMethodIsNative(cx, proto, &NumberObject::class_, id, js_num_toString)) + obj = proto; + } + + if (!obj) { + obj = ToObjectFromStack(cx, lval); + if (!obj) + return false; + } bool wasObject = lval.isObject(); - RootedId id(cx, NameToId(script->getName(pc))); - RootedObject nobj(cx, obj); - if (obj->getOps()->getProperty) { - if (!JSObject::getGeneric(cx, nobj, nobj, id, vp)) + if (!JSObject::getGeneric(cx, obj, obj, id, vp)) return false; } else { - if (!GetPropertyHelper(cx, nobj, id, 0, vp)) + if (!GetPropertyHelper(cx, obj, id, 0, vp)) return false; } @@ -286,7 +297,7 @@ GetPropertyOperation(JSContext *cx, StackFrame *fp, HandleScript script, jsbytec JS_UNLIKELY(vp.isPrimitive()) && wasObject) { - if (!OnUnknownMethod(cx, nobj, IdToValue(id), vp)) + if (!OnUnknownMethod(cx, obj, IdToValue(id), vp)) return false; } #endif From 0a2a59b5045ce82621168e3f70e599eaf4b3725a Mon Sep 17 00:00:00 2001 From: David Rajchenbach-Teller Date: Tue, 23 Jul 2013 09:20:54 -0400 Subject: [PATCH 17/69] Bug 889876 - Make OS.Constants.Path.profileDir earlier. r=froydnj --- .../components/osfile/osfile_async_front.jsm | 44 ++++++++++++++----- .../osfile/tests/xpcshell/test_profiledir.js | 6 +-- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/toolkit/components/osfile/osfile_async_front.jsm b/toolkit/components/osfile/osfile_async_front.jsm index d79c26c289b..5d2c0935b74 100644 --- a/toolkit/components/osfile/osfile_async_front.jsm +++ b/toolkit/components/osfile/osfile_async_front.jsm @@ -54,20 +54,42 @@ Components.utils.import("resource://gre/modules/osfile/_PromiseWorker.jsm", this Components.utils.import("resource://gre/modules/Services.jsm", this); +LOG("Checking profileDir", OS.Constants.Path); + // If profileDir is not available, osfile.jsm has been imported before the -// profile is setup. In this case, we need to observe "profile-do-change" -// and set OS.Constants.Path.profileDir as soon as it becomes available. -if (!("profileDir" in OS.Constants.Path) || !("localProfileDir" in OS.Constants.Path)) { - let observer = function observer() { - Services.obs.removeObserver(observer, "profile-do-change"); +// profile is setup. In this case, make this a lazy getter. +if (!("profileDir" in OS.Constants.Path)) { + Object.defineProperty(OS.Constants.Path, "profileDir", { + get: function() { + let path = undefined; + try { + path = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile).path; + delete OS.Constants.Path.profileDir; + OS.Constants.Path.profileDir = path; + } catch (ex) { + // Ignore errors: profileDir is still not available + } + return path; + } + }); +} - let profileDir = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile).path; - OS.Constants.Path.profileDir = profileDir; +LOG("Checking localProfileDir"); - let localProfileDir = Services.dirsvc.get("ProfLD", Components.interfaces.nsIFile).path; - OS.Constants.Path.localProfileDir = localProfileDir; - }; - Services.obs.addObserver(observer, "profile-do-change", false); +if (!("localProfileDir" in OS.Constants.Path)) { + Object.defineProperty(OS.Constants.Path, "localProfileDir", { + get: function() { + let path = undefined; + try { + path = Services.dirsvc.get("ProfLD", Components.interfaces.nsIFile).path; + delete OS.Constants.Path.localProfileDir; + OS.Constants.Path.localProfileDir = path; + } catch (ex) { + // Ignore errors: localProfileDir is still not available + } + return path; + } + }); } /** diff --git a/toolkit/components/osfile/tests/xpcshell/test_profiledir.js b/toolkit/components/osfile/tests/xpcshell/test_profiledir.js index 5b5e0fb0636..00c0d4a9329 100644 --- a/toolkit/components/osfile/tests/xpcshell/test_profiledir.js +++ b/toolkit/components/osfile/tests/xpcshell/test_profiledir.js @@ -13,19 +13,17 @@ function run_test() { add_test(function test_initialize_profileDir() { // Profile has not been set up yet, check that "profileDir" isn't either. - do_check_false("profileDir" in OS.Constants.Path); - do_check_false("localProfileDir" in OS.Constants.Path); + do_check_false(!!OS.Constants.Path.profileDir); + do_check_false(!!OS.Constants.Path.localProfileDir); // Set up profile. do_get_profile(); // Now that profile has been set up, check that "profileDir" is set. - do_check_true("profileDir" in OS.Constants.Path); do_check_true(!!OS.Constants.Path.profileDir); do_check_eq(OS.Constants.Path.profileDir, Services.dirsvc.get("ProfD", Components.interfaces.nsIFile).path); - do_check_true("localProfileDir" in OS.Constants.Path); do_check_true(!!OS.Constants.Path.localProfileDir); do_check_eq(OS.Constants.Path.localProfileDir, Services.dirsvc.get("ProfLD", Components.interfaces.nsIFile).path); From 5721f11b2b084c9d74fa4c54613471e7f37425e1 Mon Sep 17 00:00:00 2001 From: Mihnea Dobrescu-Balaur Date: Mon, 22 Jul 2013 09:15:08 -0700 Subject: [PATCH 18/69] Bug 895572 - Use the sandboxed tempDir so that modules/libmar tests can be run concurrently. r=bbondy --- modules/libmar/tests/unit/head_libmar.js.in | 1 + modules/libmar/tests/unit/test_create.js | 8 ++-- modules/libmar/tests/unit/test_extract.js | 9 ++-- modules/libmar/tests/unit/test_sign_verify.js | 45 ++++++++++++------- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/modules/libmar/tests/unit/head_libmar.js.in b/modules/libmar/tests/unit/head_libmar.js.in index 653775a174a..111304c06f6 100644 --- a/modules/libmar/tests/unit/head_libmar.js.in +++ b/modules/libmar/tests/unit/head_libmar.js.in @@ -11,6 +11,7 @@ const Ci = Components.interfaces; let refMARPrefix = ""; #endif +let tempDir = do_get_tempdir(); /** * Compares binary data of 2 arrays and throws if they aren't the same. diff --git a/modules/libmar/tests/unit/test_create.js b/modules/libmar/tests/unit/test_create.js index 18a5f7d355d..b6db280c9a1 100644 --- a/modules/libmar/tests/unit/test_create.js +++ b/modules/libmar/tests/unit/test_create.js @@ -16,7 +16,8 @@ function run_test() { } // Ensure the MAR we will create doesn't already exist. - let outMAR = do_get_file("out.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("out.mar"); if (checkNoMAR) { do_check_false(outMAR.exists()); } @@ -57,14 +58,15 @@ function run_test() { // at the location the new one will be created at. test_overwrite_already_exists: function() { let differentFile = do_get_file("data/1_byte_mar.mar"); - let outMARDir = do_get_file("."); + let outMARDir = tempDir.clone(); differentFile.copyTo(outMARDir, "out.mar"); return run_one_test(refMARPrefix + "binary_data_mar.mar", ["binary_data_file"], false); }, // Between each test make sure the out MAR does not exist. cleanup_per_test: function() { - let outMAR = do_get_file("out.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("out.mar"); if (outMAR.exists()) { outMAR.remove(false); } diff --git a/modules/libmar/tests/unit/test_extract.js b/modules/libmar/tests/unit/test_extract.js index 6c969d7fc96..aef9a121141 100644 --- a/modules/libmar/tests/unit/test_extract.js +++ b/modules/libmar/tests/unit/test_extract.js @@ -14,7 +14,8 @@ function run_test() { let mar = do_get_file("data/" + marFileName); // Get the path that we will extract to - let outDir = do_get_file("out", true); + let outDir = tempDir.clone(); + outDir.append("out"); do_check_false(outDir.exists()); outDir.create(Ci.nsIFile.DIRECTORY_TYPE, 0777); @@ -22,7 +23,8 @@ function run_test() { let outFiles = []; let refFiles = []; for (let i = 0; i < files.length; i++) { - let outFile = do_get_file("out/" + files[i], true); + let outFile = outDir.clone(); + outFile.append(files[i]); do_check_false(outFile.exists()); outFiles.push(outFile); @@ -78,7 +80,8 @@ function run_test() { // Between each test make sure the out directory and its subfiles do // not exist. cleanup_per_test: function() { - let outDir = do_get_file("out", true); + let outDir = tempDir.clone(); + outDir.append("out"); if (outDir.exists()) { outDir.remove(true); } diff --git a/modules/libmar/tests/unit/test_sign_verify.js b/modules/libmar/tests/unit/test_sign_verify.js index 162a529c0c6..0a97aeb1913 100644 --- a/modules/libmar/tests/unit/test_sign_verify.js +++ b/modules/libmar/tests/unit/test_sign_verify.js @@ -227,20 +227,24 @@ function run_test() { function cleanup() { - let outMAR = do_get_file("signed_out.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("signed_out.mar"); if (outMAR.exists()) { outMAR.remove(false); } - outMAR = do_get_file("multiple_signed_out.mar", true); + outMAR = tempDir.clone(); + outMAR.append("multiple_signed_out.mar"); if (outMAR.exists()) { outMAR.remove(false); } - outMAR = do_get_file("out.mar", true); + outMAR = tempDir.clone(); + outMAR.append("out.mar"); if (outMAR.exists()) { outMAR.remove(false); } - let outDir = do_get_file("out", true); + let outDir = tempDir.clone(); + outDir.append("out"); if (outDir.exists()) { outDir.remove(true); } @@ -253,7 +257,8 @@ function run_test() { // Test signing a MAR file with a single signature test_sign_single: function() { let inMAR = do_get_file("data/" + refMARPrefix + "binary_data_mar.mar"); - let outMAR = do_get_file("signed_out.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("signed_out.mar"); if (outMAR.exists()) { outMAR.remove(false); } @@ -267,7 +272,8 @@ function run_test() { // Test signing a MAR file with multiple signatures test_sign_multiple: function() { let inMAR = do_get_file("data/" + refMARPrefix + "binary_data_mar.mar"); - let outMAR = do_get_file("multiple_signed_out.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("multiple_signed_out.mar"); if (outMAR.exists()) { outMAR.remove(false); } @@ -358,8 +364,10 @@ function run_test() { let originalMAR = do_get_file("data/" + refMARPrefix + "binary_data_mar.mar"); - let signedMAR = do_get_file("signed_out.mar"); - let outMAR = do_get_file("out.mar", true); + let signedMAR = tempDir.clone(); + signedMAR.append("signed_out.mar"); + let outMAR = tempDir.clone(); + outMAR.append("out.mar", true); stripMARSignature(signedMAR, outMAR, wantSuccess); // Verify that the stripped MAR matches the original data MAR exactly @@ -372,8 +380,10 @@ function run_test() { let originalMAR = do_get_file("data/" + refMARPrefix + "binary_data_mar.mar"); - let signedMAR = do_get_file("multiple_signed_out.mar"); - let outMAR = do_get_file("out.mar", true); + let signedMAR = tempDir.clone(); + signedMAR.append("multiple_signed_out.mar"); + let outMAR = tempDir.clone(); + outMAR.append("out.mar"); stripMARSignature(signedMAR, outMAR, wantSuccess); // Verify that the stripped MAR matches the original data MAR exactly @@ -424,7 +434,8 @@ function run_test() { // Test signing a file that doesn't exist fails test_bad_path_sign_fails: function() { let inMAR = do_get_file("data/does_not_exist_.mar", true); - let outMAR = do_get_file("signed_out.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("signed_out.mar"); do_check_false(inMAR.exists()); signMAR(inMAR, outMAR, ["mycert"], wantFailure, true); do_check_false(outMAR.exists()); @@ -448,7 +459,8 @@ function run_test() { // Get the signature file for this MAR signed with the key from mycert2 let sigFile = do_get_file("data/signed_pib_mar.signature.mycert2"); do_check_true(sigFile.exists()); - let outMAR = do_get_file("data/sigchanged_signed_pib_mar.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("sigchanged_signed_pib_mar.mar"); if (outMAR.exists()) { outMAR.remove(false); } @@ -483,7 +495,8 @@ function run_test() { // Get the signature file for this MAR signed with the key from mycert2 let sigFile = do_get_file("data/multiple_signed_pib_mar.sig.0"); do_check_true(sigFile.exists()); - let outMAR = do_get_file("data/sigchanged_signed_pib_mar.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("sigchanged_signed_pib_mar.mar"); if (outMAR.exists()) { outMAR.remove(false); } @@ -509,7 +522,8 @@ function run_test() { // Get the signature file for this MAR signed with the key from mycert let sigFile = do_get_file("data/multiple_signed_pib_mar.sig.0"); do_check_true(sigFile.exists()); - let outMAR = do_get_file("data/sigchanged_signed_pib_mar.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("sigchanged_signed_pib_mar.mar"); if (outMAR.exists()) { outMAR.remove(false); } @@ -536,7 +550,8 @@ function run_test() { test_bad_path_strip_fails: function() { let noMAR = do_get_file("data/does_not_exist_mar", true); do_check_false(noMAR.exists()); - let outMAR = do_get_file("out.mar", true); + let outMAR = tempDir.clone(); + outMAR.append("out.mar"); stripMARSignature(noMAR, outMAR, wantFailure); }, // Test extracting from a bad path fails From 2db3b1337afc0179e8b71f3ad02b93e1ef69e5a3 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 23 Jul 2013 09:22:58 -0400 Subject: [PATCH 19/69] Bug 483446 - CSS3 'background-attachment: local' support. r=roc --- layout/base/nsCSSRendering.cpp | 104 +++++++++++++++++- layout/base/nsStyleConsts.h | 1 + layout/generic/nsGfxScrollFrame.h | 6 + layout/generic/nsIScrollableFrame.h | 15 +++ layout/inspector/tests/test_bug877690.html | 2 +- ...attachment-local-clipping-color-1-ref.html | 18 +++ .../attachment-local-clipping-color-1.html | 30 +++++ .../attachment-local-clipping-color-2.html | 30 +++++ ...attachment-local-clipping-color-3-ref.html | 18 +++ .../attachment-local-clipping-color-3.html | 30 +++++ ...attachment-local-clipping-color-4-ref.html | 19 ++++ .../attachment-local-clipping-color-4.html | 31 ++++++ .../attachment-local-clipping-color-5.html | 31 ++++++ ...attachment-local-clipping-color-6-ref.html | 27 +++++ .../attachment-local-clipping-color-6.html | 31 ++++++ ...attachment-local-clipping-image-1-ref.html | 18 +++ .../attachment-local-clipping-image-1.html | 32 ++++++ .../attachment-local-clipping-image-2.html | 30 +++++ ...attachment-local-clipping-image-3-ref.html | 18 +++ .../attachment-local-clipping-image-3.html | 30 +++++ ...attachment-local-clipping-image-4-ref.html | 19 ++++ .../attachment-local-clipping-image-4.html | 33 ++++++ .../attachment-local-clipping-image-5.html | 31 ++++++ ...attachment-local-clipping-image-6-ref.html | 27 +++++ .../attachment-local-clipping-image-6.html | 31 ++++++ .../attachment-local-positioning-1-ref.html | 16 +++ .../attachment-local-positioning-1.html | 19 ++++ .../attachment-local-positioning-2-ref.html | 25 +++++ .../attachment-local-positioning-2.html | 35 ++++++ .../attachment-local-positioning-3-ref.html | 29 +++++ .../attachment-local-positioning-3.html | 36 ++++++ .../attachment-local-positioning-4-ref.html | 29 +++++ .../attachment-local-positioning-4.html | 35 ++++++ .../attachment-local-positioning-5-ref.html | 18 +++ .../attachment-local-positioning-5.html | 24 ++++ .../attachment-scroll-positioning-1-ref.html | 17 +++ .../attachment-scroll-positioning-1.html | 23 ++++ layout/reftests/backgrounds/reftest.list | 21 ++++ layout/style/nsCSSKeywordList.h | 1 + layout/style/nsCSSProps.cpp | 1 + layout/style/test/property_database.js | 2 +- 41 files changed, 986 insertions(+), 7 deletions(-) create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-1-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-1.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-2.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-3-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-3.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-4-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-4.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-5.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-6-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-color-6.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-1-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-1.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-2.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-3-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-3.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-4-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-4.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-5.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-6-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-clipping-image-6.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-1-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-1.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-2-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-2.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-3-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-3.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-4-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-4.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-5-ref.html create mode 100644 layout/reftests/backgrounds/attachment-local-positioning-5.html create mode 100644 layout/reftests/backgrounds/attachment-scroll-positioning-1-ref.html create mode 100644 layout/reftests/backgrounds/attachment-scroll-positioning-1.html diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 3d03832d615..291f68489d2 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -1677,12 +1677,14 @@ SetupDirtyRects(const nsRect& aBGClipArea, const nsRect& aCallerDirtyRect, } struct BackgroundClipState { - nsRect mBGClipArea; + nsRect mBGClipArea; // Affected by mClippedRadii + nsRect mAdditionalBGClipArea; // Not affected by mClippedRadii nsRect mDirtyRect; gfxRect mDirtyRectGfx; gfxCornerSizes mClippedRadii; bool mRadiiAreOuter; + bool mHasAdditionalBGClipArea; // Whether we are being asked to draw with a caller provided background // clipping area. If this is true we also disable rounded corners. @@ -1691,15 +1693,49 @@ struct BackgroundClipState { static void GetBackgroundClip(gfxContext *aCtx, uint8_t aBackgroundClip, + uint8_t aBackgroundAttachment, nsIFrame* aForFrame, const nsRect& aBorderArea, const nsRect& aCallerDirtyRect, bool aHaveRoundedCorners, const gfxCornerSizes& aBGRadii, nscoord aAppUnitsPerPixel, /* out */ BackgroundClipState* aClipState) { aClipState->mBGClipArea = aBorderArea; + aClipState->mHasAdditionalBGClipArea = false; aClipState->mCustomClip = false; aClipState->mRadiiAreOuter = true; aClipState->mClippedRadii = aBGRadii; + if (aForFrame->GetType() == nsGkAtoms::scrollFrame && + NS_STYLE_BG_ATTACHMENT_LOCAL == aBackgroundAttachment) { + // As of this writing, this is still in discussion in the CSS Working Group + // http://lists.w3.org/Archives/Public/www-style/2013Jul/0250.html + + // The rectangle for 'background-clip' scrolls with the content, + // but the background is also clipped at a non-scrolling 'padding-box' + // like the content. (See below.) + // Therefore, only 'content-box' makes a difference here. + if (aBackgroundClip == NS_STYLE_BG_CLIP_CONTENT) { + nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame); + // Clip at a rectangle attached to the scrolled content. + aClipState->mHasAdditionalBGClipArea = true; + aClipState->mAdditionalBGClipArea = nsRect( + aClipState->mBGClipArea.TopLeft() + + scrollableFrame->GetScrolledFrame()->GetPosition() + // For the dir=rtl case: + + scrollableFrame->GetScrollRange().TopLeft(), + scrollableFrame->GetScrolledRect().Size()); + nsMargin padding = aForFrame->GetUsedPadding(); + // padding-bottom is ignored on scrollable frames: + // https://bugzilla.mozilla.org/show_bug.cgi?id=748518 + padding.bottom = 0; + aForFrame->ApplySkipSides(padding); + aClipState->mAdditionalBGClipArea.Deflate(padding); + } + + // Also clip at a non-scrolling, rounded-corner 'padding-box', + // same as the scrolled content because of the 'overflow' property. + aBackgroundClip = NS_STYLE_BG_CLIP_PADDING; + } + if (aBackgroundClip != NS_STYLE_BG_CLIP_BORDER) { nsMargin border = aForFrame->GetUsedBorder(); if (aBackgroundClip == NS_STYLE_BG_CLIP_MOZ_ALMOST_PADDING) { @@ -1731,6 +1767,13 @@ GetBackgroundClip(gfxContext *aCtx, uint8_t aBackgroundClip, } } + if (!aHaveRoundedCorners && aClipState->mHasAdditionalBGClipArea) { + // Do the intersection here to account for the fast path(?) below. + aClipState->mBGClipArea = + aClipState->mBGClipArea.Intersect(aClipState->mAdditionalBGClipArea); + aClipState->mHasAdditionalBGClipArea = false; + } + SetupDirtyRects(aClipState->mBGClipArea, aCallerDirtyRect, aAppUnitsPerPixel, &aClipState->mDirtyRect, &aClipState->mDirtyRectGfx); } @@ -1759,6 +1802,20 @@ SetupBackgroundClip(BackgroundClipState& aClipState, gfxContext *aCtx, // as above with bgArea, arguably a bug, but table painting seems // to depend on it. + if (aHaveRoundedCorners || aClipState.mHasAdditionalBGClipArea) { + aAutoSR->Reset(aCtx); + } + + if (aClipState.mHasAdditionalBGClipArea) { + gfxRect bgAreaGfx = nsLayoutUtils::RectToGfxRect( + aClipState.mAdditionalBGClipArea, aAppUnitsPerPixel); + bgAreaGfx.Round(); + bgAreaGfx.Condition(); + aCtx->NewPath(); + aCtx->Rectangle(bgAreaGfx, true); + aCtx->Clip(); + } + if (aHaveRoundedCorners) { gfxRect bgAreaGfx = nsLayoutUtils::RectToGfxRect(aClipState.mBGClipArea, aAppUnitsPerPixel); @@ -1774,7 +1831,6 @@ SetupBackgroundClip(BackgroundClipState& aClipState, gfxContext *aCtx, return; } - aAutoSR->Reset(aCtx); aCtx->NewPath(); aCtx->RoundedRectangle(bgAreaGfx, aClipState.mClippedRadii, aClipState.mRadiiAreOuter); aCtx->Clip(); @@ -1821,9 +1877,20 @@ DrawBackgroundColor(BackgroundClipState& aClipState, gfxContext *aCtx, aCtx->Rectangle(dirty, true); aCtx->Clip(); + if (aClipState.mHasAdditionalBGClipArea) { + gfxRect bgAdditionalAreaGfx = nsLayoutUtils::RectToGfxRect( + aClipState.mAdditionalBGClipArea, aAppUnitsPerPixel); + bgAdditionalAreaGfx.Round(); + bgAdditionalAreaGfx.Condition(); + aCtx->NewPath(); + aCtx->Rectangle(bgAdditionalAreaGfx, true); + aCtx->Clip(); + } + aCtx->NewPath(); aCtx->RoundedRectangle(bgAreaGfx, aClipState.mClippedRadii, aClipState.mRadiiAreOuter); + aCtx->Fill(); aCtx->Restore(); } @@ -2594,7 +2661,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext, NS_STYLE_BG_CLIP_MOZ_ALMOST_PADDING : NS_STYLE_BG_CLIP_PADDING; } - GetBackgroundClip(ctx, currentBackgroundClip, aForFrame, aBorderArea, + GetBackgroundClip(ctx, currentBackgroundClip, bg->BottomLayer().mAttachment, + aForFrame, aBorderArea, aDirtyRect, haveRoundedCorners, bgRadii, appUnitsPerPixel, &clipState); } @@ -2662,7 +2730,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext, // already called GetBackgroundClip above and it stored its results // in clipState. if (clipSet) { - GetBackgroundClip(ctx, currentBackgroundClip, aForFrame, + GetBackgroundClip(ctx, currentBackgroundClip, layer.mAttachment, aForFrame, aBorderArea, aDirtyRect, haveRoundedCorners, bgRadii, appUnitsPerPixel, &clipState); } @@ -2769,7 +2837,8 @@ nsCSSRendering::PaintBackgroundColorWithSC(nsPresContext* aPresContext, } BackgroundClipState clipState; - GetBackgroundClip(ctx, currentBackgroundClip, aForFrame, aBorderArea, + GetBackgroundClip(ctx, currentBackgroundClip, bg->BottomLayer().mAttachment, + aForFrame, aBorderArea, aDirtyRect, haveRoundedCorners, bgRadii, appUnitsPerPixel, &clipState); @@ -2833,6 +2902,31 @@ nsCSSRendering::ComputeBackgroundPositioningArea(nsPresContext* aPresContext, if (geometryFrame) { bgPositioningArea = geometryFrame->GetRect(); } + } else if (frameType == nsGkAtoms::scrollFrame && + NS_STYLE_BG_ATTACHMENT_LOCAL == aLayer.mAttachment) { + nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame); + bgPositioningArea = nsRect( + scrollableFrame->GetScrolledFrame()->GetPosition() + // For the dir=rtl case: + + scrollableFrame->GetScrollRange().TopLeft(), + scrollableFrame->GetScrolledRect().Size()); + // The ScrolledRect’s size does not include the borders or scrollbars, + // reverse the handling of background-origin + // compared to the common case below. + if (aLayer.mOrigin == NS_STYLE_BG_ORIGIN_BORDER) { + nsMargin border = geometryFrame->GetUsedBorder(); + geometryFrame->ApplySkipSides(border); + bgPositioningArea.Inflate(border); + bgPositioningArea.Inflate(scrollableFrame->GetActualScrollbarSizes()); + } else if (aLayer.mOrigin != NS_STYLE_BG_ORIGIN_PADDING) { + nsMargin padding = geometryFrame->GetUsedPadding(); + geometryFrame->ApplySkipSides(padding); + bgPositioningArea.Deflate(padding); + NS_ASSERTION(aLayer.mOrigin == NS_STYLE_BG_ORIGIN_CONTENT, + "unknown background-origin value"); + } + *aAttachedToFrame = aForFrame; + return bgPositioningArea; } else { bgPositioningArea = nsRect(nsPoint(0,0), aBorderArea.Size()); } diff --git a/layout/base/nsStyleConsts.h b/layout/base/nsStyleConsts.h index b7b8588f69f..aa6f2eef92d 100644 --- a/layout/base/nsStyleConsts.h +++ b/layout/base/nsStyleConsts.h @@ -233,6 +233,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) { // See nsStyleBackground #define NS_STYLE_BG_ATTACHMENT_SCROLL 0 #define NS_STYLE_BG_ATTACHMENT_FIXED 1 +#define NS_STYLE_BG_ATTACHMENT_LOCAL 2 // See nsStyleBackground // Code depends on these constants having the same values as BG_ORIGIN_* diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 78eacedc525..b9ed7ec283d 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -498,6 +498,9 @@ public: nsBoxLayoutState bls(aPresContext, aRC, 0); return mInner.GetNondisappearingScrollbarWidth(&bls); } + virtual nsRect GetScrolledRect() const MOZ_OVERRIDE { + return mInner.GetScrolledRect(); + } virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE { return mInner.GetScrollPortRect(); } @@ -764,6 +767,9 @@ public: nsBoxLayoutState bls(aPresContext, aRC, 0); return mInner.GetNondisappearingScrollbarWidth(&bls); } + virtual nsRect GetScrolledRect() const MOZ_OVERRIDE { + return mInner.GetScrolledRect(); + } virtual nsRect GetScrollPortRect() const MOZ_OVERRIDE { return mInner.GetScrollPortRect(); } diff --git a/layout/generic/nsIScrollableFrame.h b/layout/generic/nsIScrollableFrame.h index 3c9e943e6c9..69c1c9860c2 100644 --- a/layout/generic/nsIScrollableFrame.h +++ b/layout/generic/nsIScrollableFrame.h @@ -87,6 +87,21 @@ public: */ virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext, nsRenderingContext* aRC) = 0; + /** + * GetScrolledRect is designed to encapsulate deciding which + * directions of overflow should be reachable by scrolling and which + * should not. Callers should NOT depend on it having any particular + * behavior (although nsXULScrollFrame currently does). + * + * This should only be called when the scrolled frame has been + * reflowed with the scroll port size given in mScrollPort. + * + * Currently it allows scrolling down and to the right for + * nsHTMLScrollFrames with LTR directionality and for all + * nsXULScrollFrames, and allows scrolling down and to the left for + * nsHTMLScrollFrames with RTL directionality. + */ + virtual nsRect GetScrolledRect() const = 0; /** * Get the area of the scrollport relative to the origin of this frame's * border-box. diff --git a/layout/inspector/tests/test_bug877690.html b/layout/inspector/tests/test_bug877690.html index 1be4b1a4e22..8e98c766346 100644 --- a/layout/inspector/tests/test_bug877690.html +++ b/layout/inspector/tests/test_bug877690.html @@ -89,7 +89,7 @@ function do_test() { "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen", "no-repeat", "repeat", - "repeat-x", "repeat-y", "fixed", "scroll", "center", "top", "bottom", "left", "right", + "repeat-x", "repeat-y", "fixed", "scroll", "local", "center", "top", "bottom", "left", "right", "border-box", "padding-box", "content-box", "border-box", "padding-box", "content-box", "contain", "cover", "rgb", "hsl", "-moz-rgba", "-moz-hsla", "rgba", "hsla", "none", "-moz-element", "-moz-image-rect" ]; ok(testValues(values, expected), "Shorthand property values."); diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-1-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-color-1-ref.html new file mode 100644 index 00000000000..d2fa65a436b --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-1-ref.html @@ -0,0 +1,18 @@ + +CSS Reftest Reference: background-attachment: local + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-1.html b/layout/reftests/backgrounds/attachment-local-clipping-color-1.html new file mode 100644 index 00000000000..803c409e13d --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-1.html @@ -0,0 +1,30 @@ + +CSS Test: background-{attachment: local; clip: border-box; color} + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-2.html b/layout/reftests/backgrounds/attachment-local-clipping-color-2.html new file mode 100644 index 00000000000..3851c51ec72 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-2.html @@ -0,0 +1,30 @@ + +CSS Test: background-{attachment: local; clip: padding-box; color} + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-3-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-color-3-ref.html new file mode 100644 index 00000000000..193feb2ec2c --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-3-ref.html @@ -0,0 +1,18 @@ + +CSS Reftest Reference: background-attachment: local + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-3.html b/layout/reftests/backgrounds/attachment-local-clipping-color-3.html new file mode 100644 index 00000000000..9f64e032249 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-3.html @@ -0,0 +1,30 @@ + +CSS Test: background-{attachment: local; clip: content-box; color} + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-4-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-color-4-ref.html new file mode 100644 index 00000000000..bc45a4d5aa4 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-4-ref.html @@ -0,0 +1,19 @@ + +CSS Reftest Reference: background-attachment: local + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-4.html b/layout/reftests/backgrounds/attachment-local-clipping-color-4.html new file mode 100644 index 00000000000..1ca5701a861 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-4.html @@ -0,0 +1,31 @@ + +CSS Test: background-{attachment: local; clip: border-box; color}; border-radius + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-5.html b/layout/reftests/backgrounds/attachment-local-clipping-color-5.html new file mode 100644 index 00000000000..eba14f2638f --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-5.html @@ -0,0 +1,31 @@ + +CSS Test: background-{attachment: local; clip: padding-box; color}; border-radius + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-6-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-color-6-ref.html new file mode 100644 index 00000000000..3337028141b --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-6-ref.html @@ -0,0 +1,27 @@ + +CSS Reftest Reference: background-attachment: local + + +
+
+

+
+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-color-6.html b/layout/reftests/backgrounds/attachment-local-clipping-color-6.html new file mode 100644 index 00000000000..71c4c37b334 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-color-6.html @@ -0,0 +1,31 @@ + +CSS Test: background-{attachment: local; clip: content-box; color}; border-radius + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-1-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-image-1-ref.html new file mode 100644 index 00000000000..d4305ed8f3e --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-1-ref.html @@ -0,0 +1,18 @@ + +CSS Reftest Reference: background-attachment: local + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-1.html b/layout/reftests/backgrounds/attachment-local-clipping-image-1.html new file mode 100644 index 00000000000..569caee0af5 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-1.html @@ -0,0 +1,32 @@ + +CSS Test: background-{attachment: local; clip: border-box; image} + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-2.html b/layout/reftests/backgrounds/attachment-local-clipping-image-2.html new file mode 100644 index 00000000000..48adb1b4597 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-2.html @@ -0,0 +1,30 @@ + +CSS Test: background-{attachment: local; clip: padding-box; image} + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-3-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-image-3-ref.html new file mode 100644 index 00000000000..84090bb4b10 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-3-ref.html @@ -0,0 +1,18 @@ + +CSS Reftest Reference: background-attachment: local + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-3.html b/layout/reftests/backgrounds/attachment-local-clipping-image-3.html new file mode 100644 index 00000000000..3f75109765a --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-3.html @@ -0,0 +1,30 @@ + +CSS Test: background-{attachment: local; clip: content-box; image} + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-4-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-image-4-ref.html new file mode 100644 index 00000000000..7a6eddd9d6c --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-4-ref.html @@ -0,0 +1,19 @@ + +CSS Reftest Reference: background-attachment: local + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-4.html b/layout/reftests/backgrounds/attachment-local-clipping-image-4.html new file mode 100644 index 00000000000..e3a1f9a1f0a --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-4.html @@ -0,0 +1,33 @@ + +CSS Test: background-{attachment: local; clip: border-box; image}; border-radius + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-5.html b/layout/reftests/backgrounds/attachment-local-clipping-image-5.html new file mode 100644 index 00000000000..8c85b93a743 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-5.html @@ -0,0 +1,31 @@ + +CSS Test: background-{attachment: local; clip: padding-box; image}; border-radius + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-6-ref.html b/layout/reftests/backgrounds/attachment-local-clipping-image-6-ref.html new file mode 100644 index 00000000000..5592bac5b9b --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-6-ref.html @@ -0,0 +1,27 @@ + +CSS Reftest Reference: background-attachment: local + + +
+
+

+
+
diff --git a/layout/reftests/backgrounds/attachment-local-clipping-image-6.html b/layout/reftests/backgrounds/attachment-local-clipping-image-6.html new file mode 100644 index 00000000000..87ef34dd741 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-clipping-image-6.html @@ -0,0 +1,31 @@ + +CSS Test: background-{attachment: local; clip: content-box; image}; border-radius + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-positioning-1-ref.html b/layout/reftests/backgrounds/attachment-local-positioning-1-ref.html new file mode 100644 index 00000000000..b5a672505c0 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-1-ref.html @@ -0,0 +1,16 @@ + +background-attachment: scroll + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-positioning-1.html b/layout/reftests/backgrounds/attachment-local-positioning-1.html new file mode 100644 index 00000000000..c414e2096bc --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-1.html @@ -0,0 +1,19 @@ + +background-attachment: scroll + +
+

+
+ diff --git a/layout/reftests/backgrounds/attachment-local-positioning-2-ref.html b/layout/reftests/backgrounds/attachment-local-positioning-2-ref.html new file mode 100644 index 00000000000..7371cbc2f73 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-2-ref.html @@ -0,0 +1,25 @@ + +CSS Reftest Reference: background-attachment: local + + +
+
+

+
+
diff --git a/layout/reftests/backgrounds/attachment-local-positioning-2.html b/layout/reftests/backgrounds/attachment-local-positioning-2.html new file mode 100644 index 00000000000..815813f975d --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-2.html @@ -0,0 +1,35 @@ + +CSS Test: background-attachment: local; positioning area + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-positioning-3-ref.html b/layout/reftests/backgrounds/attachment-local-positioning-3-ref.html new file mode 100644 index 00000000000..dc93d721989 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-3-ref.html @@ -0,0 +1,29 @@ + +CSS Reftest Reference: background-attachment: local + + +
+
+

+
+
diff --git a/layout/reftests/backgrounds/attachment-local-positioning-3.html b/layout/reftests/backgrounds/attachment-local-positioning-3.html new file mode 100644 index 00000000000..4cbf03d83e8 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-3.html @@ -0,0 +1,36 @@ + +CSS Test: background-attachment: local; positioning area with dir=rtl + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-positioning-4-ref.html b/layout/reftests/backgrounds/attachment-local-positioning-4-ref.html new file mode 100644 index 00000000000..f392589bd87 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-4-ref.html @@ -0,0 +1,29 @@ + +CSS Reftest Reference: background-attachment: local + + +
+
+

+
+
diff --git a/layout/reftests/backgrounds/attachment-local-positioning-4.html b/layout/reftests/backgrounds/attachment-local-positioning-4.html new file mode 100644 index 00000000000..6bc4457bb19 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-4.html @@ -0,0 +1,35 @@ + +CSS Test: background-attachment: local; positioning area with dir=rtl, top left + + + + + +
+
+

+
+
+ diff --git a/layout/reftests/backgrounds/attachment-local-positioning-5-ref.html b/layout/reftests/backgrounds/attachment-local-positioning-5-ref.html new file mode 100644 index 00000000000..76e8dc47a76 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-5-ref.html @@ -0,0 +1,18 @@ + +CSS Reftest Reference: background-attachment: local + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-local-positioning-5.html b/layout/reftests/backgrounds/attachment-local-positioning-5.html new file mode 100644 index 00000000000..67ab2d8fd7d --- /dev/null +++ b/layout/reftests/backgrounds/attachment-local-positioning-5.html @@ -0,0 +1,24 @@ + +CSS Test: background-{attachment: local; origin: content-box}; positioning area + + + + + +
+

+
+ diff --git a/layout/reftests/backgrounds/attachment-scroll-positioning-1-ref.html b/layout/reftests/backgrounds/attachment-scroll-positioning-1-ref.html new file mode 100644 index 00000000000..efec7e2d556 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-scroll-positioning-1-ref.html @@ -0,0 +1,17 @@ + +CSS Reftest Reference: background-attachment: scroll + + +
+

+
diff --git a/layout/reftests/backgrounds/attachment-scroll-positioning-1.html b/layout/reftests/backgrounds/attachment-scroll-positioning-1.html new file mode 100644 index 00000000000..ca68ff5f4c2 --- /dev/null +++ b/layout/reftests/backgrounds/attachment-scroll-positioning-1.html @@ -0,0 +1,23 @@ + +CSS Test: background-attachment: scroll; positioning area + + + + + +
+

+
+ diff --git a/layout/reftests/backgrounds/reftest.list b/layout/reftests/backgrounds/reftest.list index cab0068ca43..622652401f3 100644 --- a/layout/reftests/backgrounds/reftest.list +++ b/layout/reftests/backgrounds/reftest.list @@ -141,3 +141,24 @@ random-if(B2G) == really-big-background.html really-big-background-ref.html == multi-background-clip-content-border.html multi-background-clip-content-border-ref.html HTTP == background-referrer.html background-referrer-ref.html + +== attachment-scroll-positioning-1.html attachment-scroll-positioning-1-ref.html +== attachment-local-positioning-1.html attachment-local-positioning-1-ref.html +== attachment-local-positioning-2.html attachment-local-positioning-2-ref.html +== attachment-local-positioning-3.html attachment-local-positioning-3-ref.html +== attachment-local-positioning-4.html attachment-local-positioning-4-ref.html +== attachment-local-positioning-5.html attachment-local-positioning-5-ref.html + +== attachment-local-clipping-color-1.html attachment-local-clipping-color-1-ref.html +== attachment-local-clipping-color-2.html attachment-local-clipping-color-1-ref.html # Same ref as the previous test. +== attachment-local-clipping-color-3.html attachment-local-clipping-color-3-ref.html +== attachment-local-clipping-color-4.html attachment-local-clipping-color-4-ref.html +== attachment-local-clipping-color-5.html attachment-local-clipping-color-4-ref.html # Same ref as the previous test. +fuzzy(50,500) == attachment-local-clipping-color-6.html attachment-local-clipping-color-6-ref.html + +== attachment-local-clipping-image-1.html attachment-local-clipping-image-1-ref.html +== attachment-local-clipping-image-2.html attachment-local-clipping-image-1-ref.html # Same ref as the previous test. +== attachment-local-clipping-image-3.html attachment-local-clipping-image-3-ref.html +== attachment-local-clipping-image-4.html attachment-local-clipping-image-4-ref.html +== attachment-local-clipping-image-5.html attachment-local-clipping-image-4-ref.html # Same ref as the previous test. +fuzzy(80,500) == attachment-local-clipping-image-6.html attachment-local-clipping-image-6-ref.html diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 9e07d01d9d1..3dab8884994 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -325,6 +325,7 @@ CSS_KEY(line-through, line_through) CSS_KEY(linear, linear) CSS_KEY(lining-nums, lining_nums) CSS_KEY(list-item, list_item) +CSS_KEY(local, local) CSS_KEY(logical, logical) CSS_KEY(lower-alpha, lower_alpha) CSS_KEY(lower-greek, lower_greek) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index c86109ac9ca..4af5c25b135 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -636,6 +636,7 @@ const int32_t nsCSSProps::kTransformStyleKTable[] = { const int32_t nsCSSProps::kBackgroundAttachmentKTable[] = { eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED, eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL, + eCSSKeyword_local, NS_STYLE_BG_ATTACHMENT_LOCAL, eCSSKeyword_UNKNOWN,-1 }; diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 02fd0984ce8..56feb7058d4 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -1363,7 +1363,7 @@ var gCSSProperties = { inherited: false, type: CSS_TYPE_LONGHAND, initial_values: [ "scroll" ], - other_values: [ "fixed", "scroll,scroll", "fixed, scroll", "scroll, fixed, scroll", "fixed, fixed" ], + other_values: [ "fixed", "local", "scroll,scroll", "fixed, scroll", "scroll, fixed, local, scroll", "fixed, fixed" ], invalid_values: [] }, "background-clip": { From b82b1b1a763f5901b3dba2f578f856e9481e12c9 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Fri, 19 Jul 2013 18:40:00 -0400 Subject: [PATCH 20/69] bug 887753 - server not found after reconnecting to etherpad r=sworkman --- netwerk/dns/nsHostResolver.cpp | 57 ++++++++++++++++++++++------------ netwerk/dns/nsHostResolver.h | 3 +- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index b8504d3a5c0..9671c38acba 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -131,6 +131,26 @@ private: //---------------------------------------------------------------------------- +static inline bool +IsHighPriority(uint16_t flags) +{ + return !(flags & (nsHostResolver::RES_PRIORITY_LOW | nsHostResolver::RES_PRIORITY_MEDIUM)); +} + +static inline bool +IsMediumPriority(uint16_t flags) +{ + return flags & nsHostResolver::RES_PRIORITY_MEDIUM; +} + +static inline bool +IsLowPriority(uint16_t flags) +{ + return flags & nsHostResolver::RES_PRIORITY_LOW; +} + +//---------------------------------------------------------------------------- + // this macro filters out any flags that are not used when constructing the // host key. the significant flags are those that would affect the resulting // host record (i.e., the flags that are passed down to PR_GetAddrInfoByName). @@ -145,6 +165,7 @@ nsHostRecord::nsHostRecord(const nsHostKey *key) , resolving(false) , onQueue(false) , usingAnyThread(false) + , mDoomed(false) { host = ((char *) this) + sizeof(nsHostRecord); memcpy((char *) host, key->host, strlen(key->host) + 1); @@ -213,6 +234,9 @@ nsHostRecord::ReportUnusable(NetAddr *aAddress) // must call locked LOG(("Adding address to blacklist for host [%s], host record [%p].\n", host, this)); + if (negative) + mDoomed = true; + char buf[kIPv6CStrBufSize]; if (NetAddrToString(aAddress, buf, sizeof(buf))) { LOG(("Successfully adding address [%s] to blacklist for host [%s].\n", buf, host)); @@ -228,6 +252,19 @@ nsHostRecord::ResetBlacklist() mBlacklistedItems.Clear(); } +bool +nsHostRecord::HasUsableResult(uint16_t queryFlags) const +{ + if (mDoomed) + return false; + + // don't use cached negative results for high priority queries. + if (negative && IsHighPriority(queryFlags)) + return false; + + return addr_info || addr || negative; +} + //---------------------------------------------------------------------------- struct nsHostDBEnt : PLDHashEntryHdr @@ -463,24 +500,6 @@ nsHostResolver::Shutdown() #endif } -static inline bool -IsHighPriority(uint16_t flags) -{ - return !(flags & (nsHostResolver::RES_PRIORITY_LOW | nsHostResolver::RES_PRIORITY_MEDIUM)); -} - -static inline bool -IsMediumPriority(uint16_t flags) -{ - return flags & nsHostResolver::RES_PRIORITY_MEDIUM; -} - -static inline bool -IsLowPriority(uint16_t flags) -{ - return flags & nsHostResolver::RES_PRIORITY_LOW; -} - void nsHostResolver::MoveQueue(nsHostRecord *aRec, PRCList &aDestQ) { @@ -537,7 +556,7 @@ nsHostResolver::ResolveHost(const char *host, rv = NS_ERROR_OUT_OF_MEMORY; // do we have a cached result that we can reuse? else if (!(flags & RES_BYPASS_CACHE) && - he->rec->HasResult() && + he->rec->HasUsableResult(flags) && TimeStamp::NowLoRes() <= (he->rec->expiration + TimeDuration::FromSeconds(mGracePeriod * 60))) { LOG(("Using cached record for host [%s].\n", host)); // put reference to host record on stack... diff --git a/netwerk/dns/nsHostResolver.h b/netwerk/dns/nsHostResolver.h index 8cce0c7a675..ce0b488705e 100644 --- a/netwerk/dns/nsHostResolver.h +++ b/netwerk/dns/nsHostResolver.h @@ -80,7 +80,7 @@ public: mozilla::TimeStamp expiration; - bool HasResult() const { return addr_info || addr || negative; } + bool HasUsableResult(uint16_t queryFlags) const; // hold addr_info_lock when calling the blacklist functions bool Blacklisted(mozilla::net::NetAddr *query); @@ -98,6 +98,7 @@ private: bool onQueue; /* true if pending and on the queue (not yet given to getaddrinfo())*/ bool usingAnyThread; /* true if off queue and contributing to mActiveAnyThreadCount */ + bool mDoomed; /* explicitly expired */ // a list of addresses associated with this record that have been reported // as unusable. the list is kept as a set of strings to make it independent From 5de0e3c9a1b75eac63d9c611e01e519a6e9b87f6 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Sat, 13 Jul 2013 20:18:03 -0500 Subject: [PATCH 21/69] Bug 884061 - Part 1: Use mozilla::Atomic in NS_DECL_INLINE_THREADSAFE_REFCOUNTING, r=jlebar --HG-- extra : rebase_source : a3a987a2a4a52603e0461f40396cca06b6cbe989 --- content/media/MediaResource.h | 5 ++++- xpcom/glue/nsISupportsImpl.h | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/content/media/MediaResource.h b/content/media/MediaResource.h index 7de2a8580a3..85c688ddd5d 100644 --- a/content/media/MediaResource.h +++ b/content/media/MediaResource.h @@ -55,7 +55,10 @@ public: MediaChannelStatistics(MediaChannelStatistics * aCopyFrom) { MOZ_ASSERT(aCopyFrom); - *this = *aCopyFrom; + mAccumulatedBytes = aCopyFrom->mAccumulatedBytes; + mAccumulatedTime = aCopyFrom->mAccumulatedTime; + mLastStartTime = aCopyFrom->mLastStartTime; + mIsStarted = aCopyFrom->mIsStarted; } NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaChannelStatistics) diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h index e8831d2a68e..3d5dbf5419a 100644 --- a/xpcom/glue/nsISupportsImpl.h +++ b/xpcom/glue/nsISupportsImpl.h @@ -30,6 +30,9 @@ #include "nsDebug.h" #include "nsTraceRefcnt.h" +#ifndef XPCOM_GLUE +#include "mozilla/Atomics.h" +#endif #include "mozilla/Attributes.h" #include "mozilla/Assertions.h" #include "mozilla/Likely.h" @@ -206,6 +209,31 @@ class nsAutoRefCnt { nsrefcnt mValue; }; +#ifndef XPCOM_GLUE +namespace mozilla { +class ThreadSafeAutoRefCnt { + public: + ThreadSafeAutoRefCnt() : mValue(0) {} + ThreadSafeAutoRefCnt(nsrefcnt aValue) : mValue(aValue) {} + + // only support prefix increment/decrement + MOZ_ALWAYS_INLINE nsrefcnt operator++() { return ++mValue; } + MOZ_ALWAYS_INLINE nsrefcnt operator--() { return --mValue; } + + MOZ_ALWAYS_INLINE nsrefcnt operator=(nsrefcnt aValue) { return (mValue = aValue); } + MOZ_ALWAYS_INLINE operator nsrefcnt() const { return mValue; } + MOZ_ALWAYS_INLINE nsrefcnt get() const { return mValue; } + private: + nsrefcnt operator++(int) MOZ_DELETE; + nsrefcnt operator--(int) MOZ_DELETE; + // In theory, RelaseAcquire consistency (but no weaker) is sufficient for + // the counter. Making it weaker could speed up builds on ARM (but not x86), + // but could break pre-existing code that assumes sequential consistency. + Atomic mValue; +}; +} +#endif + /////////////////////////////////////////////////////////////////////////////// /** @@ -364,13 +392,13 @@ public: public: \ NS_METHOD_(nsrefcnt) AddRef(void) { \ MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); \ - nsrefcnt count = NS_AtomicIncrementRefcnt(mRefCnt); \ + nsrefcnt count = ++mRefCnt; \ NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \ return (nsrefcnt) count; \ } \ NS_METHOD_(nsrefcnt) Release(void) { \ MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); \ - nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); \ + nsrefcnt count = --mRefCnt; \ NS_LOG_RELEASE(this, count, #_class); \ if (count == 0) { \ delete (this); \ @@ -379,7 +407,7 @@ public: \ return count; \ } \ protected: \ - nsAutoRefCnt mRefCnt; \ + ::mozilla::ThreadSafeAutoRefCnt mRefCnt; \ public: /** From 31ee35bc9b849e0310e69d4aabec713d9e5ba026 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Sat, 13 Jul 2013 20:28:54 -0500 Subject: [PATCH 22/69] Bug 884061 - Part 2: Add NS_DECL_THREADSAFE_ISUPPORTS, r=jlebar. --HG-- extra : rebase_source : 70514a7fc7760cadf8608e038d686ad5b2542571 --- xpcom/glue/nsISupportsImpl.h | 56 +++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h index 3d5dbf5419a..baddfab7208 100644 --- a/xpcom/glue/nsISupportsImpl.h +++ b/xpcom/glue/nsISupportsImpl.h @@ -202,10 +202,11 @@ class nsAutoRefCnt { nsrefcnt operator=(nsrefcnt aValue) { return (mValue = aValue); } operator nsrefcnt() const { return mValue; } nsrefcnt get() const { return mValue; } + + static const bool isThreadSafe = false; private: - // do not define these to enforce the faster prefix notation - nsrefcnt operator++(int); - nsrefcnt operator--(int); + nsrefcnt operator++(int) MOZ_DELETE; + nsrefcnt operator--(int) MOZ_DELETE; nsrefcnt mValue; }; @@ -223,6 +224,8 @@ class ThreadSafeAutoRefCnt { MOZ_ALWAYS_INLINE nsrefcnt operator=(nsrefcnt aValue) { return (mValue = aValue); } MOZ_ALWAYS_INLINE operator nsrefcnt() const { return mValue; } MOZ_ALWAYS_INLINE nsrefcnt get() const { return mValue; } + + static const bool isThreadSafe = true; private: nsrefcnt operator++(int) MOZ_DELETE; nsrefcnt operator--(int) MOZ_DELETE; @@ -232,6 +235,19 @@ class ThreadSafeAutoRefCnt { Atomic mValue; }; } + +// Temporary declarations until NS_IMPL_THREADSAFE_ADDREF/RELEASE are deleted. +inline nsrefcnt +NS_AtomicIncrementRefcnt(mozilla::ThreadSafeAutoRefCnt &refcnt) +{ + return ++refcnt; +} + +inline nsrefcnt +NS_AtomicDecrementRefcnt(mozilla::ThreadSafeAutoRefCnt &refcnt) +{ + return --refcnt; +} #endif /////////////////////////////////////////////////////////////////////////////// @@ -252,6 +268,17 @@ protected: \ NS_DECL_OWNINGTHREAD \ public: +#define NS_DECL_THREADSAFE_ISUPPORTS \ +public: \ + NS_IMETHOD QueryInterface(REFNSIID aIID, \ + void** aInstancePtr); \ + NS_IMETHOD_(nsrefcnt) AddRef(void); \ + NS_IMETHOD_(nsrefcnt) Release(void); \ +protected: \ + ::mozilla::ThreadSafeAutoRefCnt mRefCnt; \ + NS_DECL_OWNINGTHREAD \ +public: + #define NS_DECL_CYCLE_COLLECTING_ISUPPORTS \ public: \ NS_IMETHOD QueryInterface(REFNSIID aIID, \ @@ -418,10 +445,11 @@ public: NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ { \ MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); \ - NS_ASSERT_OWNINGTHREAD_AND_NOT_CCTHREAD(_class); \ - ++mRefCnt; \ - NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \ - return mRefCnt; \ + if (!mRefCnt.isThreadSafe) \ + NS_ASSERT_OWNINGTHREAD_AND_NOT_CCTHREAD(_class); \ + nsrefcnt count = ++mRefCnt; \ + NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \ + return count; \ } /** @@ -461,16 +489,18 @@ NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ { \ MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); \ - NS_ASSERT_OWNINGTHREAD_AND_NOT_CCTHREAD(_class); \ - --mRefCnt; \ - NS_LOG_RELEASE(this, mRefCnt, #_class); \ - if (mRefCnt == 0) { \ - NS_ASSERT_OWNINGTHREAD(_class); \ + if (!mRefCnt.isThreadSafe) \ + NS_ASSERT_OWNINGTHREAD_AND_NOT_CCTHREAD(_class); \ + nsrefcnt count = --mRefCnt; \ + NS_LOG_RELEASE(this, count, #_class); \ + if (count == 0) { \ + if (!mRefCnt.isThreadSafe) \ + NS_ASSERT_OWNINGTHREAD(_class); \ mRefCnt = 1; /* stabilize */ \ _destroy; \ return 0; \ } \ - return mRefCnt; \ + return count; \ } /** From bbe2bfa9819939006f5fec0028880a48de72dfdd Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Sun, 14 Jul 2013 11:34:46 -0500 Subject: [PATCH 23/69] Bug 884061 - Part 3a: Use NS_DECL_THREADSAFE_ISUPPORTS in accessible/, r=tbsaunde --HG-- extra : rebase_source : 621f71d9c618e7a7804c48b8bc4c5ab43f96493a --- accessible/src/base/DocManager.cpp | 8 ++++---- accessible/src/base/DocManager.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accessible/src/base/DocManager.cpp b/accessible/src/base/DocManager.cpp index 39861563bdd..4a1aa813486 100644 --- a/accessible/src/base/DocManager.cpp +++ b/accessible/src/base/DocManager.cpp @@ -117,10 +117,10 @@ DocManager::Shutdown() //////////////////////////////////////////////////////////////////////////////// // nsISupports -NS_IMPL_THREADSAFE_ISUPPORTS3(DocManager, - nsIWebProgressListener, - nsIDOMEventListener, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(DocManager, + nsIWebProgressListener, + nsIDOMEventListener, + nsISupportsWeakReference) //////////////////////////////////////////////////////////////////////////////// // nsIWebProgressListener diff --git a/accessible/src/base/DocManager.h b/accessible/src/base/DocManager.h index f61b9dc0ca2..180fd774fff 100644 --- a/accessible/src/base/DocManager.h +++ b/accessible/src/base/DocManager.h @@ -29,7 +29,7 @@ class DocManager : public nsIWebProgressListener, public: virtual ~DocManager() { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSIDOMEVENTLISTENER From 2d7db9dc5b8db48e03eb9a38d6f3862bb2c734f0 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Tue, 16 Jul 2013 22:51:48 -0500 Subject: [PATCH 24/69] Bug 884061 - Part 3b: Use NS_DECL_THREADSAFE_ISUPPORTS in caps/, r=bz --HG-- extra : rebase_source : bc7beb6f567c2bf0c4a5c528648198f7619d0e72 --- caps/src/nsNullPrincipalURI.cpp | 4 ++-- caps/src/nsNullPrincipalURI.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/caps/src/nsNullPrincipalURI.cpp b/caps/src/nsNullPrincipalURI.cpp index 28d7ff5ddf6..b5e0d2bb127 100644 --- a/caps/src/nsNullPrincipalURI.cpp +++ b/caps/src/nsNullPrincipalURI.cpp @@ -33,8 +33,8 @@ nsNullPrincipalURI::nsNullPrincipalURI(const nsCString &aSpec) static NS_DEFINE_CID(kNullPrincipalURIImplementationCID, NS_NULLPRINCIPALURI_IMPLEMENTATION_CID); -NS_IMPL_THREADSAFE_ADDREF(nsNullPrincipalURI) -NS_IMPL_THREADSAFE_RELEASE(nsNullPrincipalURI) +NS_IMPL_ADDREF(nsNullPrincipalURI) +NS_IMPL_RELEASE(nsNullPrincipalURI) NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURI) diff --git a/caps/src/nsNullPrincipalURI.h b/caps/src/nsNullPrincipalURI.h index 7ab5d8b9be4..8dac2afc58c 100644 --- a/caps/src/nsNullPrincipalURI.h +++ b/caps/src/nsNullPrincipalURI.h @@ -27,7 +27,7 @@ class nsNullPrincipalURI MOZ_FINAL : public nsIURI , public nsISizeOf { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURI // nsISizeOf From 0f6db18276ff243c3590113732ed3aa073193397 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:20:39 -0500 Subject: [PATCH 25/69] Bug 884061 - Part 3c: Use NS_DECL_THREADSAFE_ISUPPORTS in chrome/, r=bsmedberg --HG-- extra : rebase_source : f18e7477db6d4d817e1961d1fe8f90ec896bfd51 --- chrome/src/nsChromeProtocolHandler.cpp | 6 +++--- chrome/src/nsChromeProtocolHandler.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/src/nsChromeProtocolHandler.cpp b/chrome/src/nsChromeProtocolHandler.cpp index e1c3a9e5539..16183e15f3e 100644 --- a/chrome/src/nsChromeProtocolHandler.cpp +++ b/chrome/src/nsChromeProtocolHandler.cpp @@ -39,9 +39,9 @@ //////////////////////////////////////////////////////////////////////////////// -NS_IMPL_THREADSAFE_ISUPPORTS2(nsChromeProtocolHandler, - nsIProtocolHandler, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS2(nsChromeProtocolHandler, + nsIProtocolHandler, + nsISupportsWeakReference) //////////////////////////////////////////////////////////////////////////////// // nsIProtocolHandler methods: diff --git a/chrome/src/nsChromeProtocolHandler.h b/chrome/src/nsChromeProtocolHandler.h index ecb0bb1206c..4413ff3ae70 100644 --- a/chrome/src/nsChromeProtocolHandler.h +++ b/chrome/src/nsChromeProtocolHandler.h @@ -22,7 +22,7 @@ class nsChromeProtocolHandler MOZ_FINAL : public nsIProtocolHandler, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // nsIProtocolHandler methods: NS_DECL_NSIPROTOCOLHANDLER From 08dac03f44fcc7f3b7e8712dd71c3b44f682bc9e Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:21:19 -0500 Subject: [PATCH 26/69] Bug 884061 - Part 3d: Use NS_DECL_THREADSAFE_ISUPPORTS in content/, r=smaug --HG-- extra : rebase_source : ee869e0ec710259b1f3d1a328bff27c5d2960ea1 --- content/base/public/nsDOMFile.h | 2 +- content/base/src/nsDOMFile.cpp | 14 +++++++------- content/base/src/nsScriptLoader.cpp | 4 ++-- content/html/content/src/nsHTMLDNSPrefetch.cpp | 4 ++-- content/html/content/src/nsHTMLDNSPrefetch.h | 2 +- content/html/document/src/MediaDocument.cpp | 6 +++--- content/html/document/src/MediaDocument.h | 2 +- content/media/MediaDecoder.cpp | 2 +- content/media/MediaDecoder.h | 2 +- content/media/webaudio/MediaBufferDecoder.cpp | 4 ++-- content/media/webrtc/MediaEngineDefault.cpp | 4 ++-- content/media/webrtc/MediaEngineDefault.h | 5 +++-- content/media/webrtc/MediaEngineWebRTC.h | 4 ++-- content/media/webrtc/MediaEngineWebRTCAudio.cpp | 2 +- content/media/webrtc/MediaEngineWebRTCVideo.cpp | 2 +- content/media/wmf/WMFByteStream.cpp | 14 +++++++------- content/media/wmf/WMFByteStream.h | 2 +- content/media/wmf/WMFSourceReaderCallback.cpp | 4 ++-- content/media/wmf/WMFSourceReaderCallback.h | 2 +- content/xul/document/src/nsXULPrototypeCache.cpp | 2 +- content/xul/document/src/nsXULPrototypeCache.h | 2 +- 21 files changed, 43 insertions(+), 42 deletions(-) diff --git a/content/base/public/nsDOMFile.h b/content/base/public/nsDOMFile.h index 146c75f0f71..1b01e8c558c 100644 --- a/content/base/public/nsDOMFile.h +++ b/content/base/public/nsDOMFile.h @@ -180,7 +180,7 @@ public: : nsDOMFileBase(aContentType, aStart, aLength) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS }; class nsDOMFileCC : public nsDOMFileBase diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/nsDOMFile.cpp index f8b8fb65cba..d0c27fffef4 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/nsDOMFile.cpp @@ -56,7 +56,7 @@ public: uint32_t aLength, nsIInputStream** _retval); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // These are mandatory. NS_FORWARD_NSIINPUTSTREAM(mStream->) @@ -82,8 +82,8 @@ private: nsCOMPtr mSerializableInputStream; }; -NS_IMPL_THREADSAFE_ADDREF(DataOwnerAdapter) -NS_IMPL_THREADSAFE_RELEASE(DataOwnerAdapter) +NS_IMPL_ADDREF(DataOwnerAdapter) +NS_IMPL_RELEASE(DataOwnerAdapter) NS_INTERFACE_MAP_BEGIN(DataOwnerAdapter) NS_INTERFACE_MAP_ENTRY(nsIInputStream) @@ -445,8 +445,8 @@ NS_INTERFACE_MAP_BEGIN(nsDOMFile) NS_INTERFACE_MAP_END // Threadsafe when GetMutable() == false -NS_IMPL_THREADSAFE_ADDREF(nsDOMFile) -NS_IMPL_THREADSAFE_RELEASE(nsDOMFile) +NS_IMPL_ADDREF(nsDOMFile) +NS_IMPL_RELEASE(nsDOMFile) //////////////////////////////////////////////////////////////////////////// // nsDOMFileCC implementation @@ -624,7 +624,7 @@ NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(DOMMemoryFileDataOwnerMallocSizeOf) class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL : public nsIMemoryMultiReporter { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD GetName(nsACString& aName) { @@ -705,7 +705,7 @@ class nsDOMMemoryFileDataOwnerMemoryReporter MOZ_FINAL } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDOMMemoryFileDataOwnerMemoryReporter, +NS_IMPL_ISUPPORTS1(nsDOMMemoryFileDataOwnerMemoryReporter, nsIMemoryMultiReporter) /* static */ void diff --git a/content/base/src/nsScriptLoader.cpp b/content/base/src/nsScriptLoader.cpp index fa86f0f98fa..7bf9fe902e7 100644 --- a/content/base/src/nsScriptLoader.cpp +++ b/content/base/src/nsScriptLoader.cpp @@ -75,7 +75,7 @@ public: { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS void FireScriptAvailable(nsresult aResult) { @@ -105,7 +105,7 @@ public: // The nsScriptLoadRequest is passed as the context to necko, and thus // it needs to be threadsafe. Necko won't do anything with this // context, but it will AddRef and Release it on other threads. -NS_IMPL_THREADSAFE_ISUPPORTS0(nsScriptLoadRequest) +NS_IMPL_ISUPPORTS0(nsScriptLoadRequest) ////////////////////////////////////////////////////////////// // diff --git a/content/html/content/src/nsHTMLDNSPrefetch.cpp b/content/html/content/src/nsHTMLDNSPrefetch.cpp index 1e50a94d147..5ebc693c76f 100644 --- a/content/html/content/src/nsHTMLDNSPrefetch.cpp +++ b/content/html/content/src/nsHTMLDNSPrefetch.cpp @@ -229,8 +229,8 @@ nsHTMLDNSPrefetch::CancelPrefetchLow(const nsAString &hostname, nsresult aReason ///////////////////////////////////////////////////////////////////////////////////////////////////////// -NS_IMPL_THREADSAFE_ISUPPORTS1(nsHTMLDNSPrefetch::nsListener, - nsIDNSListener) +NS_IMPL_ISUPPORTS1(nsHTMLDNSPrefetch::nsListener, + nsIDNSListener) NS_IMETHODIMP nsHTMLDNSPrefetch::nsListener::OnLookupComplete(nsICancelable *request, diff --git a/content/html/content/src/nsHTMLDNSPrefetch.h b/content/html/content/src/nsHTMLDNSPrefetch.h index 6f5d2cd17a6..1954da65138 100644 --- a/content/html/content/src/nsHTMLDNSPrefetch.h +++ b/content/html/content/src/nsHTMLDNSPrefetch.h @@ -73,7 +73,7 @@ public: { // This class exists to give a safe callback no-op DNSListener public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDNSLISTENER nsListener() {} diff --git a/content/html/document/src/MediaDocument.cpp b/content/html/document/src/MediaDocument.cpp index 03ab8034eb9..d0941c93c12 100644 --- a/content/html/document/src/MediaDocument.cpp +++ b/content/html/document/src/MediaDocument.cpp @@ -35,9 +35,9 @@ MediaDocumentStreamListener::~MediaDocumentStreamListener() } -NS_IMPL_THREADSAFE_ISUPPORTS2(MediaDocumentStreamListener, - nsIRequestObserver, - nsIStreamListener) +NS_IMPL_ISUPPORTS2(MediaDocumentStreamListener, + nsIRequestObserver, + nsIStreamListener) void diff --git a/content/html/document/src/MediaDocument.h b/content/html/document/src/MediaDocument.h index a6cd967f255..5aa2fb42baa 100644 --- a/content/html/document/src/MediaDocument.h +++ b/content/html/document/src/MediaDocument.h @@ -80,7 +80,7 @@ public: virtual ~MediaDocumentStreamListener(); void SetStreamListener(nsIStreamListener *aListener); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER diff --git a/content/media/MediaDecoder.cpp b/content/media/MediaDecoder.cpp index c94571f9743..996a3a615cd 100644 --- a/content/media/MediaDecoder.cpp +++ b/content/media/MediaDecoder.cpp @@ -110,7 +110,7 @@ public: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(MediaDecoder, nsIObserver) +NS_IMPL_ISUPPORTS1(MediaDecoder, nsIObserver) void MediaDecoder::SetDormantIfNecessary(bool aDormant) { diff --git a/content/media/MediaDecoder.h b/content/media/MediaDecoder.h index 533056c74af..343e8ec47de 100644 --- a/content/media/MediaDecoder.h +++ b/content/media/MediaDecoder.h @@ -241,7 +241,7 @@ class MediaDecoder : public nsIObserver, public: typedef mozilla::layers::Image Image; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER // Enumeration for the valid play states (see mPlayState) diff --git a/content/media/webaudio/MediaBufferDecoder.cpp b/content/media/webaudio/MediaBufferDecoder.cpp index c02f75b6f82..5a80ea00860 100644 --- a/content/media/webaudio/MediaBufferDecoder.cpp +++ b/content/media/webaudio/MediaBufferDecoder.cpp @@ -66,7 +66,7 @@ public: explicit BufferDecoder(MediaResource* aResource); virtual ~BufferDecoder(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // This has to be called before decoding begins void BeginDecoding(nsIThread* aDecodeThread) @@ -126,7 +126,7 @@ private: nsRefPtr mResource; }; -NS_IMPL_THREADSAFE_ISUPPORTS0(BufferDecoder) +NS_IMPL_ISUPPORTS0(BufferDecoder) BufferDecoder::BufferDecoder(MediaResource* aResource) : mReentrantMonitor("BufferDecoder") diff --git a/content/media/webrtc/MediaEngineDefault.cpp b/content/media/webrtc/MediaEngineDefault.cpp index 8823a90c125..3e801ea7e14 100644 --- a/content/media/webrtc/MediaEngineDefault.cpp +++ b/content/media/webrtc/MediaEngineDefault.cpp @@ -25,7 +25,7 @@ namespace mozilla { -NS_IMPL_THREADSAFE_ISUPPORTS1(MediaEngineDefaultVideoSource, nsITimerCallback) +NS_IMPL_ISUPPORTS1(MediaEngineDefaultVideoSource, nsITimerCallback) /** * Default video source. */ @@ -258,7 +258,7 @@ MediaEngineDefaultVideoSource::NotifyPull(MediaStreamGraph* aGraph, /** * Default audio source. */ -NS_IMPL_THREADSAFE_ISUPPORTS1(MediaEngineDefaultAudioSource, nsITimerCallback) +NS_IMPL_ISUPPORTS1(MediaEngineDefaultAudioSource, nsITimerCallback) MediaEngineDefaultAudioSource::MediaEngineDefaultAudioSource() : mTimer(nullptr) diff --git a/content/media/webrtc/MediaEngineDefault.h b/content/media/webrtc/MediaEngineDefault.h index 8beab01db70..94d2b315d18 100644 --- a/content/media/webrtc/MediaEngineDefault.h +++ b/content/media/webrtc/MediaEngineDefault.h @@ -59,7 +59,7 @@ public: return true; } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK protected: @@ -105,7 +105,7 @@ public: return true; } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK protected: @@ -115,6 +115,7 @@ protected: SourceMediaStream* mSource; }; + class MediaEngineDefault : public MediaEngine { public: diff --git a/content/media/webrtc/MediaEngineWebRTC.h b/content/media/webrtc/MediaEngineWebRTC.h index 0ae5e9fceb7..10199f7f6f8 100644 --- a/content/media/webrtc/MediaEngineWebRTC.h +++ b/content/media/webrtc/MediaEngineWebRTC.h @@ -158,7 +158,7 @@ public: return false; } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS #ifdef MOZ_B2G_CAMERA NS_DECL_NSICAMERAGETCAMERACALLBACK NS_DECL_NSICAMERAPREVIEWSTREAMCALLBACK @@ -305,7 +305,7 @@ public: WebRtc_Word16 audio10ms[], const int length, const int samplingFreq, const bool isStereo); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS private: static const unsigned int KMaxDeviceNameLength = 128; diff --git a/content/media/webrtc/MediaEngineWebRTCAudio.cpp b/content/media/webrtc/MediaEngineWebRTCAudio.cpp index 715a8d415e2..7b658bdd940 100644 --- a/content/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/content/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -24,7 +24,7 @@ extern PRLogModuleInfo* GetMediaManagerLog(); /** * Webrtc audio source. */ -NS_IMPL_THREADSAFE_ISUPPORTS0(MediaEngineWebRTCAudioSource) +NS_IMPL_ISUPPORTS0(MediaEngineWebRTCAudioSource) void MediaEngineWebRTCAudioSource::GetName(nsAString& aName) diff --git a/content/media/webrtc/MediaEngineWebRTCVideo.cpp b/content/media/webrtc/MediaEngineWebRTCVideo.cpp index c038385ae21..85920cb1f8c 100644 --- a/content/media/webrtc/MediaEngineWebRTCVideo.cpp +++ b/content/media/webrtc/MediaEngineWebRTCVideo.cpp @@ -22,7 +22,7 @@ extern PRLogModuleInfo* GetMediaManagerLog(); /** * Webrtc video source. */ -NS_IMPL_THREADSAFE_ISUPPORTS1(MediaEngineWebRTCVideoSource, nsIRunnable) +NS_IMPL_ISUPPORTS1(MediaEngineWebRTCVideoSource, nsIRunnable) // ViEExternalRenderer Callback. #ifndef MOZ_B2G_CAMERA diff --git a/content/media/wmf/WMFByteStream.cpp b/content/media/wmf/WMFByteStream.cpp index e6d5e1bbb40..65c74950413 100644 --- a/content/media/wmf/WMFByteStream.cpp +++ b/content/media/wmf/WMFByteStream.cpp @@ -36,11 +36,11 @@ static const uint32_t NumWMFIoThreads = 4; // on this thread, so we need MSCOM working. class ThreadPoolListener MOZ_FINAL : public nsIThreadPoolListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITHREADPOOLLISTENER }; -NS_IMPL_THREADSAFE_ISUPPORTS1(ThreadPoolListener, nsIThreadPoolListener) +NS_IMPL_ISUPPORTS1(ThreadPoolListener, nsIThreadPoolListener) NS_IMETHODIMP ThreadPoolListener::OnThreadCreated() @@ -214,8 +214,8 @@ WMFByteStream::QueryInterface(REFIID aIId, void **aInterface) return E_NOINTERFACE; } -NS_IMPL_THREADSAFE_ADDREF(WMFByteStream) -NS_IMPL_THREADSAFE_RELEASE(WMFByteStream) +NS_IMPL_ADDREF(WMFByteStream) +NS_IMPL_RELEASE(WMFByteStream) // Stores data regarding an async read opreation. @@ -239,12 +239,12 @@ public: ULONG mBytesRead; // IUnknown ref counting. - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD }; -NS_IMPL_THREADSAFE_ADDREF(ReadRequest) -NS_IMPL_THREADSAFE_RELEASE(ReadRequest) +NS_IMPL_ADDREF(ReadRequest) +NS_IMPL_RELEASE(ReadRequest) // IUnknown Methods STDMETHODIMP diff --git a/content/media/wmf/WMFByteStream.h b/content/media/wmf/WMFByteStream.h index 0000e1b1f4e..2dd326024ee 100644 --- a/content/media/wmf/WMFByteStream.h +++ b/content/media/wmf/WMFByteStream.h @@ -162,7 +162,7 @@ private: bool mIsShutdown; // IUnknown ref counting. - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD }; diff --git a/content/media/wmf/WMFSourceReaderCallback.cpp b/content/media/wmf/WMFSourceReaderCallback.cpp index 5164eb5c634..581c5892113 100644 --- a/content/media/wmf/WMFSourceReaderCallback.cpp +++ b/content/media/wmf/WMFSourceReaderCallback.cpp @@ -33,8 +33,8 @@ WMFSourceReaderCallback::QueryInterface(REFIID aIId, void **aInterface) return E_NOINTERFACE; } -NS_IMPL_THREADSAFE_ADDREF(WMFSourceReaderCallback) -NS_IMPL_THREADSAFE_RELEASE(WMFSourceReaderCallback) +NS_IMPL_ADDREF(WMFSourceReaderCallback) +NS_IMPL_RELEASE(WMFSourceReaderCallback) WMFSourceReaderCallback::WMFSourceReaderCallback() : mMonitor("WMFSourceReaderCallback") diff --git a/content/media/wmf/WMFSourceReaderCallback.h b/content/media/wmf/WMFSourceReaderCallback.h index 43feb091656..5c05bfa32b0 100644 --- a/content/media/wmf/WMFSourceReaderCallback.h +++ b/content/media/wmf/WMFSourceReaderCallback.h @@ -73,7 +73,7 @@ private: bool mReadFinished; // IUnknown ref counting. - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD }; diff --git a/content/xul/document/src/nsXULPrototypeCache.cpp b/content/xul/document/src/nsXULPrototypeCache.cpp index 35723811226..b270a93d054 100644 --- a/content/xul/document/src/nsXULPrototypeCache.cpp +++ b/content/xul/document/src/nsXULPrototypeCache.cpp @@ -83,7 +83,7 @@ nsXULPrototypeCache::~nsXULPrototypeCache() } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsXULPrototypeCache, nsIObserver) +NS_IMPL_ISUPPORTS1(nsXULPrototypeCache, nsIObserver) /* static */ nsXULPrototypeCache* nsXULPrototypeCache::GetInstance() diff --git a/content/xul/document/src/nsXULPrototypeCache.h b/content/xul/document/src/nsXULPrototypeCache.h index b51e80ca66a..d05a814c8c5 100644 --- a/content/xul/document/src/nsXULPrototypeCache.h +++ b/content/xul/document/src/nsXULPrototypeCache.h @@ -36,7 +36,7 @@ class nsXULPrototypeCache : public nsIObserver { public: // nsISupports - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER bool IsCached(nsIURI* aURI) { From ca4be40ae4d74df021cbc5d75cb659a474c95c14 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:21:19 -0500 Subject: [PATCH 27/69] Bug 884061 - Part 3e: Use NS_DECL_THREADSAFE_ISUPPORTS in docshell/, r=bz --HG-- extra : rebase_source : dbc05e56fa9eb1ef273f40bd3278ccdea818df9a --- docshell/base/nsDSURIContentListener.cpp | 4 ++-- docshell/base/nsDSURIContentListener.h | 2 +- docshell/base/nsDocShell.cpp | 6 +++--- docshell/base/nsDocShell.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docshell/base/nsDSURIContentListener.cpp b/docshell/base/nsDSURIContentListener.cpp index 036a64a255d..819901c84da 100644 --- a/docshell/base/nsDSURIContentListener.cpp +++ b/docshell/base/nsDSURIContentListener.cpp @@ -52,8 +52,8 @@ nsDSURIContentListener::Init() // nsDSURIContentListener::nsISupports //***************************************************************************** -NS_IMPL_THREADSAFE_ADDREF(nsDSURIContentListener) -NS_IMPL_THREADSAFE_RELEASE(nsDSURIContentListener) +NS_IMPL_ADDREF(nsDSURIContentListener) +NS_IMPL_RELEASE(nsDSURIContentListener) NS_INTERFACE_MAP_BEGIN(nsDSURIContentListener) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIURIContentListener) diff --git a/docshell/base/nsDSURIContentListener.h b/docshell/base/nsDSURIContentListener.h index 1c17a793f36..69e227f420c 100644 --- a/docshell/base/nsDSURIContentListener.h +++ b/docshell/base/nsDSURIContentListener.h @@ -23,7 +23,7 @@ class nsDSURIContentListener : { friend class nsDocShell; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURICONTENTLISTENER nsresult Init(); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 87e2660f167..9e77056a6b5 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -11730,8 +11730,8 @@ nsRefreshTimer::~nsRefreshTimer() // nsRefreshTimer::nsISupports //***************************************************************************** -NS_IMPL_THREADSAFE_ADDREF(nsRefreshTimer) -NS_IMPL_THREADSAFE_RELEASE(nsRefreshTimer) +NS_IMPL_ADDREF(nsRefreshTimer) +NS_IMPL_RELEASE(nsRefreshTimer) NS_INTERFACE_MAP_BEGIN(nsRefreshTimer) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITimerCallback) @@ -11770,7 +11770,7 @@ nsDocShell::InterfaceRequestorProxy::~InterfaceRequestorProxy() mWeakPtr = nullptr; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDocShell::InterfaceRequestorProxy, nsIInterfaceRequestor) +NS_IMPL_ISUPPORTS1(nsDocShell::InterfaceRequestorProxy, nsIInterfaceRequestor) NS_IMETHODIMP nsDocShell::InterfaceRequestorProxy::GetInterface(const nsIID & aIID, void **aSink) diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 59b01658e27..454ec925afa 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -109,7 +109,7 @@ class nsRefreshTimer : public nsITimerCallback public: nsRefreshTimer(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK int32_t GetDelay() { return mDelay ;} @@ -899,7 +899,7 @@ public: public: InterfaceRequestorProxy(nsIInterfaceRequestor* p); virtual ~InterfaceRequestorProxy(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR protected: From fb0ab49c356152c905a767d285ca36aa721e7c16 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:21:20 -0500 Subject: [PATCH 28/69] Bug 884061 - Part 3f: Use NS_DECL_THREADSAFE_ISUPPORTS in dom/, r=smaug,dhylands. --HG-- extra : rebase_source : b8eaae07c54c94c8c46c7ed4c0e226eb74584652 --- dom/base/nsDOMScriptObjectFactory.cpp | 2 +- dom/base/nsDOMScriptObjectFactory.h | 2 +- dom/devicestorage/DeviceStorage.h | 2 +- .../DeviceStorageRequestParent.cpp | 4 ++-- .../DeviceStorageRequestParent.h | 3 ++- dom/devicestorage/nsDeviceStorage.cpp | 2 +- dom/file/ArchiveEvent.cpp | 2 +- dom/file/ArchiveEvent.h | 2 +- dom/file/ArchiveZipFile.cpp | 8 ++++---- dom/file/AsyncHelper.cpp | 2 +- dom/file/AsyncHelper.h | 2 +- dom/file/FileHelper.cpp | 2 +- dom/file/FileHelper.h | 2 +- dom/file/FileService.cpp | 4 ++-- dom/file/FileService.h | 2 +- dom/file/FileStreamWrappers.cpp | 14 ++++++------- dom/file/FileStreamWrappers.h | 2 +- dom/file/LockedFile.cpp | 2 +- dom/file/LockedFile.h | 2 +- dom/file/MemoryStreams.cpp | 2 +- dom/file/MemoryStreams.h | 2 +- dom/indexedDB/AsyncConnectionHelper.cpp | 4 ++-- dom/indexedDB/AsyncConnectionHelper.h | 2 +- dom/indexedDB/CheckPermissionsHelper.cpp | 6 +++--- dom/indexedDB/CheckPermissionsHelper.h | 2 +- dom/indexedDB/FileInfo.cpp | 4 ++-- dom/indexedDB/FileInfo.h | 12 +++++------ dom/indexedDB/IDBTransaction.cpp | 4 ++-- dom/indexedDB/IDBTransaction.h | 4 ++-- dom/indexedDB/IndexedDatabaseManager.cpp | 12 +++++------ dom/indexedDB/OpenDatabaseHelper.cpp | 2 +- dom/indexedDB/OpenDatabaseHelper.h | 2 +- dom/indexedDB/TransactionThreadPool.cpp | 12 +++++------ dom/indexedDB/TransactionThreadPool.h | 2 +- dom/ipc/Blob.cpp | 6 +++--- dom/ipc/ContentParent.cpp | 8 ++++---- dom/ipc/ContentParent.h | 2 +- dom/media/MediaManager.cpp | 4 ++-- dom/media/MediaManager.h | 4 ++-- dom/plugins/base/nsNPAPIPluginInstance.cpp | 2 +- dom/plugins/base/nsNPAPIPluginInstance.h | 2 +- .../base/nsPluginDirServiceProvider.cpp | 4 ++-- dom/plugins/base/nsPluginDirServiceProvider.h | 2 +- dom/quota/CheckQuotaHelper.cpp | 6 +++--- dom/quota/CheckQuotaHelper.h | 2 +- dom/quota/QuotaManager.cpp | 20 +++++++++---------- dom/quota/QuotaObject.cpp | 4 ++-- dom/quota/QuotaObject.h | 2 +- dom/src/geolocation/nsGeoPosition.cpp | 8 ++++---- dom/src/geolocation/nsGeoPosition.h | 4 ++-- dom/src/geolocation/nsGeolocation.cpp | 4 ++-- dom/src/geolocation/nsGeolocation.h | 2 +- dom/src/jsurl/nsJSProtocolHandler.cpp | 4 ++-- dom/src/storage/DOMStorageCache.cpp | 4 ++-- dom/src/storage/DOMStorageCache.h | 3 ++- dom/src/storage/DOMStorageIPC.cpp | 6 +++--- dom/src/storage/DOMStorageIPC.h | 6 ++++-- dom/system/gonk/AutoMounterSetting.cpp | 8 ++++---- .../gonk/GonkGPSGeolocationProvider.cpp | 8 ++++---- dom/system/gonk/GonkGPSGeolocationProvider.h | 2 +- dom/system/gonk/nsVolume.cpp | 2 +- dom/system/gonk/nsVolume.h | 2 +- dom/system/gonk/nsVolumeService.cpp | 6 +++--- dom/system/gonk/nsVolumeService.h | 2 +- dom/workers/ScriptLoader.cpp | 5 ++--- dom/workers/WorkerPrivate.cpp | 11 +++++----- dom/workers/WorkerPrivate.h | 2 +- dom/workers/XMLHttpRequest.cpp | 4 ++-- 68 files changed, 147 insertions(+), 147 deletions(-) diff --git a/dom/base/nsDOMScriptObjectFactory.cpp b/dom/base/nsDOMScriptObjectFactory.cpp index 383b295f36d..1f3d4aa9baa 100644 --- a/dom/base/nsDOMScriptObjectFactory.cpp +++ b/dom/base/nsDOMScriptObjectFactory.cpp @@ -209,7 +209,7 @@ nsresult NS_GetScriptRuntimeByID(uint32_t aScriptTypeID, } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDOMExceptionProvider, nsIExceptionProvider) +NS_IMPL_ISUPPORTS1(nsDOMExceptionProvider, nsIExceptionProvider) NS_IMETHODIMP nsDOMExceptionProvider::GetException(nsresult result, diff --git a/dom/base/nsDOMScriptObjectFactory.h b/dom/base/nsDOMScriptObjectFactory.h index dd4868c1c52..fc5b89c4ba8 100644 --- a/dom/base/nsDOMScriptObjectFactory.h +++ b/dom/base/nsDOMScriptObjectFactory.h @@ -51,6 +51,6 @@ public: class nsDOMExceptionProvider MOZ_FINAL : public nsIExceptionProvider { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEXCEPTIONPROVIDER }; diff --git a/dom/devicestorage/DeviceStorage.h b/dom/devicestorage/DeviceStorage.h index 3f2b0d99010..fdb8c33291f 100644 --- a/dom/devicestorage/DeviceStorage.h +++ b/dom/devicestorage/DeviceStorage.h @@ -65,7 +65,7 @@ public: uint32_t aFileType, uint32_t aFileAttributes); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS bool IsAvailable(); bool IsComposite(); diff --git a/dom/devicestorage/DeviceStorageRequestParent.cpp b/dom/devicestorage/DeviceStorageRequestParent.cpp index f624784d3c9..1502c259287 100644 --- a/dom/devicestorage/DeviceStorageRequestParent.cpp +++ b/dom/devicestorage/DeviceStorageRequestParent.cpp @@ -250,8 +250,8 @@ DeviceStorageRequestParent::~DeviceStorageRequestParent() MOZ_COUNT_DTOR(DeviceStorageRequestParent); } -NS_IMPL_THREADSAFE_ADDREF(DeviceStorageRequestParent) -NS_IMPL_THREADSAFE_RELEASE(DeviceStorageRequestParent) +NS_IMPL_ADDREF(DeviceStorageRequestParent) +NS_IMPL_RELEASE(DeviceStorageRequestParent) void DeviceStorageRequestParent::ActorDestroy(ActorDestroyReason) diff --git a/dom/devicestorage/DeviceStorageRequestParent.h b/dom/devicestorage/DeviceStorageRequestParent.h index e21b6e7c1f0..bda49c618b1 100644 --- a/dom/devicestorage/DeviceStorageRequestParent.h +++ b/dom/devicestorage/DeviceStorageRequestParent.h @@ -36,7 +36,8 @@ protected: ~DeviceStorageRequestParent(); private: - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; + NS_DECL_OWNINGTHREAD DeviceStorageParams mParams; class CancelableRunnable : public nsRunnable diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 889039a6543..d36087665ca 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -1300,7 +1300,7 @@ DeviceStorageFile::GetStatusInternal(nsAString& aStorageName, nsAString& aStatus #endif } -NS_IMPL_THREADSAFE_ISUPPORTS0(DeviceStorageFile) +NS_IMPL_ISUPPORTS0(DeviceStorageFile) static void RegisterForSDCardChanges(nsIObserver* aObserver) diff --git a/dom/file/ArchiveEvent.cpp b/dom/file/ArchiveEvent.cpp index 1088edcbdf8..62cbfffc1ba 100644 --- a/dom/file/ArchiveEvent.cpp +++ b/dom/file/ArchiveEvent.cpp @@ -12,7 +12,7 @@ USING_FILE_NAMESPACE -NS_IMPL_THREADSAFE_ISUPPORTS0(ArchiveItem) +NS_IMPL_ISUPPORTS0(ArchiveItem) ArchiveItem::ArchiveItem() { diff --git a/dom/file/ArchiveEvent.h b/dom/file/ArchiveEvent.h index 42e6a61c3ca..12f9d310379 100644 --- a/dom/file/ArchiveEvent.h +++ b/dom/file/ArchiveEvent.h @@ -24,7 +24,7 @@ BEGIN_FILE_NAMESPACE class ArchiveItem : public nsISupports { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS ArchiveItem(); virtual ~ArchiveItem(); diff --git a/dom/file/ArchiveZipFile.cpp b/dom/file/ArchiveZipFile.cpp index c5473088a74..8d5210952bd 100644 --- a/dom/file/ArchiveZipFile.cpp +++ b/dom/file/ArchiveZipFile.cpp @@ -49,7 +49,7 @@ public: Close(); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSISEEKABLESTREAM @@ -82,9 +82,9 @@ private: // data } mData; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(ArchiveInputStream, - nsIInputStream, - nsISeekableStream) +NS_IMPL_ISUPPORTS2(ArchiveInputStream, + nsIInputStream, + nsISeekableStream) nsresult ArchiveInputStream::Init() diff --git a/dom/file/AsyncHelper.cpp b/dom/file/AsyncHelper.cpp index e9714195a59..2e1916213da 100644 --- a/dom/file/AsyncHelper.cpp +++ b/dom/file/AsyncHelper.cpp @@ -14,7 +14,7 @@ USING_FILE_NAMESPACE -NS_IMPL_THREADSAFE_ISUPPORTS2(AsyncHelper, nsIRunnable, nsIRequest) +NS_IMPL_ISUPPORTS2(AsyncHelper, nsIRunnable, nsIRequest) nsresult AsyncHelper::AsyncWork(nsIRequestObserver* aObserver, nsISupports* aCtxt) diff --git a/dom/file/AsyncHelper.h b/dom/file/AsyncHelper.h index 257e690d3c5..cdf10b3ecca 100644 --- a/dom/file/AsyncHelper.h +++ b/dom/file/AsyncHelper.h @@ -25,7 +25,7 @@ class AsyncHelper : public nsIRunnable, public nsIRequest { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSIREQUEST diff --git a/dom/file/FileHelper.cpp b/dom/file/FileHelper.cpp index 1d49f56d7a7..2c85ab013a7 100644 --- a/dom/file/FileHelper.cpp +++ b/dom/file/FileHelper.cpp @@ -41,7 +41,7 @@ FileHelper::~FileHelper() !mRequest, "Should have cleared this!"); } -NS_IMPL_THREADSAFE_ISUPPORTS1(FileHelper, nsIRequestObserver) +NS_IMPL_ISUPPORTS1(FileHelper, nsIRequestObserver) nsresult FileHelper::Enqueue() diff --git a/dom/file/FileHelper.h b/dom/file/FileHelper.h index ecbdf0701d9..b82865f6742 100644 --- a/dom/file/FileHelper.h +++ b/dom/file/FileHelper.h @@ -45,7 +45,7 @@ class FileHelper : public nsIRequestObserver friend class FileOutputStreamWrapper; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER nsresult diff --git a/dom/file/FileService.cpp b/dom/file/FileService.cpp index b35a500d2d5..32c26c5af56 100644 --- a/dom/file/FileService.cpp +++ b/dom/file/FileService.cpp @@ -343,8 +343,8 @@ FileService::LockedFileQueue::LockedFileQueue(LockedFile* aLockedFile) NS_ASSERTION(aLockedFile, "Null pointer!"); } -NS_IMPL_THREADSAFE_ADDREF(FileService::LockedFileQueue) -NS_IMPL_THREADSAFE_RELEASE(FileService::LockedFileQueue) +NS_IMPL_ADDREF(FileService::LockedFileQueue) +NS_IMPL_RELEASE(FileService::LockedFileQueue) nsresult FileService::LockedFileQueue::Enqueue(FileHelper* aFileHelper) diff --git a/dom/file/FileService.h b/dom/file/FileService.h index bfa4d92c00c..92991f0b5b0 100644 --- a/dom/file/FileService.h +++ b/dom/file/FileService.h @@ -88,7 +88,7 @@ private: nsresult ProcessQueue(); - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD nsRefPtr mLockedFile; nsTArray > mQueue; diff --git a/dom/file/FileStreamWrappers.cpp b/dom/file/FileStreamWrappers.cpp index c4cf10230c7..0205c9f783d 100644 --- a/dom/file/FileStreamWrappers.cpp +++ b/dom/file/FileStreamWrappers.cpp @@ -19,7 +19,7 @@ namespace { class ProgressRunnable MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE ProgressRunnable(FileHelper* aFileHelper, @@ -40,7 +40,7 @@ private: class CloseRunnable MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE CloseRunnable(FileHelper* aFileHelper) @@ -54,7 +54,7 @@ private: class DestroyRunnable MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE DestroyRunnable(FileHelper* aFileHelper) @@ -101,7 +101,7 @@ FileStreamWrapper::~FileStreamWrapper() } } -NS_IMPL_THREADSAFE_ISUPPORTS0(FileStreamWrapper) +NS_IMPL_ISUPPORTS0(FileStreamWrapper) FileInputStreamWrapper::FileInputStreamWrapper(nsISupports* aFileStream, FileHelper* aFileHelper, @@ -347,7 +347,7 @@ FileOutputStreamWrapper::IsNonBlocking(bool* _retval) return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(ProgressRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(ProgressRunnable, nsIRunnable) NS_IMETHODIMP ProgressRunnable::Run() @@ -360,7 +360,7 @@ ProgressRunnable::Run() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(CloseRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(CloseRunnable, nsIRunnable) NS_IMETHODIMP CloseRunnable::Run() @@ -373,7 +373,7 @@ CloseRunnable::Run() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(DestroyRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(DestroyRunnable, nsIRunnable) NS_IMETHODIMP DestroyRunnable::Run() diff --git a/dom/file/FileStreamWrappers.h b/dom/file/FileStreamWrappers.h index 8c90a825259..cbeb567f8cd 100644 --- a/dom/file/FileStreamWrappers.h +++ b/dom/file/FileStreamWrappers.h @@ -19,7 +19,7 @@ class FileHelper; class FileStreamWrapper : public nsISupports { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS FileStreamWrapper(nsISupports* aFileStream, FileHelper* aFileHelper, diff --git a/dom/file/LockedFile.cpp b/dom/file/LockedFile.cpp index f56cbdfa129..5da5313fff0 100644 --- a/dom/file/LockedFile.cpp +++ b/dom/file/LockedFile.cpp @@ -923,7 +923,7 @@ FinishHelper::FinishHelper(LockedFile* aLockedFile) mStream.swap(aLockedFile->mStream); } -NS_IMPL_THREADSAFE_ISUPPORTS1(FinishHelper, nsIRunnable) +NS_IMPL_ISUPPORTS1(FinishHelper, nsIRunnable) NS_IMETHODIMP FinishHelper::Run() diff --git a/dom/file/LockedFile.h b/dom/file/LockedFile.h index b85972e16b0..2c0a7f442b6 100644 --- a/dom/file/LockedFile.h +++ b/dom/file/LockedFile.h @@ -126,7 +126,7 @@ class FinishHelper MOZ_FINAL : public nsIRunnable friend class LockedFile; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE private: diff --git a/dom/file/MemoryStreams.cpp b/dom/file/MemoryStreams.cpp index 1a62229cc28..2cf18360214 100644 --- a/dom/file/MemoryStreams.cpp +++ b/dom/file/MemoryStreams.cpp @@ -27,7 +27,7 @@ MemoryOutputStream::Create(uint64_t aSize) return stream.forget(); } -NS_IMPL_THREADSAFE_ISUPPORTS1(MemoryOutputStream, nsIOutputStream) +NS_IMPL_ISUPPORTS1(MemoryOutputStream, nsIOutputStream) NS_IMETHODIMP MemoryOutputStream::Close() diff --git a/dom/file/MemoryStreams.h b/dom/file/MemoryStreams.h index d62fc444e08..268d5c38c03 100644 --- a/dom/file/MemoryStreams.h +++ b/dom/file/MemoryStreams.h @@ -16,7 +16,7 @@ BEGIN_FILE_NAMESPACE class MemoryOutputStream : public nsIOutputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM static already_AddRefed diff --git a/dom/indexedDB/AsyncConnectionHelper.cpp b/dom/indexedDB/AsyncConnectionHelper.cpp index 5af48e16c13..feabc2b5ded 100644 --- a/dom/indexedDB/AsyncConnectionHelper.cpp +++ b/dom/indexedDB/AsyncConnectionHelper.cpp @@ -185,8 +185,8 @@ AsyncConnectionHelper::~AsyncConnectionHelper() NS_ASSERTION(!mOldProgressHandler, "Should not have anything here!"); } -NS_IMPL_THREADSAFE_ISUPPORTS2(AsyncConnectionHelper, nsIRunnable, - mozIStorageProgressHandler) +NS_IMPL_ISUPPORTS2(AsyncConnectionHelper, nsIRunnable, + mozIStorageProgressHandler) NS_IMETHODIMP AsyncConnectionHelper::Run() diff --git a/dom/indexedDB/AsyncConnectionHelper.h b/dom/indexedDB/AsyncConnectionHelper.h index 12ded34613e..fa607da7f1a 100644 --- a/dom/indexedDB/AsyncConnectionHelper.h +++ b/dom/indexedDB/AsyncConnectionHelper.h @@ -90,7 +90,7 @@ class AsyncConnectionHelper : public HelperBase, public: typedef ipc::ResponseValue ResponseValue; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_MOZISTORAGEPROGRESSHANDLER diff --git a/dom/indexedDB/CheckPermissionsHelper.cpp b/dom/indexedDB/CheckPermissionsHelper.cpp index 8c1bcd9b749..f393582be8b 100644 --- a/dom/indexedDB/CheckPermissionsHelper.cpp +++ b/dom/indexedDB/CheckPermissionsHelper.cpp @@ -91,9 +91,9 @@ GetIndexedDBPermissions(nsIDOMWindow* aWindow) } // anonymous namespace -NS_IMPL_THREADSAFE_ISUPPORTS3(CheckPermissionsHelper, nsIRunnable, - nsIInterfaceRequestor, - nsIObserver) +NS_IMPL_ISUPPORTS3(CheckPermissionsHelper, nsIRunnable, + nsIInterfaceRequestor, + nsIObserver) NS_IMETHODIMP CheckPermissionsHelper::Run() diff --git a/dom/indexedDB/CheckPermissionsHelper.h b/dom/indexedDB/CheckPermissionsHelper.h index c35e183590f..05a5e18d65c 100644 --- a/dom/indexedDB/CheckPermissionsHelper.h +++ b/dom/indexedDB/CheckPermissionsHelper.h @@ -24,7 +24,7 @@ class CheckPermissionsHelper MOZ_FINAL : public nsIRunnable, public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIOBSERVER diff --git a/dom/indexedDB/FileInfo.cpp b/dom/indexedDB/FileInfo.cpp index b356814e4e4..f8f085eecb4 100644 --- a/dom/indexedDB/FileInfo.cpp +++ b/dom/indexedDB/FileInfo.cpp @@ -65,8 +65,8 @@ FileInfo::GetReferences(int32_t* aRefCnt, int32_t* aDBRefCnt, } void -FileInfo::UpdateReferences(nsAutoRefCnt& aRefCount, int32_t aDelta, - bool aClear) +FileInfo::UpdateReferences(mozilla::ThreadSafeAutoRefCnt& aRefCount, + int32_t aDelta, bool aClear) { if (IndexedDatabaseManager::IsClosed()) { NS_ERROR("Shouldn't be called after shutdown!"); diff --git a/dom/indexedDB/FileInfo.h b/dom/indexedDB/FileInfo.h index ed491f43937..120e40ec856 100644 --- a/dom/indexedDB/FileInfo.h +++ b/dom/indexedDB/FileInfo.h @@ -35,7 +35,7 @@ public: void AddRef() { if (IndexedDatabaseManager::IsClosed()) { - NS_AtomicIncrementRefcnt(mRefCnt); + ++mRefCnt; } else { UpdateReferences(mRefCnt, 1); @@ -45,7 +45,7 @@ public: void Release() { if (IndexedDatabaseManager::IsClosed()) { - nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); + nsrefcnt count = --mRefCnt; if (count == 0) { mRefCnt = 1; delete this; @@ -82,13 +82,13 @@ public: virtual int64_t Id() const = 0; private: - void UpdateReferences(nsAutoRefCnt& aRefCount, int32_t aDelta, + void UpdateReferences(ThreadSafeAutoRefCnt& aRefCount, int32_t aDelta, bool aClear = false); void Cleanup(); - nsAutoRefCnt mRefCnt; - nsAutoRefCnt mDBRefCnt; - nsAutoRefCnt mSliceRefCnt; + ThreadSafeAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mDBRefCnt; + ThreadSafeAutoRefCnt mSliceRefCnt; nsRefPtr mFileManager; }; diff --git a/dom/indexedDB/IDBTransaction.cpp b/dom/indexedDB/IDBTransaction.cpp index 62f11902fe3..1982aaaa659 100644 --- a/dom/indexedDB/IDBTransaction.cpp +++ b/dom/indexedDB/IDBTransaction.cpp @@ -820,7 +820,7 @@ CommitHelper::~CommitHelper() { } -NS_IMPL_THREADSAFE_ISUPPORTS1(CommitHelper, nsIRunnable) +NS_IMPL_ISUPPORTS1(CommitHelper, nsIRunnable) NS_IMETHODIMP CommitHelper::Run() @@ -1021,7 +1021,7 @@ UpdateRefcountFunction::Init() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(UpdateRefcountFunction, mozIStorageFunction) +NS_IMPL_ISUPPORTS1(UpdateRefcountFunction, mozIStorageFunction) NS_IMETHODIMP UpdateRefcountFunction::OnFunctionCall(mozIStorageValueArray* aValues, diff --git a/dom/indexedDB/IDBTransaction.h b/dom/indexedDB/IDBTransaction.h index cacdf48705b..7df47669b1a 100644 --- a/dom/indexedDB/IDBTransaction.h +++ b/dom/indexedDB/IDBTransaction.h @@ -281,7 +281,7 @@ private: class CommitHelper MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE CommitHelper(IDBTransaction* aTransaction, @@ -327,7 +327,7 @@ private: class UpdateRefcountFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION UpdateRefcountFunction(FileManager* aFileManager) diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 6faf1e0d884..02755fa3892 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -51,7 +51,7 @@ int32_t gClosed = 0; class AsyncDeleteFileRunnable MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE AsyncDeleteFileRunnable(FileManager* aFileManager, int64_t aFileId); @@ -64,7 +64,7 @@ private: class GetFileReferencesHelper MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE GetFileReferencesHelper(const nsACString& aOrigin, @@ -611,8 +611,8 @@ AsyncDeleteFileRunnable::AsyncDeleteFileRunnable(FileManager* aFileManager, { } -NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncDeleteFileRunnable, - nsIRunnable) +NS_IMPL_ISUPPORTS1(AsyncDeleteFileRunnable, + nsIRunnable) NS_IMETHODIMP AsyncDeleteFileRunnable::Run() @@ -683,8 +683,8 @@ GetFileReferencesHelper::DispatchAndReturnFileReferences(int32_t* aMemRefCnt, return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(GetFileReferencesHelper, - nsIRunnable) +NS_IMPL_ISUPPORTS1(GetFileReferencesHelper, + nsIRunnable) NS_IMETHODIMP GetFileReferencesHelper::Run() diff --git a/dom/indexedDB/OpenDatabaseHelper.cpp b/dom/indexedDB/OpenDatabaseHelper.cpp index eb20057ba61..878bf11514f 100644 --- a/dom/indexedDB/OpenDatabaseHelper.cpp +++ b/dom/indexedDB/OpenDatabaseHelper.cpp @@ -1680,7 +1680,7 @@ private: } // anonymous namespace -NS_IMPL_THREADSAFE_ISUPPORTS1(OpenDatabaseHelper, nsIRunnable) +NS_IMPL_ISUPPORTS1(OpenDatabaseHelper, nsIRunnable) nsresult OpenDatabaseHelper::Init() diff --git a/dom/indexedDB/OpenDatabaseHelper.h b/dom/indexedDB/OpenDatabaseHelper.h index 3588b140d7b..8cbdd7f4d5a 100644 --- a/dom/indexedDB/OpenDatabaseHelper.h +++ b/dom/indexedDB/OpenDatabaseHelper.h @@ -53,7 +53,7 @@ public: "Can't be for deletion and request a version!"); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE nsresult Init(); diff --git a/dom/indexedDB/TransactionThreadPool.cpp b/dom/indexedDB/TransactionThreadPool.cpp index a14923c91f2..ea002457ed5 100644 --- a/dom/indexedDB/TransactionThreadPool.cpp +++ b/dom/indexedDB/TransactionThreadPool.cpp @@ -34,7 +34,7 @@ bool gShutdown = false; class TransactionThreadPoolListener : public nsIThreadPoolListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITHREADPOOLLISTENER private: @@ -51,7 +51,7 @@ BEGIN_INDEXEDDB_NAMESPACE class FinishTransactionRunnable MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE inline FinishTransactionRunnable(IDBTransaction* aTransaction, @@ -566,8 +566,7 @@ TransactionThreadPool::TransactionQueue::Finish(nsIRunnable* aFinishRunnable) mMonitor.Notify(); } -NS_IMPL_THREADSAFE_ISUPPORTS1(TransactionThreadPool::TransactionQueue, - nsIRunnable) +NS_IMPL_ISUPPORTS1(TransactionThreadPool::TransactionQueue, nsIRunnable) NS_IMETHODIMP TransactionThreadPool::TransactionQueue::Run() @@ -639,7 +638,7 @@ FinishTransactionRunnable::FinishTransactionRunnable( mFinishRunnable.swap(aFinishRunnable); } -NS_IMPL_THREADSAFE_ISUPPORTS1(FinishTransactionRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(FinishTransactionRunnable, nsIRunnable) NS_IMETHODIMP FinishTransactionRunnable::Run() @@ -665,8 +664,7 @@ FinishTransactionRunnable::Run() #ifdef MOZ_ENABLE_PROFILER_SPS -NS_IMPL_THREADSAFE_ISUPPORTS1(TransactionThreadPoolListener, - nsIThreadPoolListener) +NS_IMPL_ISUPPORTS1(TransactionThreadPoolListener, nsIThreadPoolListener) NS_IMETHODIMP TransactionThreadPoolListener::OnThreadCreated() diff --git a/dom/indexedDB/TransactionThreadPool.h b/dom/indexedDB/TransactionThreadPool.h index 11a3163a862..51a9537d731 100644 --- a/dom/indexedDB/TransactionThreadPool.h +++ b/dom/indexedDB/TransactionThreadPool.h @@ -59,7 +59,7 @@ protected: class TransactionQueue MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE TransactionQueue(IDBTransaction* aTransaction); diff --git a/dom/ipc/Blob.cpp b/dom/ipc/Blob.cpp index 399c508ced0..8b5501cf69d 100644 --- a/dom/ipc/Blob.cpp +++ b/dom/ipc/Blob.cpp @@ -60,7 +60,7 @@ class RemoteInputStream : public nsIInputStream, ActorFlavorEnum mOrigin; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS RemoteInputStream(nsIDOMBlob* aSourceBlob, ActorFlavorEnum aOrigin) : mMonitor("RemoteInputStream.mMonitor"), mSourceBlob(aSourceBlob), @@ -312,8 +312,8 @@ private: } }; -NS_IMPL_THREADSAFE_ADDREF(RemoteInputStream) -NS_IMPL_THREADSAFE_RELEASE(RemoteInputStream) +NS_IMPL_ADDREF(RemoteInputStream) +NS_IMPL_RELEASE(RemoteInputStream) NS_INTERFACE_MAP_BEGIN(RemoteInputStream) NS_INTERFACE_MAP_ENTRY(nsIInputStream) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 381a31aa502..c5ce91217b6 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1572,10 +1572,10 @@ ContentParent::RecvRecordingDeviceEvents(const nsString& aRecordingStatus) return true; } -NS_IMPL_THREADSAFE_ISUPPORTS3(ContentParent, - nsIObserver, - nsIThreadObserver, - nsIDOMGeoPositionCallback) +NS_IMPL_ISUPPORTS3(ContentParent, + nsIObserver, + nsIThreadObserver, + nsIDOMGeoPositionCallback) NS_IMETHODIMP ContentParent::Observe(nsISupports* aSubject, diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index c5bf5d3d6c0..7cc18488c5d 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -108,7 +108,7 @@ public: static void GetAll(nsTArray& aArray); static void GetAllEvenIfDead(nsTArray& aArray); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER NS_DECL_NSITHREADOBSERVER NS_DECL_NSIDOMGEOPOSITIONCALLBACK diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 5241495a63a..faeb9e4291d 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -230,7 +230,7 @@ protected: /** * nsIMediaDevice implementation. */ -NS_IMPL_THREADSAFE_ISUPPORTS1(MediaDevice, nsIMediaDevice) +NS_IMPL_ISUPPORTS1(MediaDevice, nsIMediaDevice) NS_IMETHODIMP MediaDevice::GetName(nsAString& aName) @@ -893,7 +893,7 @@ MediaManager::MediaManager() mActiveCallbacks.Init(); } -NS_IMPL_THREADSAFE_ISUPPORTS2(MediaManager, nsIMediaManagerService, nsIObserver) +NS_IMPL_ISUPPORTS2(MediaManager, nsIMediaManagerService, nsIObserver) /* static */ StaticRefPtr MediaManager::sSingleton; diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index 40f7f032a99..2ac3dd8b06a 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -385,7 +385,7 @@ typedef nsClassHashtable WindowTable; class MediaDevice : public nsIMediaDevice { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIMEDIADEVICE MediaDevice(MediaEngineVideoSource* aSource) { @@ -425,7 +425,7 @@ public: return Get()->mMediaThread; } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER NS_DECL_NSIMEDIAMANAGERSERVICE diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index abd2e143eb1..9484d8d4441 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -162,7 +162,7 @@ using namespace mozilla::layers; static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); -NS_IMPL_THREADSAFE_ISUPPORTS0(nsNPAPIPluginInstance) +NS_IMPL_ISUPPORTS0(nsNPAPIPluginInstance) nsNPAPIPluginInstance::nsNPAPIPluginInstance() : diff --git a/dom/plugins/base/nsNPAPIPluginInstance.h b/dom/plugins/base/nsNPAPIPluginInstance.h index e15af31b573..3461a63370a 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.h +++ b/dom/plugins/base/nsNPAPIPluginInstance.h @@ -81,7 +81,7 @@ private: typedef mozilla::PluginLibrary PluginLibrary; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsresult Initialize(nsNPAPIPlugin *aPlugin, nsPluginInstanceOwner* aOwner, const char* aMIMEType); nsresult Start(); diff --git a/dom/plugins/base/nsPluginDirServiceProvider.cpp b/dom/plugins/base/nsPluginDirServiceProvider.cpp index caa98aab94f..3a9c00f715e 100644 --- a/dom/plugins/base/nsPluginDirServiceProvider.cpp +++ b/dom/plugins/base/nsPluginDirServiceProvider.cpp @@ -177,8 +177,8 @@ nsPluginDirServiceProvider::~nsPluginDirServiceProvider() // nsPluginDirServiceProvider::nsISupports //***************************************************************************** -NS_IMPL_THREADSAFE_ISUPPORTS1(nsPluginDirServiceProvider, - nsIDirectoryServiceProvider) +NS_IMPL_ISUPPORTS1(nsPluginDirServiceProvider, + nsIDirectoryServiceProvider) //***************************************************************************** // nsPluginDirServiceProvider::nsIDirectoryServiceProvider diff --git a/dom/plugins/base/nsPluginDirServiceProvider.h b/dom/plugins/base/nsPluginDirServiceProvider.h index ed569e1aeba..1fc735d0218 100644 --- a/dom/plugins/base/nsPluginDirServiceProvider.h +++ b/dom/plugins/base/nsPluginDirServiceProvider.h @@ -29,7 +29,7 @@ class nsPluginDirServiceProvider : public nsIDirectoryServiceProvider public: nsPluginDirServiceProvider(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDIRECTORYSERVICEPROVIDER #ifdef XP_WIN diff --git a/dom/quota/CheckQuotaHelper.cpp b/dom/quota/CheckQuotaHelper.cpp index c688db7150f..cb590ec54ab 100644 --- a/dom/quota/CheckQuotaHelper.cpp +++ b/dom/quota/CheckQuotaHelper.cpp @@ -137,9 +137,9 @@ CheckQuotaHelper::GetQuotaPermission(nsIPrincipal* aPrincipal) return permission; } -NS_IMPL_THREADSAFE_ISUPPORTS3(CheckQuotaHelper, nsIRunnable, - nsIInterfaceRequestor, - nsIObserver) +NS_IMPL_ISUPPORTS3(CheckQuotaHelper, nsIRunnable, + nsIInterfaceRequestor, + nsIObserver) NS_IMETHODIMP CheckQuotaHelper::Run() diff --git a/dom/quota/CheckQuotaHelper.h b/dom/quota/CheckQuotaHelper.h index 44d72894d85..c50c572eba7 100644 --- a/dom/quota/CheckQuotaHelper.h +++ b/dom/quota/CheckQuotaHelper.h @@ -26,7 +26,7 @@ class CheckQuotaHelper MOZ_FINAL : public nsIRunnable, public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIOBSERVER diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index ed95c10c0df..bdc5cf32e32 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -124,7 +124,7 @@ class OriginClearRunnable MOZ_FINAL : public nsIRunnable, }; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE // AcquireListener override @@ -196,7 +196,7 @@ class AsyncUsageRunnable MOZ_FINAL : public UsageRunnable, }; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSIQUOTAREQUEST @@ -278,7 +278,7 @@ public: NS_ASSERTION(mCountdown, "Wrong countdown!"); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE void @@ -300,7 +300,7 @@ public: : mBusy(true) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE bool @@ -1899,7 +1899,7 @@ OriginClearRunnable::DeleteFiles(QuotaManager* aQuotaManager) aQuotaManager->OriginClearCompleted(mOriginOrPattern); } -NS_IMPL_THREADSAFE_ISUPPORTS1(OriginClearRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(OriginClearRunnable, nsIRunnable) NS_IMETHODIMP OriginClearRunnable::Run() @@ -2143,9 +2143,9 @@ AsyncUsageRunnable::RunInternal() return NS_ERROR_UNEXPECTED; } -NS_IMPL_THREADSAFE_ISUPPORTS2(AsyncUsageRunnable, - nsIRunnable, - nsIQuotaRequest) +NS_IMPL_ISUPPORTS2(AsyncUsageRunnable, + nsIRunnable, + nsIQuotaRequest) NS_IMETHODIMP AsyncUsageRunnable::Run() @@ -2178,7 +2178,7 @@ AsyncUsageRunnable::Cancel() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(WaitForTransactionsToFinishRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(WaitForTransactionsToFinishRunnable, nsIRunnable) NS_IMETHODIMP WaitForTransactionsToFinishRunnable::Run() @@ -2206,7 +2206,7 @@ WaitForTransactionsToFinishRunnable::Run() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(WaitForLockedFilesToFinishRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(WaitForLockedFilesToFinishRunnable, nsIRunnable) NS_IMETHODIMP WaitForLockedFilesToFinishRunnable::Run() diff --git a/dom/quota/QuotaObject.cpp b/dom/quota/QuotaObject.cpp index 410b557bdfc..4d15ffd3b7e 100644 --- a/dom/quota/QuotaObject.cpp +++ b/dom/quota/QuotaObject.cpp @@ -17,7 +17,7 @@ QuotaObject::AddRef() if (!quotaManager) { NS_ERROR("Null quota manager, this shouldn't happen, possible leak!"); - NS_AtomicIncrementRefcnt(mRefCnt); + ++mRefCnt; return; } @@ -34,7 +34,7 @@ QuotaObject::Release() if (!quotaManager) { NS_ERROR("Null quota manager, this shouldn't happen, possible leak!"); - nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); + nsrefcnt count = --mRefCnt; if (count == 0) { mRefCnt = 1; delete this; diff --git a/dom/quota/QuotaObject.h b/dom/quota/QuotaObject.h index 0ec3447a605..baf9dad79ef 100644 --- a/dom/quota/QuotaObject.h +++ b/dom/quota/QuotaObject.h @@ -42,7 +42,7 @@ private: virtual ~QuotaObject() { } - nsAutoRefCnt mRefCnt; + mozilla::ThreadSafeAutoRefCnt mRefCnt; OriginInfo* mOriginInfo; nsString mPath; diff --git a/dom/src/geolocation/nsGeoPosition.cpp b/dom/src/geolocation/nsGeoPosition.cpp index 61e91f6a408..2b04a39334f 100644 --- a/dom/src/geolocation/nsGeoPosition.cpp +++ b/dom/src/geolocation/nsGeoPosition.cpp @@ -37,8 +37,8 @@ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPositionCoords) NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCoords) NS_INTERFACE_MAP_END -NS_IMPL_THREADSAFE_ADDREF(nsGeoPositionCoords) -NS_IMPL_THREADSAFE_RELEASE(nsGeoPositionCoords) +NS_IMPL_ADDREF(nsGeoPositionCoords) +NS_IMPL_RELEASE(nsGeoPositionCoords) NS_IMETHODIMP nsGeoPositionCoords::GetLatitude(double *aLatitude) @@ -128,8 +128,8 @@ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPosition) NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPosition) NS_INTERFACE_MAP_END -NS_IMPL_THREADSAFE_ADDREF(nsGeoPosition) -NS_IMPL_THREADSAFE_RELEASE(nsGeoPosition) +NS_IMPL_ADDREF(nsGeoPosition) +NS_IMPL_RELEASE(nsGeoPosition) NS_IMETHODIMP nsGeoPosition::GetTimestamp(DOMTimeStamp* aTimestamp) diff --git a/dom/src/geolocation/nsGeoPosition.h b/dom/src/geolocation/nsGeoPosition.h index 8b1ad3da999..457e95a4c38 100644 --- a/dom/src/geolocation/nsGeoPosition.h +++ b/dom/src/geolocation/nsGeoPosition.h @@ -27,7 +27,7 @@ struct JSContext; class nsGeoPositionCoords MOZ_FINAL : public nsIDOMGeoPositionCoords { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDOMGEOPOSITIONCOORDS nsGeoPositionCoords(double aLat, double aLong, @@ -47,7 +47,7 @@ private: class nsGeoPosition MOZ_FINAL : public nsIDOMGeoPosition { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDOMGEOPOSITION nsGeoPosition(double aLat, double aLong, diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp index d46cdece662..4f8dccedc20 100644 --- a/dom/src/geolocation/nsGeolocation.cpp +++ b/dom/src/geolocation/nsGeolocation.cpp @@ -611,8 +611,8 @@ NS_INTERFACE_MAP_BEGIN(nsGeolocationService) NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_END -NS_IMPL_THREADSAFE_ADDREF(nsGeolocationService) -NS_IMPL_THREADSAFE_RELEASE(nsGeolocationService) +NS_IMPL_ADDREF(nsGeolocationService) +NS_IMPL_RELEASE(nsGeolocationService) static bool sGeoEnabled = true; diff --git a/dom/src/geolocation/nsGeolocation.h b/dom/src/geolocation/nsGeolocation.h index 8d470470d30..f9bae896f63 100644 --- a/dom/src/geolocation/nsGeolocation.h +++ b/dom/src/geolocation/nsGeolocation.h @@ -108,7 +108,7 @@ public: static already_AddRefed GetGeolocationService(); static mozilla::StaticRefPtr sService; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIGEOLOCATIONUPDATE NS_DECL_NSIOBSERVER diff --git a/dom/src/jsurl/nsJSProtocolHandler.cpp b/dom/src/jsurl/nsJSProtocolHandler.cpp index de5ff3bec84..974626359b8 100644 --- a/dom/src/jsurl/nsJSProtocolHandler.cpp +++ b/dom/src/jsurl/nsJSProtocolHandler.cpp @@ -56,7 +56,7 @@ class nsJSThunk : public nsIInputStream public: nsJSThunk(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_FORWARD_SAFE_NSIINPUTSTREAM(mInnerStream) nsresult Init(nsIURI* uri); @@ -76,7 +76,7 @@ protected: // // nsISupports implementation... // -NS_IMPL_THREADSAFE_ISUPPORTS1(nsJSThunk, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsJSThunk, nsIInputStream) nsJSThunk::nsJSThunk() diff --git a/dom/src/storage/DOMStorageCache.cpp b/dom/src/storage/DOMStorageCache.cpp index 32f19597d03..c5a8ef24ba0 100644 --- a/dom/src/storage/DOMStorageCache.cpp +++ b/dom/src/storage/DOMStorageCache.cpp @@ -53,7 +53,7 @@ GetDataSetIndex(const DOMStorage* aStorage) // DOMStorageCacheBridge -NS_IMPL_THREADSAFE_ADDREF(DOMStorageCacheBridge) +NS_IMPL_ADDREF(DOMStorageCacheBridge) // Since there is no consumer of return value of Release, we can turn this // method to void to make implementation of asynchronous DOMStorageCache::Release @@ -61,7 +61,7 @@ NS_IMPL_THREADSAFE_ADDREF(DOMStorageCacheBridge) NS_IMETHODIMP_(void) DOMStorageCacheBridge::Release(void) { MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); - nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); + nsrefcnt count = --mRefCnt; NS_LOG_RELEASE(this, count, "DOMStorageCacheBridge"); if (0 == count) { mRefCnt = 1; /* stabilize */ diff --git a/dom/src/storage/DOMStorageCache.h b/dom/src/storage/DOMStorageCache.h index c5626e46c43..81c33a40ff6 100644 --- a/dom/src/storage/DOMStorageCache.h +++ b/dom/src/storage/DOMStorageCache.h @@ -55,7 +55,8 @@ public: virtual void LoadWait() = 0; protected: - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; + NS_DECL_OWNINGTHREAD }; // Implementation of scope cache that is responsible for preloading data diff --git a/dom/src/storage/DOMStorageIPC.cpp b/dom/src/storage/DOMStorageIPC.cpp index a55970e41a9..97e7b8fbb67 100644 --- a/dom/src/storage/DOMStorageIPC.cpp +++ b/dom/src/storage/DOMStorageIPC.cpp @@ -18,7 +18,7 @@ namespace dom { // Child // ---------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ADDREF(DOMStorageDBChild) +NS_IMPL_ADDREF(DOMStorageDBChild) NS_IMETHODIMP_(nsrefcnt) DOMStorageDBChild::Release(void) { @@ -274,8 +274,8 @@ DOMStorageDBChild::RecvError(const nsresult& aRv) // Parent // ---------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ADDREF(DOMStorageDBParent) -NS_IMPL_THREADSAFE_RELEASE(DOMStorageDBParent) +NS_IMPL_ADDREF(DOMStorageDBParent) +NS_IMPL_RELEASE(DOMStorageDBParent) void DOMStorageDBParent::AddIPDLReference() diff --git a/dom/src/storage/DOMStorageIPC.h b/dom/src/storage/DOMStorageIPC.h index 2a9c2342cca..121ebe133b9 100644 --- a/dom/src/storage/DOMStorageIPC.h +++ b/dom/src/storage/DOMStorageIPC.h @@ -76,7 +76,8 @@ private: nsTHashtable& ScopesHavingData(); - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; + NS_DECL_OWNINGTHREAD // Held to get caches to forward answers to. nsRefPtr mManager; @@ -179,7 +180,8 @@ private: private: CacheParentBridge* NewCache(const nsACString& aScope); - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; + NS_DECL_OWNINGTHREAD // True when IPC channel is open and Send*() methods are OK to use. bool mIPCOpen; diff --git a/dom/system/gonk/AutoMounterSetting.cpp b/dom/system/gonk/AutoMounterSetting.cpp index 75c21607b38..4ffa9595a37 100644 --- a/dom/system/gonk/AutoMounterSetting.cpp +++ b/dom/system/gonk/AutoMounterSetting.cpp @@ -37,7 +37,7 @@ namespace system { class SettingsServiceCallback MOZ_FINAL : public nsISettingsServiceCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS SettingsServiceCallback() {} @@ -57,12 +57,12 @@ public: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(SettingsServiceCallback, nsISettingsServiceCallback) +NS_IMPL_ISUPPORTS1(SettingsServiceCallback, nsISettingsServiceCallback) class CheckVolumeSettingsCallback MOZ_FINAL : public nsISettingsServiceCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS CheckVolumeSettingsCallback(const nsACString& aVolumeName) : mVolumeName(aVolumeName) {} @@ -85,7 +85,7 @@ private: nsCString mVolumeName; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(CheckVolumeSettingsCallback, nsISettingsServiceCallback) +NS_IMPL_ISUPPORTS1(CheckVolumeSettingsCallback, nsISettingsServiceCallback) AutoMounterSetting::AutoMounterSetting() { diff --git a/dom/system/gonk/GonkGPSGeolocationProvider.cpp b/dom/system/gonk/GonkGPSGeolocationProvider.cpp index 1cb00f262f8..2ffd5bf450c 100644 --- a/dom/system/gonk/GonkGPSGeolocationProvider.cpp +++ b/dom/system/gonk/GonkGPSGeolocationProvider.cpp @@ -44,10 +44,10 @@ static const int kDefaultPeriod = 1000; // ms // While most methods of GonkGPSGeolocationProvider should only be // called from main thread, we deliberately put the Init and ShutdownGPS // methods off main thread to avoid blocking. -NS_IMPL_THREADSAFE_ISUPPORTS3(GonkGPSGeolocationProvider, - nsIGeolocationProvider, - nsIRILDataCallback, - nsISettingsServiceCallback) +NS_IMPL_ISUPPORTS3(GonkGPSGeolocationProvider, + nsIGeolocationProvider, + nsIRILDataCallback, + nsISettingsServiceCallback) /* static */ GonkGPSGeolocationProvider* GonkGPSGeolocationProvider::sSingleton = nullptr; GpsCallbacks GonkGPSGeolocationProvider::mCallbacks = { diff --git a/dom/system/gonk/GonkGPSGeolocationProvider.h b/dom/system/gonk/GonkGPSGeolocationProvider.h index 2cdda883d58..66f27da8cea 100644 --- a/dom/system/gonk/GonkGPSGeolocationProvider.h +++ b/dom/system/gonk/GonkGPSGeolocationProvider.h @@ -37,7 +37,7 @@ class GonkGPSGeolocationProvider : public nsIGeolocationProvider , public nsISettingsServiceCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIGEOLOCATIONPROVIDER NS_DECL_NSIRILDATACALLBACK NS_DECL_NSISETTINGSSERVICECALLBACK diff --git a/dom/system/gonk/nsVolume.cpp b/dom/system/gonk/nsVolume.cpp index e1318a6b49e..5162d117b21 100644 --- a/dom/system/gonk/nsVolume.cpp +++ b/dom/system/gonk/nsVolume.cpp @@ -43,7 +43,7 @@ NS_VolumeStateStr(int32_t aState) // allocate an nsVolume which is then passed to MainThread. Since we // have a situation where we allocate on one thread and free on another // we use a thread safe AddRef implementation. -NS_IMPL_THREADSAFE_ISUPPORTS1(nsVolume, nsIVolume) +NS_IMPL_ISUPPORTS1(nsVolume, nsIVolume) nsVolume::nsVolume(const Volume* aVolume) : mName(NS_ConvertUTF8toUTF16(aVolume->Name())), diff --git a/dom/system/gonk/nsVolume.h b/dom/system/gonk/nsVolume.h index 61bdd3479cb..b2f85fdb1a2 100644 --- a/dom/system/gonk/nsVolume.h +++ b/dom/system/gonk/nsVolume.h @@ -19,7 +19,7 @@ class VolumeMountLock; class nsVolume : public nsIVolume { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIVOLUME // This constructor is used by the UpdateVolumeRunnable constructor diff --git a/dom/system/gonk/nsVolumeService.cpp b/dom/system/gonk/nsVolumeService.cpp index 39606c3700b..e9a0bab53c0 100644 --- a/dom/system/gonk/nsVolumeService.cpp +++ b/dom/system/gonk/nsVolumeService.cpp @@ -39,9 +39,9 @@ using namespace mozilla::services; namespace mozilla { namespace system { -NS_IMPL_THREADSAFE_ISUPPORTS2(nsVolumeService, - nsIVolumeService, - nsIDOMMozWakeLockListener) +NS_IMPL_ISUPPORTS2(nsVolumeService, + nsIVolumeService, + nsIDOMMozWakeLockListener) StaticRefPtr nsVolumeService::sSingleton; diff --git a/dom/system/gonk/nsVolumeService.h b/dom/system/gonk/nsVolumeService.h index e537d99dd75..68dddd43578 100644 --- a/dom/system/gonk/nsVolumeService.h +++ b/dom/system/gonk/nsVolumeService.h @@ -30,7 +30,7 @@ class nsVolumeService MOZ_FINAL : public nsIVolumeService, public nsIDOMMozWakeLockListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIVOLUMESERVICE NS_DECL_NSIDOMMOZWAKELOCKLISTENER diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index c2c5fa3843d..0a4c9bccbe6 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -133,7 +133,7 @@ class ScriptLoaderRunnable : public WorkerFeature, bool mCanceledMainThread; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS ScriptLoaderRunnable(WorkerPrivate* aWorkerPrivate, uint32_t aSyncQueueKey, @@ -520,8 +520,7 @@ public: } }; -NS_IMPL_THREADSAFE_ISUPPORTS2(ScriptLoaderRunnable, nsIRunnable, - nsIStreamLoaderObserver) +NS_IMPL_ISUPPORTS2(ScriptLoaderRunnable, nsIRunnable, nsIStreamLoaderObserver) class StopSyncLoopRunnable MOZ_FINAL : public MainThreadSyncRunnable { diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 7ca592c5ab1..eebcc140a42 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -1184,7 +1184,7 @@ public: : mWorkerRunnable(aWorkerRunnable) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Dispatch(nsIRunnable* aRunnable, uint32_t aFlags) @@ -1213,7 +1213,7 @@ public: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(WorkerRunnableEventTarget, nsIEventTarget) +NS_IMPL_ISUPPORTS1(WorkerRunnableEventTarget, nsIEventTarget) class KillCloseEventRunnable : public WorkerRunnable { @@ -1539,7 +1539,7 @@ WorkerRunnable::WorkerRunnable(WorkerPrivate* aWorkerPrivate, Target aTarget, } #endif -NS_IMPL_THREADSAFE_ISUPPORTS1(WorkerRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(WorkerRunnable, nsIRunnable) bool WorkerRunnable::PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) @@ -1784,7 +1784,7 @@ class WorkerPrivate::MemoryReporter MOZ_FINAL : public nsIMemoryMultiReporter bool mAlreadyMappedToAddon; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS MemoryReporter(WorkerPrivate* aWorkerPrivate) : mMutex(aWorkerPrivate->mMutex), mWorkerPrivate(aWorkerPrivate), @@ -1891,8 +1891,7 @@ private: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(WorkerPrivate::MemoryReporter, - nsIMemoryMultiReporter) +NS_IMPL_ISUPPORTS1(WorkerPrivate::MemoryReporter, nsIMemoryMultiReporter) template WorkerPrivateParent::WorkerPrivateParent( diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 701175fd8db..22a061e4311 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -65,7 +65,7 @@ protected: ClearingBehavior mClearingBehavior; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS bool Dispatch(JSContext* aCx); diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 1fb32a396e2..b48ae9d9f06 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -125,7 +125,7 @@ public: bool mInOpen; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDOMEVENTLISTENER Proxy(XMLHttpRequest* aXHRPrivate, bool aMozAnon, bool aMozSystem) @@ -1345,7 +1345,7 @@ Proxy::AddRemoveEventListeners(bool aUpload, bool aAdd) return true; } -NS_IMPL_THREADSAFE_ISUPPORTS1(Proxy, nsIDOMEventListener) +NS_IMPL_ISUPPORTS1(Proxy, nsIDOMEventListener) NS_IMETHODIMP Proxy::HandleEvent(nsIDOMEvent* aEvent) From f9802e9766a718ba83bd0acf2254200c03c369dd Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:22:23 -0500 Subject: [PATCH 29/69] Bug 884061 - Part 3g: Use NS_DECL_THREADSAFE_ISUPPORTS in embedding/, r=bsmedberg --HG-- extra : rebase_source : 945c7378a49ec5ffb235925cfc7986ba9d6061bc --- embedding/browser/webBrowser/nsDocShellTreeOwner.cpp | 4 ++-- .../components/printingui/src/mac/nsPrintProgress.cpp | 4 ++-- embedding/components/printingui/src/mac/nsPrintProgress.h | 2 +- .../components/printingui/src/os2/nsPrintProgress.cpp | 4 ++-- embedding/components/printingui/src/os2/nsPrintProgress.h | 2 +- .../printingui/src/unixshared/nsPrintProgress.cpp | 4 ++-- .../printingui/src/unixshared/nsPrintProgress.h | 2 +- .../components/printingui/src/win/nsPrintProgress.cpp | 8 ++++---- embedding/components/printingui/src/win/nsPrintProgress.h | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp index 64fcf164df2..7952620192b 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp @@ -994,7 +994,7 @@ class DefaultTooltipTextProvider MOZ_FINAL : public nsITooltipTextProvider public: DefaultTooltipTextProvider(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITOOLTIPTEXTPROVIDER protected: @@ -1003,7 +1003,7 @@ protected: nsCOMPtr mTag_window; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(DefaultTooltipTextProvider, nsITooltipTextProvider) +NS_IMPL_ISUPPORTS1(DefaultTooltipTextProvider, nsITooltipTextProvider) DefaultTooltipTextProvider::DefaultTooltipTextProvider() { diff --git a/embedding/components/printingui/src/mac/nsPrintProgress.cpp b/embedding/components/printingui/src/mac/nsPrintProgress.cpp index 889b18a9960..4348376204a 100644 --- a/embedding/components/printingui/src/mac/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/mac/nsPrintProgress.cpp @@ -11,8 +11,8 @@ #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" -NS_IMPL_THREADSAFE_ADDREF(nsPrintProgress) -NS_IMPL_THREADSAFE_RELEASE(nsPrintProgress) +NS_IMPL_ADDREF(nsPrintProgress) +NS_IMPL_RELEASE(nsPrintProgress) NS_INTERFACE_MAP_BEGIN(nsPrintProgress) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintStatusFeedback) diff --git a/embedding/components/printingui/src/mac/nsPrintProgress.h b/embedding/components/printingui/src/mac/nsPrintProgress.h index 3ec216a2b6d..d8d490dac09 100644 --- a/embedding/components/printingui/src/mac/nsPrintProgress.h +++ b/embedding/components/printingui/src/mac/nsPrintProgress.h @@ -18,7 +18,7 @@ class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPRINTPROGRESS NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSIPRINTSTATUSFEEDBACK diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.cpp b/embedding/components/printingui/src/os2/nsPrintProgress.cpp index 969a6bf4d16..643c3f44042 100644 --- a/embedding/components/printingui/src/os2/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/os2/nsPrintProgress.cpp @@ -11,8 +11,8 @@ #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" -NS_IMPL_THREADSAFE_ADDREF(nsPrintProgress) -NS_IMPL_THREADSAFE_RELEASE(nsPrintProgress) +NS_IMPL_ADDREF(nsPrintProgress) +NS_IMPL_RELEASE(nsPrintProgress) NS_INTERFACE_MAP_BEGIN(nsPrintProgress) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintStatusFeedback) diff --git a/embedding/components/printingui/src/os2/nsPrintProgress.h b/embedding/components/printingui/src/os2/nsPrintProgress.h index db698ca04c9..ba7a373b048 100644 --- a/embedding/components/printingui/src/os2/nsPrintProgress.h +++ b/embedding/components/printingui/src/os2/nsPrintProgress.h @@ -18,7 +18,7 @@ class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPRINTPROGRESS NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSIPRINTSTATUSFEEDBACK diff --git a/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp b/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp index 466139b2bb9..1b626df970a 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp @@ -11,8 +11,8 @@ #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" -NS_IMPL_THREADSAFE_ADDREF(nsPrintProgress) -NS_IMPL_THREADSAFE_RELEASE(nsPrintProgress) +NS_IMPL_ADDREF(nsPrintProgress) +NS_IMPL_RELEASE(nsPrintProgress) NS_INTERFACE_MAP_BEGIN(nsPrintProgress) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintStatusFeedback) diff --git a/embedding/components/printingui/src/unixshared/nsPrintProgress.h b/embedding/components/printingui/src/unixshared/nsPrintProgress.h index 304f90e59e6..3d3db12a157 100644 --- a/embedding/components/printingui/src/unixshared/nsPrintProgress.h +++ b/embedding/components/printingui/src/unixshared/nsPrintProgress.h @@ -19,7 +19,7 @@ class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPRINTPROGRESS NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSIPRINTSTATUSFEEDBACK diff --git a/embedding/components/printingui/src/win/nsPrintProgress.cpp b/embedding/components/printingui/src/win/nsPrintProgress.cpp index 79d409bffb6..9cea6dcff65 100644 --- a/embedding/components/printingui/src/win/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/win/nsPrintProgress.cpp @@ -14,14 +14,14 @@ #include "nsAtomicRefcnt.h" #if 0 -NS_IMPL_THREADSAFE_ADDREF(nsPrintProgress) -NS_IMPL_THREADSAFE_RELEASE(nsPrintProgress) +NS_IMPL_ADDREF(nsPrintProgress) +NS_IMPL_RELEASE(nsPrintProgress) #else NS_IMETHODIMP_(nsrefcnt) nsPrintProgress::AddRef(void) { NS_PRECONDITION(int32_t(mRefCnt) >= 0, "illegal refcnt"); nsrefcnt count; - count = NS_AtomicIncrementRefcnt(mRefCnt); + count = ++mRefCnt; //NS_LOG_ADDREF(this, count, "nsPrintProgress", sizeof(*this)); return count; } @@ -30,7 +30,7 @@ NS_IMETHODIMP_(nsrefcnt) nsPrintProgress::Release(void) { nsrefcnt count; NS_PRECONDITION(0 != mRefCnt, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; //NS_LOG_RELEASE(this, count, "nsPrintProgress"); if (0 == count) { mRefCnt = 1; /* stabilize */ diff --git a/embedding/components/printingui/src/win/nsPrintProgress.h b/embedding/components/printingui/src/win/nsPrintProgress.h index 7e33839f7c4..adc5a14cc0b 100644 --- a/embedding/components/printingui/src/win/nsPrintProgress.h +++ b/embedding/components/printingui/src/win/nsPrintProgress.h @@ -19,7 +19,7 @@ class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPRINTPROGRESS NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSIPRINTSTATUSFEEDBACK From 1b890625f7774052f0c48bcc5ccf54ab39187236 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:04 -0500 Subject: [PATCH 30/69] Bug 884061 - Part 3h: Use NS_DECL_THREADSAFE_ISUPPORTS in extensions/, r=bsmedberg --HG-- extra : rebase_source : a0b4847f33bc4183b9aeea9b298e410462e0c72d --- extensions/auth/nsAuthGSSAPI.cpp | 2 +- extensions/auth/nsAuthGSSAPI.h | 2 +- extensions/auth/nsAuthSASL.cpp | 2 +- extensions/auth/nsAuthSASL.h | 2 +- extensions/gio/nsGIOProtocolHandler.cpp | 4 ++-- extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp | 4 ++-- extensions/pref/autoconfig/src/nsAutoConfig.cpp | 2 +- extensions/pref/autoconfig/src/nsAutoConfig.h | 2 +- extensions/pref/autoconfig/src/nsReadConfig.cpp | 2 +- extensions/pref/autoconfig/src/nsReadConfig.h | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/extensions/auth/nsAuthGSSAPI.cpp b/extensions/auth/nsAuthGSSAPI.cpp index 4e8d283aa83..51268fc81be 100644 --- a/extensions/auth/nsAuthGSSAPI.cpp +++ b/extensions/auth/nsAuthGSSAPI.cpp @@ -331,7 +331,7 @@ nsAuthGSSAPI::Shutdown() } /* Limitations apply to this class's thread safety. See the header file */ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsAuthGSSAPI, nsIAuthModule) +NS_IMPL_ISUPPORTS1(nsAuthGSSAPI, nsIAuthModule) NS_IMETHODIMP nsAuthGSSAPI::Init(const char *serviceName, diff --git a/extensions/auth/nsAuthGSSAPI.h b/extensions/auth/nsAuthGSSAPI.h index b15fba6e8d7..5fce23b4ef4 100644 --- a/extensions/auth/nsAuthGSSAPI.h +++ b/extensions/auth/nsAuthGSSAPI.h @@ -38,7 +38,7 @@ class nsAuthGSSAPI MOZ_FINAL : public nsIAuthModule { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIAUTHMODULE nsAuthGSSAPI(pType package); diff --git a/extensions/auth/nsAuthSASL.cpp b/extensions/auth/nsAuthSASL.cpp index 05e6089a4a9..032dccb7dfb 100644 --- a/extensions/auth/nsAuthSASL.cpp +++ b/extensions/auth/nsAuthSASL.cpp @@ -23,7 +23,7 @@ void nsAuthSASL::Reset() } /* Limitations apply to this class's thread safety. See the header file */ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsAuthSASL, nsIAuthModule) +NS_IMPL_ISUPPORTS1(nsAuthSASL, nsIAuthModule) NS_IMETHODIMP nsAuthSASL::Init(const char *serviceName, diff --git a/extensions/auth/nsAuthSASL.h b/extensions/auth/nsAuthSASL.h index d2080413633..5dd578e6b69 100644 --- a/extensions/auth/nsAuthSASL.h +++ b/extensions/auth/nsAuthSASL.h @@ -19,7 +19,7 @@ class nsAuthSASL MOZ_FINAL : public nsIAuthModule { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIAUTHMODULE nsAuthSASL(); diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/extensions/gio/nsGIOProtocolHandler.cpp index 327a326bb5b..242ac56c194 100644 --- a/extensions/gio/nsGIOProtocolHandler.cpp +++ b/extensions/gio/nsGIOProtocolHandler.cpp @@ -138,7 +138,7 @@ static void mount_operation_ask_password (GMountOperation *mount_op, class nsGIOInputStream MOZ_FINAL : public nsIInputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM nsGIOInputStream(const nsCString &uriSpec) @@ -580,7 +580,7 @@ nsGIOInputStream::SetContentTypeOfChannel(const char *contentType) return rv; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsGIOInputStream, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsGIOInputStream, nsIInputStream) /** * Free all used memory and close stream. diff --git a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp index 1a36efe1330..bfd0344fdcb 100644 --- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp +++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp @@ -314,7 +314,7 @@ FileInfoComparator(gconstpointer a, gconstpointer b) class nsGnomeVFSInputStream MOZ_FINAL : public nsIInputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM nsGnomeVFSInputStream(const nsCString &uriSpec) @@ -631,7 +631,7 @@ nsGnomeVFSInputStream::SetContentTypeOfChannel(const char *contentType) return rv; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsGnomeVFSInputStream, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsGnomeVFSInputStream, nsIInputStream) NS_IMETHODIMP nsGnomeVFSInputStream::Close() diff --git a/extensions/pref/autoconfig/src/nsAutoConfig.cpp b/extensions/pref/autoconfig/src/nsAutoConfig.cpp index ababd93ac67..6b1685cb0d5 100644 --- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp +++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp @@ -33,7 +33,7 @@ extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length, // nsISupports Implementation -NS_IMPL_THREADSAFE_ISUPPORTS6(nsAutoConfig, nsIAutoConfig, nsITimerCallback, nsIStreamListener, nsIObserver, nsIRequestObserver, nsISupportsWeakReference) +NS_IMPL_ISUPPORTS6(nsAutoConfig, nsIAutoConfig, nsITimerCallback, nsIStreamListener, nsIObserver, nsIRequestObserver, nsISupportsWeakReference) nsAutoConfig::nsAutoConfig() { diff --git a/extensions/pref/autoconfig/src/nsAutoConfig.h b/extensions/pref/autoconfig/src/nsAutoConfig.h index 647efbce0a3..150c16a663c 100644 --- a/extensions/pref/autoconfig/src/nsAutoConfig.h +++ b/extensions/pref/autoconfig/src/nsAutoConfig.h @@ -21,7 +21,7 @@ class nsAutoConfig : public nsIAutoConfig, { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIAUTOCONFIG NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER diff --git a/extensions/pref/autoconfig/src/nsReadConfig.cpp b/extensions/pref/autoconfig/src/nsReadConfig.cpp index cf5f354775f..6bc38ea3281 100644 --- a/extensions/pref/autoconfig/src/nsReadConfig.cpp +++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp @@ -73,7 +73,7 @@ static void DisplayError(void) // nsISupports Implementation -NS_IMPL_THREADSAFE_ISUPPORTS2(nsReadConfig, nsIReadConfig, nsIObserver) +NS_IMPL_ISUPPORTS2(nsReadConfig, nsIReadConfig, nsIObserver) nsReadConfig::nsReadConfig() : mRead(false) diff --git a/extensions/pref/autoconfig/src/nsReadConfig.h b/extensions/pref/autoconfig/src/nsReadConfig.h index 16571abebee..52fbcce27f3 100644 --- a/extensions/pref/autoconfig/src/nsReadConfig.h +++ b/extensions/pref/autoconfig/src/nsReadConfig.h @@ -15,7 +15,7 @@ class nsReadConfig : public nsIReadConfig, public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREADCONFIG NS_DECL_NSIOBSERVER From 3913605515ba631ca92cc775ae1f8fb3d0b98d26 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:31 -0500 Subject: [PATCH 31/69] Bug 884061 - Part 3i: Use NS_DECL_THREADSAFE_ISUPPORTS in gfx/, r=roc --HG-- extra : rebase_source : 130357bc9a7ad66cb0574f7bf3ac69e1c3f4a2ff --- gfx/layers/d3d10/ReadbackManagerD3D10.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/layers/d3d10/ReadbackManagerD3D10.cpp b/gfx/layers/d3d10/ReadbackManagerD3D10.cpp index e2523eed5b4..e5d460ed10e 100644 --- a/gfx/layers/d3d10/ReadbackManagerD3D10.cpp +++ b/gfx/layers/d3d10/ReadbackManagerD3D10.cpp @@ -38,7 +38,7 @@ struct ReadbackTask { // destroyed by the main thread. class ReadbackResultWriter MOZ_FINAL : public nsIRunnable { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS public: ReadbackResultWriter(ReadbackTask *aTask) : mTask(aTask) {} @@ -95,7 +95,7 @@ private: nsAutoPtr mTask; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(ReadbackResultWriter, nsIRunnable) +NS_IMPL_ISUPPORTS1(ReadbackResultWriter, nsIRunnable) DWORD WINAPI StartTaskThread(void *aManager) { From bc53f5b85a5e8ded08448f00d48a17ffeadd6d57 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:31 -0500 Subject: [PATCH 32/69] Bug 884061 - Part 3j: Use NS_DECL_THREADSAFE_ISUPPORTS in hal/, r=jlebar --HG-- extra : rebase_source : a3fa50183c82ffaa68a32ce13a314698a4bd495b --- hal/gonk/GonkHal.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hal/gonk/GonkHal.cpp b/hal/gonk/GonkHal.cpp index c6681a64f0a..45a639f57f4 100644 --- a/hal/gonk/GonkHal.cpp +++ b/hal/gonk/GonkHal.cpp @@ -125,7 +125,7 @@ public: os->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSIOBSERVER @@ -150,7 +150,7 @@ private: static bool sShuttingDown; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(VibratorRunnable, nsIRunnable, nsIObserver); +NS_IMPL_ISUPPORTS2(VibratorRunnable, nsIRunnable, nsIObserver); bool VibratorRunnable::sShuttingDown = false; From 5d51157f464c8950cf8834cd08922182465e2016 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:31 -0500 Subject: [PATCH 33/69] Bug 884061 - Part 3k: Use NS_DECL_THREADSAFE_ISUPPORTS in image/, r=joedrew --HG-- extra : rebase_source : f8582736fc5306c441ddcab7a215e16262c6f517 --- image/decoders/icon/mac/nsIconChannel.h | 2 +- image/decoders/icon/mac/nsIconChannelCocoa.mm | 2 +- image/decoders/icon/nsIconURI.cpp | 2 +- image/decoders/icon/nsIconURI.h | 2 +- image/decoders/icon/os2/nsIconChannel.cpp | 2 +- image/decoders/icon/os2/nsIconChannel.h | 2 +- image/decoders/icon/win/nsIconChannel.cpp | 2 +- image/decoders/icon/win/nsIconChannel.h | 2 +- image/encoders/bmp/nsBMPEncoder.cpp | 2 +- image/encoders/bmp/nsBMPEncoder.h | 2 +- image/encoders/ico/nsICOEncoder.cpp | 2 +- image/encoders/ico/nsICOEncoder.h | 2 +- image/encoders/jpeg/nsJPEGEncoder.cpp | 2 +- image/encoders/jpeg/nsJPEGEncoder.h | 2 +- image/encoders/png/nsPNGEncoder.cpp | 2 +- image/encoders/png/nsPNGEncoder.h | 2 +- image/src/RasterImage.cpp | 6 +++--- image/src/RasterImage.h | 4 ++-- 18 files changed, 21 insertions(+), 21 deletions(-) diff --git a/image/decoders/icon/mac/nsIconChannel.h b/image/decoders/icon/mac/nsIconChannel.h index eb251e47bf3..ba35e43a7d7 100644 --- a/image/decoders/icon/mac/nsIconChannel.h +++ b/image/decoders/icon/mac/nsIconChannel.h @@ -24,7 +24,7 @@ class nsIFile; class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUEST NS_DECL_NSICHANNEL NS_DECL_NSIREQUESTOBSERVER diff --git a/image/decoders/icon/mac/nsIconChannelCocoa.mm b/image/decoders/icon/mac/nsIconChannelCocoa.mm index f15c33a3940..adb024a0a8e 100644 --- a/image/decoders/icon/mac/nsIconChannelCocoa.mm +++ b/image/decoders/icon/mac/nsIconChannelCocoa.mm @@ -34,7 +34,7 @@ nsIconChannel::nsIconChannel() nsIconChannel::~nsIconChannel() {} -NS_IMPL_THREADSAFE_ISUPPORTS4(nsIconChannel, +NS_IMPL_ISUPPORTS4(nsIconChannel, nsIChannel, nsIRequest, nsIRequestObserver, diff --git a/image/decoders/icon/nsIconURI.cpp b/image/decoders/icon/nsIconURI.cpp index a229ae3441c..1ba45332f8c 100644 --- a/image/decoders/icon/nsIconURI.cpp +++ b/image/decoders/icon/nsIconURI.cpp @@ -59,7 +59,7 @@ nsMozIconURI::~nsMozIconURI() { } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsMozIconURI, nsIMozIconURI, nsIURI) +NS_IMPL_ISUPPORTS2(nsMozIconURI, nsIMozIconURI, nsIURI) #define MOZICON_SCHEME "moz-icon:" #define MOZICON_SCHEME_LEN (sizeof(MOZICON_SCHEME) - 1) diff --git a/image/decoders/icon/nsIconURI.h b/image/decoders/icon/nsIconURI.h index 6003fa75db8..b72469b7db4 100644 --- a/image/decoders/icon/nsIconURI.h +++ b/image/decoders/icon/nsIconURI.h @@ -22,7 +22,7 @@ class nsMozIconURI : public nsIMozIconURI { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURI NS_DECL_NSIMOZICONURI diff --git a/image/decoders/icon/os2/nsIconChannel.cpp b/image/decoders/icon/os2/nsIconChannel.cpp index e8823cc13ad..b001b958ce8 100644 --- a/image/decoders/icon/os2/nsIconChannel.cpp +++ b/image/decoders/icon/os2/nsIconChannel.cpp @@ -57,7 +57,7 @@ nsIconChannel::nsIconChannel() nsIconChannel::~nsIconChannel() {} -NS_IMPL_THREADSAFE_ISUPPORTS4(nsIconChannel, +NS_IMPL_ISUPPORTS4(nsIconChannel, nsIChannel, nsIRequest, nsIRequestObserver, diff --git a/image/decoders/icon/os2/nsIconChannel.h b/image/decoders/icon/os2/nsIconChannel.h index 7714e6cf37e..b66725847f6 100644 --- a/image/decoders/icon/os2/nsIconChannel.h +++ b/image/decoders/icon/os2/nsIconChannel.h @@ -24,7 +24,7 @@ class nsIFile; class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUEST NS_DECL_NSICHANNEL NS_DECL_NSIREQUESTOBSERVER diff --git a/image/decoders/icon/win/nsIconChannel.cpp b/image/decoders/icon/win/nsIconChannel.cpp index 4c6a08389af..836515554b3 100644 --- a/image/decoders/icon/win/nsIconChannel.cpp +++ b/image/decoders/icon/win/nsIconChannel.cpp @@ -75,7 +75,7 @@ nsIconChannel::nsIconChannel() nsIconChannel::~nsIconChannel() {} -NS_IMPL_THREADSAFE_ISUPPORTS4(nsIconChannel, +NS_IMPL_ISUPPORTS4(nsIconChannel, nsIChannel, nsIRequest, nsIRequestObserver, diff --git a/image/decoders/icon/win/nsIconChannel.h b/image/decoders/icon/win/nsIconChannel.h index 0163da24af1..b805e0e84c7 100644 --- a/image/decoders/icon/win/nsIconChannel.h +++ b/image/decoders/icon/win/nsIconChannel.h @@ -27,7 +27,7 @@ class nsIFile; class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUEST NS_DECL_NSICHANNEL NS_DECL_NSIREQUESTOBSERVER diff --git a/image/encoders/bmp/nsBMPEncoder.cpp b/image/encoders/bmp/nsBMPEncoder.cpp index d27b30b7ece..b9e3025d224 100644 --- a/image/encoders/bmp/nsBMPEncoder.cpp +++ b/image/encoders/bmp/nsBMPEncoder.cpp @@ -13,7 +13,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS3(nsBMPEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) +NS_IMPL_ISUPPORTS3(nsBMPEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) nsBMPEncoder::nsBMPEncoder() : mImageBufferStart(nullptr), mImageBufferCurr(0), diff --git a/image/encoders/bmp/nsBMPEncoder.h b/image/encoders/bmp/nsBMPEncoder.h index 04541666e9b..5989367191e 100644 --- a/image/encoders/bmp/nsBMPEncoder.h +++ b/image/encoders/bmp/nsBMPEncoder.h @@ -25,7 +25,7 @@ class nsBMPEncoder MOZ_FINAL : public imgIEncoder { typedef mozilla::ReentrantMonitor ReentrantMonitor; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_IMGIENCODER NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM diff --git a/image/encoders/ico/nsICOEncoder.cpp b/image/encoders/ico/nsICOEncoder.cpp index 107c4a25217..ad24a5fed79 100644 --- a/image/encoders/ico/nsICOEncoder.cpp +++ b/image/encoders/ico/nsICOEncoder.cpp @@ -15,7 +15,7 @@ using namespace mozilla; using namespace mozilla::image; -NS_IMPL_THREADSAFE_ISUPPORTS3(nsICOEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) +NS_IMPL_ISUPPORTS3(nsICOEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) nsICOEncoder::nsICOEncoder() : mImageBufferStart(nullptr), mImageBufferCurr(0), diff --git a/image/encoders/ico/nsICOEncoder.h b/image/encoders/ico/nsICOEncoder.h index 3836f525072..3d0b55d2dc5 100644 --- a/image/encoders/ico/nsICOEncoder.h +++ b/image/encoders/ico/nsICOEncoder.h @@ -29,7 +29,7 @@ class nsICOEncoder MOZ_FINAL : public imgIEncoder { typedef mozilla::ReentrantMonitor ReentrantMonitor; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_IMGIENCODER NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM diff --git a/image/encoders/jpeg/nsJPEGEncoder.cpp b/image/encoders/jpeg/nsJPEGEncoder.cpp index 9502085dffe..e2fe85688e1 100644 --- a/image/encoders/jpeg/nsJPEGEncoder.cpp +++ b/image/encoders/jpeg/nsJPEGEncoder.cpp @@ -14,7 +14,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS3(nsJPEGEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) +NS_IMPL_ISUPPORTS3(nsJPEGEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) // used to pass error info through the JPEG library struct encoder_error_mgr { diff --git a/image/encoders/jpeg/nsJPEGEncoder.h b/image/encoders/jpeg/nsJPEGEncoder.h index a61b420261c..7ab44c5bfff 100644 --- a/image/encoders/jpeg/nsJPEGEncoder.h +++ b/image/encoders/jpeg/nsJPEGEncoder.h @@ -32,7 +32,7 @@ class nsJPEGEncoder MOZ_FINAL : public imgIEncoder { typedef mozilla::ReentrantMonitor ReentrantMonitor; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_IMGIENCODER NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM diff --git a/image/encoders/png/nsPNGEncoder.cpp b/image/encoders/png/nsPNGEncoder.cpp index 5e87ba1e897..f5df0c3abaf 100644 --- a/image/encoders/png/nsPNGEncoder.cpp +++ b/image/encoders/png/nsPNGEncoder.cpp @@ -11,7 +11,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS3(nsPNGEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) +NS_IMPL_ISUPPORTS3(nsPNGEncoder, imgIEncoder, nsIInputStream, nsIAsyncInputStream) nsPNGEncoder::nsPNGEncoder() : mPNG(nullptr), mPNGinfo(nullptr), mIsAnimation(false), diff --git a/image/encoders/png/nsPNGEncoder.h b/image/encoders/png/nsPNGEncoder.h index 7483a33c633..a7551d0e93a 100644 --- a/image/encoders/png/nsPNGEncoder.h +++ b/image/encoders/png/nsPNGEncoder.h @@ -27,7 +27,7 @@ class nsPNGEncoder MOZ_FINAL : public imgIEncoder { typedef mozilla::ReentrantMonitor ReentrantMonitor; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_IMGIENCODER NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 02afdc7a75e..a1e161e07b8 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -373,9 +373,9 @@ namespace image { static nsCOMPtr sScaleWorkerThread = nullptr; #ifndef DEBUG -NS_IMPL_THREADSAFE_ISUPPORTS2(RasterImage, imgIContainer, nsIProperties) +NS_IMPL_ISUPPORTS2(RasterImage, imgIContainer, nsIProperties) #else -NS_IMPL_THREADSAFE_ISUPPORTS3(RasterImage, imgIContainer, nsIProperties, +NS_IMPL_ISUPPORTS3(RasterImage, imgIContainer, nsIProperties, imgIContainerDebug) #endif @@ -2987,7 +2987,7 @@ RasterImage::FinishedSomeDecoding(eShutdownIntent aIntent /* = eShutdownIntent_D return rv; } -NS_IMPL_THREADSAFE_ISUPPORTS1(RasterImage::DecodePool, +NS_IMPL_ISUPPORTS1(RasterImage::DecodePool, nsIObserver) /* static */ RasterImage::DecodePool* diff --git a/image/src/RasterImage.h b/image/src/RasterImage.h index e35eb4c7906..d70f43f7e1f 100644 --- a/image/src/RasterImage.h +++ b/image/src/RasterImage.h @@ -143,7 +143,7 @@ class RasterImage : public ImageResource #endif { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROPERTIES NS_DECL_IMGICONTAINER #ifdef DEBUG @@ -384,7 +384,7 @@ private: class DecodePool : public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER static DecodePool* Singleton(); From 697b803613f25b15052fa182c1930aed0ecd1880 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:32 -0500 Subject: [PATCH 34/69] Bug 884061 - Part 3l: Use NS_DECL_THREADSAFE_ISUPPORTS in intl/, r=smontagu --HG-- extra : rebase_source : 8dcd2324d945f8f968690ec14d47d63935d35210 --- intl/locale/src/mac/nsDateTimeFormatMac.cpp | 2 +- intl/locale/src/mac/nsDateTimeFormatMac.h | 2 +- intl/locale/src/nsLocale.cpp | 2 +- intl/locale/src/nsLocale.h | 2 +- intl/locale/src/nsLocaleService.cpp | 4 ++-- intl/locale/src/os2/nsDateTimeFormatOS2.cpp | 2 +- intl/locale/src/os2/nsDateTimeFormatOS2.h | 2 +- intl/locale/src/unix/nsAndroidCharset.cpp | 2 +- intl/locale/src/unix/nsDateTimeFormatUnix.cpp | 2 +- intl/locale/src/unix/nsDateTimeFormatUnix.h | 2 +- intl/locale/src/unix/nsUNIXCharset.cpp | 2 +- intl/locale/src/windows/nsDateTimeFormatWin.cpp | 2 +- intl/locale/src/windows/nsDateTimeFormatWin.h | 2 +- intl/strres/src/nsStringBundle.cpp | 11 +++++------ intl/strres/src/nsStringBundle.h | 2 +- intl/strres/src/nsStringBundleService.h | 2 +- intl/uconv/src/nsCharsetConverterManager.cpp | 3 +-- intl/uconv/src/nsCharsetConverterManager.h | 2 +- intl/uconv/util/nsUCSupport.cpp | 8 ++++---- intl/uconv/util/nsUCSupport.h | 2 +- intl/unicharutil/src/nsCaseConversionImp2.cpp | 2 +- intl/unicharutil/src/nsCaseConversionImp2.h | 2 +- intl/unicharutil/src/nsCategoryImp.cpp | 2 +- intl/unicharutil/src/nsCategoryImp.h | 2 +- 24 files changed, 32 insertions(+), 34 deletions(-) diff --git a/intl/locale/src/mac/nsDateTimeFormatMac.cpp b/intl/locale/src/mac/nsDateTimeFormatMac.cpp index 14e3f4aad21..dc4b526cc09 100644 --- a/intl/locale/src/mac/nsDateTimeFormatMac.cpp +++ b/intl/locale/src/mac/nsDateTimeFormatMac.cpp @@ -16,7 +16,7 @@ #include "nsTArray.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTimeFormatMac, nsIDateTimeFormat) +NS_IMPL_ISUPPORTS1(nsDateTimeFormatMac, nsIDateTimeFormat) nsresult nsDateTimeFormatMac::Initialize(nsILocale* locale) { diff --git a/intl/locale/src/mac/nsDateTimeFormatMac.h b/intl/locale/src/mac/nsDateTimeFormatMac.h index 61286524b31..12132d5d9e5 100644 --- a/intl/locale/src/mac/nsDateTimeFormatMac.h +++ b/intl/locale/src/mac/nsDateTimeFormatMac.h @@ -15,7 +15,7 @@ class nsDateTimeFormatMac : public nsIDateTimeFormat { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // performs a locale sensitive date formatting operation on the time_t parameter NS_IMETHOD FormatTime(nsILocale* locale, diff --git a/intl/locale/src/nsLocale.cpp b/intl/locale/src/nsLocale.cpp index c7aa08f0570..8ce7e6b80a4 100644 --- a/intl/locale/src/nsLocale.cpp +++ b/intl/locale/src/nsLocale.cpp @@ -18,7 +18,7 @@ /* nsILocale */ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsLocale, nsILocale) +NS_IMPL_ISUPPORTS1(nsLocale, nsILocale) nsLocale::nsLocale(void) : fHashtable(nullptr), fCategoryCount(0) diff --git a/intl/locale/src/nsLocale.h b/intl/locale/src/nsLocale.h index fe028afdf73..9a73a89f291 100644 --- a/intl/locale/src/nsLocale.h +++ b/intl/locale/src/nsLocale.h @@ -27,7 +27,7 @@ class nsLocale : public nsILocale { friend class nsLocaleService; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS public: nsLocale(void); diff --git a/intl/locale/src/nsLocaleService.cpp b/intl/locale/src/nsLocaleService.cpp index ea613e7e666..12715552804 100644 --- a/intl/locale/src/nsLocaleService.cpp +++ b/intl/locale/src/nsLocaleService.cpp @@ -77,7 +77,7 @@ public: // // nsISupports // - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // // nsILocaleService @@ -251,7 +251,7 @@ nsLocaleService::~nsLocaleService(void) { } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsLocaleService, nsILocaleService) +NS_IMPL_ISUPPORTS1(nsLocaleService, nsILocaleService) NS_IMETHODIMP nsLocaleService::NewLocale(const nsAString &aLocale, nsILocale **_retval) diff --git a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp index 2c5865ea104..b3cc5584c73 100644 --- a/intl/locale/src/os2/nsDateTimeFormatOS2.cpp +++ b/intl/locale/src/os2/nsDateTimeFormatOS2.cpp @@ -5,7 +5,7 @@ #include #include "nsDateTimeFormatOS2.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTimeFormatOS2,nsIDateTimeFormat) +NS_IMPL_ISUPPORTS1(nsDateTimeFormatOS2,nsIDateTimeFormat) #define NSDATETIME_FORMAT_BUFFER_LEN 80 diff --git a/intl/locale/src/os2/nsDateTimeFormatOS2.h b/intl/locale/src/os2/nsDateTimeFormatOS2.h index 2201f780ef2..398707b460f 100644 --- a/intl/locale/src/os2/nsDateTimeFormatOS2.h +++ b/intl/locale/src/os2/nsDateTimeFormatOS2.h @@ -9,7 +9,7 @@ class nsDateTimeFormatOS2 : public nsIDateTimeFormat { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // performs a locale sensitive date formatting operation on the time_t parameter NS_IMETHOD FormatTime(nsILocale* locale, diff --git a/intl/locale/src/unix/nsAndroidCharset.cpp b/intl/locale/src/unix/nsAndroidCharset.cpp index 80e68f21916..c0fee425ce9 100644 --- a/intl/locale/src/unix/nsAndroidCharset.cpp +++ b/intl/locale/src/unix/nsAndroidCharset.cpp @@ -6,7 +6,7 @@ #include "nsIPlatformCharset.h" #include "nsPlatformCharset.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset) +NS_IMPL_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset) nsPlatformCharset::nsPlatformCharset() { diff --git a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp index 864e7f9a836..a1988e6bfc5 100644 --- a/intl/locale/src/unix/nsDateTimeFormatUnix.cpp +++ b/intl/locale/src/unix/nsDateTimeFormatUnix.cpp @@ -15,7 +15,7 @@ #include "nsReadableUtils.h" #include "nsUnicharUtils.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTimeFormatUnix, nsIDateTimeFormat) +NS_IMPL_ISUPPORTS1(nsDateTimeFormatUnix, nsIDateTimeFormat) // init this interface to a specified locale nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale) diff --git a/intl/locale/src/unix/nsDateTimeFormatUnix.h b/intl/locale/src/unix/nsDateTimeFormatUnix.h index 6677afa79f1..a33b32195c0 100644 --- a/intl/locale/src/unix/nsDateTimeFormatUnix.h +++ b/intl/locale/src/unix/nsDateTimeFormatUnix.h @@ -17,7 +17,7 @@ class nsDateTimeFormatUnix : public nsIDateTimeFormat { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // performs a locale sensitive date formatting operation on the time_t parameter NS_IMETHOD FormatTime(nsILocale* locale, diff --git a/intl/locale/src/unix/nsUNIXCharset.cpp b/intl/locale/src/unix/nsUNIXCharset.cpp index c5f7cb1d83a..656c95bb612 100644 --- a/intl/locale/src/unix/nsUNIXCharset.cpp +++ b/intl/locale/src/unix/nsUNIXCharset.cpp @@ -36,7 +36,7 @@ static const char* kUnixCharsets[][3] = { #include "unixcharset.properties.h" }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset) +NS_IMPL_ISUPPORTS1(nsPlatformCharset, nsIPlatformCharset) nsPlatformCharset::nsPlatformCharset() { diff --git a/intl/locale/src/windows/nsDateTimeFormatWin.cpp b/intl/locale/src/windows/nsDateTimeFormatWin.cpp index 1d27115b382..44ddb7d1ec1 100644 --- a/intl/locale/src/windows/nsDateTimeFormatWin.cpp +++ b/intl/locale/src/windows/nsDateTimeFormatWin.cpp @@ -16,7 +16,7 @@ #define NSDATETIMEFORMAT_BUFFER_LEN 80 -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTimeFormatWin, nsIDateTimeFormat) +NS_IMPL_ISUPPORTS1(nsDateTimeFormatWin, nsIDateTimeFormat) // init this interface to a specified locale diff --git a/intl/locale/src/windows/nsDateTimeFormatWin.h b/intl/locale/src/windows/nsDateTimeFormatWin.h index 75bbd317ce4..071011d1028 100644 --- a/intl/locale/src/windows/nsDateTimeFormatWin.h +++ b/intl/locale/src/windows/nsDateTimeFormatWin.h @@ -17,7 +17,7 @@ class nsDateTimeFormatWin : public nsIDateTimeFormat { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // performs a locale sensitive date formatting operation on the time_t parameter NS_IMETHOD FormatTime(nsILocale* locale, diff --git a/intl/strres/src/nsStringBundle.cpp b/intl/strres/src/nsStringBundle.cpp index 5a7a50f7be7..2a27ee1e6b3 100644 --- a/intl/strres/src/nsStringBundle.cpp +++ b/intl/strres/src/nsStringBundle.cpp @@ -198,8 +198,7 @@ nsStringBundle::FormatStringFromName(const PRUnichar *aName, } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsStringBundle, - nsIStringBundle) +NS_IMPL_ISUPPORTS1(nsStringBundle, nsIStringBundle) /* void GetStringFromID (in long aID, out wstring aResult); */ NS_IMETHODIMP @@ -522,10 +521,10 @@ nsStringBundleService::nsStringBundleService() : } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsStringBundleService, - nsIStringBundleService, - nsIObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(nsStringBundleService, + nsIStringBundleService, + nsIObserver, + nsISupportsWeakReference) nsStringBundleService::~nsStringBundleService() { diff --git a/intl/strres/src/nsStringBundle.h b/intl/strres/src/nsStringBundle.h index d7b617bccd7..26b9e376b6a 100644 --- a/intl/strres/src/nsStringBundle.h +++ b/intl/strres/src/nsStringBundle.h @@ -22,7 +22,7 @@ public: nsresult LoadProperties(); virtual ~nsStringBundle(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTRINGBUNDLE nsCOMPtr mProps; diff --git a/intl/strres/src/nsStringBundleService.h b/intl/strres/src/nsStringBundleService.h index c65ca5d4fc9..e429f04f67a 100644 --- a/intl/strres/src/nsStringBundleService.h +++ b/intl/strres/src/nsStringBundleService.h @@ -31,7 +31,7 @@ public: nsresult Init(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTRINGBUNDLESERVICE NS_DECL_NSIOBSERVER diff --git a/intl/uconv/src/nsCharsetConverterManager.cpp b/intl/uconv/src/nsCharsetConverterManager.cpp index f0e2b59f620..b651040e7ad 100644 --- a/intl/uconv/src/nsCharsetConverterManager.cpp +++ b/intl/uconv/src/nsCharsetConverterManager.cpp @@ -31,8 +31,7 @@ static nsIStringBundle * sTitleBundle; // Class nsCharsetConverterManager [implementation] -NS_IMPL_THREADSAFE_ISUPPORTS1(nsCharsetConverterManager, - nsICharsetConverterManager) +NS_IMPL_ISUPPORTS1(nsCharsetConverterManager, nsICharsetConverterManager) nsCharsetConverterManager::nsCharsetConverterManager() { diff --git a/intl/uconv/src/nsCharsetConverterManager.h b/intl/uconv/src/nsCharsetConverterManager.h index 36572bb2703..1b7f77c02b4 100644 --- a/intl/uconv/src/nsCharsetConverterManager.h +++ b/intl/uconv/src/nsCharsetConverterManager.h @@ -17,7 +17,7 @@ class nsCharsetConverterManager : public nsICharsetConverterManager { friend class nsCharsetAlias; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICHARSETCONVERTERMANAGER public: diff --git a/intl/uconv/util/nsUCSupport.cpp b/intl/uconv/util/nsUCSupport.cpp index 7ae3d60ada0..559f4a9a0a4 100644 --- a/intl/uconv/util/nsUCSupport.cpp +++ b/intl/uconv/util/nsUCSupport.cpp @@ -30,11 +30,11 @@ nsBasicDecoderSupport::~nsBasicDecoderSupport() // Interface nsISupports [implementation] #ifdef DEBUG -NS_IMPL_THREADSAFE_ISUPPORTS2(nsBasicDecoderSupport, - nsIUnicodeDecoder, - nsIBasicDecoder) +NS_IMPL_ISUPPORTS2(nsBasicDecoderSupport, + nsIUnicodeDecoder, + nsIBasicDecoder) #else -NS_IMPL_THREADSAFE_ISUPPORTS1(nsBasicDecoderSupport, nsIUnicodeDecoder) +NS_IMPL_ISUPPORTS1(nsBasicDecoderSupport, nsIUnicodeDecoder) #endif //---------------------------------------------------------------------- diff --git a/intl/uconv/util/nsUCSupport.h b/intl/uconv/util/nsUCSupport.h index 7f381458cd7..7047ae32b12 100644 --- a/intl/uconv/util/nsUCSupport.h +++ b/intl/uconv/util/nsUCSupport.h @@ -69,7 +69,7 @@ class nsBasicDecoderSupport : public nsIUnicodeDecoder ,public nsIBasicDecoder #endif { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS public: diff --git a/intl/unicharutil/src/nsCaseConversionImp2.cpp b/intl/unicharutil/src/nsCaseConversionImp2.cpp index 70471c4fbf5..00f12839055 100644 --- a/intl/unicharutil/src/nsCaseConversionImp2.cpp +++ b/intl/unicharutil/src/nsCaseConversionImp2.cpp @@ -16,7 +16,7 @@ NS_IMETHODIMP_(nsrefcnt) nsCaseConversionImp2::Release(void) return (nsrefcnt)1; } -NS_IMPL_THREADSAFE_QUERY_INTERFACE1(nsCaseConversionImp2, nsICaseConversion) +NS_IMPL_QUERY_INTERFACE1(nsCaseConversionImp2, nsICaseConversion) NS_IMETHODIMP nsCaseConversionImp2::ToUpper(PRUnichar aChar, PRUnichar* aReturn) { diff --git a/intl/unicharutil/src/nsCaseConversionImp2.h b/intl/unicharutil/src/nsCaseConversionImp2.h index d0dccd1ce9e..0b1413735f1 100644 --- a/intl/unicharutil/src/nsCaseConversionImp2.h +++ b/intl/unicharutil/src/nsCaseConversionImp2.h @@ -12,7 +12,7 @@ #include "nsICaseConversion.h" class nsCaseConversionImp2 : public nsICaseConversion { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS public: virtual ~nsCaseConversionImp2() { } diff --git a/intl/unicharutil/src/nsCategoryImp.cpp b/intl/unicharutil/src/nsCategoryImp.cpp index 5b29a940adc..2bcf963ee50 100644 --- a/intl/unicharutil/src/nsCategoryImp.cpp +++ b/intl/unicharutil/src/nsCategoryImp.cpp @@ -10,7 +10,7 @@ static nsCategoryImp gCategoryImp; -NS_IMPL_THREADSAFE_QUERY_INTERFACE1(nsCategoryImp, nsIUGenCategory) +NS_IMPL_QUERY_INTERFACE1(nsCategoryImp, nsIUGenCategory) NS_IMETHODIMP_(nsrefcnt) nsCategoryImp::AddRef(void) { diff --git a/intl/unicharutil/src/nsCategoryImp.h b/intl/unicharutil/src/nsCategoryImp.h index 51aefcf1eb4..913d5481d48 100644 --- a/intl/unicharutil/src/nsCategoryImp.h +++ b/intl/unicharutil/src/nsCategoryImp.h @@ -8,7 +8,7 @@ #include "nsIUGenCategory.h" class nsCategoryImp : public nsIUGenCategory { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS public: static nsCategoryImp* GetInstance(); From 48de6321af3e02925dcf28dc52accfd6d7156012 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:32 -0500 Subject: [PATCH 35/69] Bug 884061 - Part 3m: Use NS_DECL_THREADSAFE_ISUPPORTS in ipc/, r=bent --HG-- extra : rebase_source : 77f707d086624cc908a4e39935aa2a03f16543fb --- ipc/glue/FileDescriptorUtils.cpp | 2 +- ipc/glue/FileDescriptorUtils.h | 2 +- ipc/glue/MessagePump.cpp | 2 +- ipc/glue/MessagePump.h | 2 +- ipc/glue/RPCChannel.h | 15 ++++----------- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/ipc/glue/FileDescriptorUtils.cpp b/ipc/glue/FileDescriptorUtils.cpp index 150354c2ba4..dbd390c6e35 100644 --- a/ipc/glue/FileDescriptorUtils.cpp +++ b/ipc/glue/FileDescriptorUtils.cpp @@ -36,7 +36,7 @@ CloseFileRunnable::~CloseFileRunnable() } } -NS_IMPL_THREADSAFE_ISUPPORTS1(CloseFileRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(CloseFileRunnable, nsIRunnable) void CloseFileRunnable::Dispatch() diff --git a/ipc/glue/FileDescriptorUtils.h b/ipc/glue/FileDescriptorUtils.h index 4cabd06ae40..81a9ae178cf 100644 --- a/ipc/glue/FileDescriptorUtils.h +++ b/ipc/glue/FileDescriptorUtils.h @@ -31,7 +31,7 @@ public: { } #endif - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE void Dispatch(); diff --git a/ipc/glue/MessagePump.cpp b/ipc/glue/MessagePump.cpp index e392b0ec279..3aecb768d87 100644 --- a/ipc/glue/MessagePump.cpp +++ b/ipc/glue/MessagePump.cpp @@ -23,7 +23,7 @@ using mozilla::ipc::MessagePump; using mozilla::ipc::MessagePumpForChildProcess; using base::TimeTicks; -NS_IMPL_THREADSAFE_ISUPPORTS2(DoWorkRunnable, nsIRunnable, nsITimerCallback) +NS_IMPL_ISUPPORTS2(DoWorkRunnable, nsIRunnable, nsITimerCallback) NS_IMETHODIMP DoWorkRunnable::Run() diff --git a/ipc/glue/MessagePump.h b/ipc/glue/MessagePump.h index 68954cca5b5..c447f7ab7bb 100644 --- a/ipc/glue/MessagePump.h +++ b/ipc/glue/MessagePump.h @@ -29,7 +29,7 @@ public: DoWorkRunnable(MessagePump* aPump) : mPump(aPump) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSITIMERCALLBACK diff --git a/ipc/glue/RPCChannel.h b/ipc/glue/RPCChannel.h index 13ef0764878..d848722817c 100644 --- a/ipc/glue/RPCChannel.h +++ b/ipc/glue/RPCChannel.h @@ -15,7 +15,7 @@ #include "base/basictypes.h" -#include "nsAtomicRefcnt.h" +#include "nsISupportsImpl.h" #include "mozilla/ipc/SyncChannel.h" #include "nsAutoPtr.h" @@ -392,22 +392,15 @@ private: { public: RefCountedTask(CancelableTask* aTask) - : mTask(aTask) - , mRefCnt(0) {} + : mTask(aTask) {} ~RefCountedTask() { delete mTask; } void Run() { mTask->Run(); } void Cancel() { mTask->Cancel(); } - void AddRef() { - NS_AtomicIncrementRefcnt(mRefCnt); - } - void Release() { - if (NS_AtomicDecrementRefcnt(mRefCnt) == 0) - delete this; - } + + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RefCountedTask) private: CancelableTask* mTask; - nsrefcnt mRefCnt; }; // From 918e4b37e52eab09f28d936e25a6667e6fec4b86 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:32 -0500 Subject: [PATCH 36/69] Bug 884061 - Part 3n: Use NS_DECL_THREADSAFE_ISUPPORTS in js/, r=bholley --HG-- extra : rebase_source : 4f888058e3f842affd496e35bdd3c2037d1abf43 --- js/jsd/jsd_xpc.cpp | 20 ++--- js/jsd/jsd_xpc.h | 16 ++-- js/xpconnect/loader/mozJSSubScriptLoader.cpp | 2 +- js/xpconnect/loader/mozJSSubScriptLoader.h | 2 +- js/xpconnect/public/SandboxPrivate.h | 4 +- js/xpconnect/src/BackstagePass.h | 2 +- js/xpconnect/src/XPCComponents.cpp | 78 ++++++++++---------- js/xpconnect/src/XPCException.cpp | 4 +- js/xpconnect/src/XPCJSID.cpp | 16 ++-- js/xpconnect/src/XPCJSRuntime.cpp | 4 +- js/xpconnect/src/XPCRuntimeService.cpp | 4 +- js/xpconnect/src/XPCStack.cpp | 4 +- js/xpconnect/src/XPCWrappedJS.cpp | 4 +- js/xpconnect/src/XPCWrappedJSClass.cpp | 2 +- js/xpconnect/src/XPCWrappedNative.cpp | 6 +- js/xpconnect/src/nsScriptError.cpp | 2 +- js/xpconnect/src/nsXPConnect.cpp | 12 +-- js/xpconnect/src/xpcprivate.h | 22 +++--- 18 files changed, 102 insertions(+), 102 deletions(-) diff --git a/js/jsd/jsd_xpc.cpp b/js/jsd/jsd_xpc.cpp index 2a6301400d2..b43de25c61a 100644 --- a/js/jsd/jsd_xpc.cpp +++ b/js/jsd/jsd_xpc.cpp @@ -738,7 +738,7 @@ jsds_ScriptHookProc (JSDContext* jsdc, JSDScript* jsdscript, JSBool creating, /* Contexts */ /* -NS_IMPL_THREADSAFE_ISUPPORTS2(jsdContext, jsdIContext, jsdIEphemeral); +NS_IMPL_ISUPPORTS2(jsdContext, jsdIContext, jsdIEphemeral); NS_IMETHODIMP jsdContext::GetJSDContext(JSDContext **_rval) @@ -749,7 +749,7 @@ jsdContext::GetJSDContext(JSDContext **_rval) */ /* Objects */ -NS_IMPL_THREADSAFE_ISUPPORTS1(jsdObject, jsdIObject) +NS_IMPL_ISUPPORTS1(jsdObject, jsdIObject) NS_IMETHODIMP jsdObject::GetJSDContext(JSDContext **_rval) @@ -803,7 +803,7 @@ jsdObject::GetValue(jsdIValue **_rval) } /* Properties */ -NS_IMPL_THREADSAFE_ISUPPORTS2(jsdProperty, jsdIProperty, jsdIEphemeral) +NS_IMPL_ISUPPORTS2(jsdProperty, jsdIProperty, jsdIEphemeral) jsdProperty::jsdProperty (JSDContext *aCx, JSDProperty *aProperty) : mCx(aCx), mProperty(aProperty) @@ -894,7 +894,7 @@ jsdProperty::GetValue(jsdIValue **_rval) } /* Scripts */ -NS_IMPL_THREADSAFE_ISUPPORTS2(jsdScript, jsdIScript, jsdIEphemeral) +NS_IMPL_ISUPPORTS2(jsdScript, jsdIScript, jsdIEphemeral) static NS_IMETHODIMP AssignToJSString(JSDContext *aCx, nsACString *x, JSString *str) @@ -1551,7 +1551,7 @@ jsdScript::ClearAllBreakpoints() } /* Contexts */ -NS_IMPL_THREADSAFE_ISUPPORTS2(jsdContext, jsdIContext, jsdIEphemeral) +NS_IMPL_ISUPPORTS2(jsdContext, jsdIContext, jsdIEphemeral) jsdIContext * jsdContext::FromPtr (JSDContext *aJSDCx, JSContext *aJSCx) @@ -1743,7 +1743,7 @@ jsdContext::SetScriptsEnabled (bool _rval) } /* Stack Frames */ -NS_IMPL_THREADSAFE_ISUPPORTS2(jsdStackFrame, jsdIStackFrame, jsdIEphemeral) +NS_IMPL_ISUPPORTS2(jsdStackFrame, jsdIStackFrame, jsdIEphemeral) jsdStackFrame::jsdStackFrame (JSDContext *aCx, JSDThreadState *aThreadState, JSDStackFrameInfo *aStackFrameInfo) : @@ -2015,7 +2015,7 @@ jsdStackFrame::Eval (const nsAString &bytes, const nsACString &fileName, } /* Values */ -NS_IMPL_THREADSAFE_ISUPPORTS2(jsdValue, jsdIValue, jsdIEphemeral) +NS_IMPL_ISUPPORTS2(jsdValue, jsdIValue, jsdIEphemeral) jsdIValue * jsdValue::FromPtr (JSDContext *aCx, JSDValue *aValue) { @@ -3267,13 +3267,13 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(jsdService, jsdService::GetService) class jsdASObserver MOZ_FINAL : public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER jsdASObserver () {} }; -NS_IMPL_THREADSAFE_ISUPPORTS1(jsdASObserver, nsIObserver) +NS_IMPL_ISUPPORTS1(jsdASObserver, nsIObserver) NS_IMETHODIMP jsdASObserver::Observe (nsISupports *aSubject, const char *aTopic, @@ -3369,7 +3369,7 @@ CreateJSDGlobal(JSContext *aCx, JSClass *aClasp) #if 0 /* Thread States */ -NS_IMPL_THREADSAFE_ISUPPORTS1(jsdThreadState, jsdIThreadState); +NS_IMPL_ISUPPORTS1(jsdThreadState, jsdIThreadState); NS_IMETHODIMP jsdThreadState::GetJSDContext(JSDContext **_rval) diff --git a/js/jsd/jsd_xpc.h b/js/jsd/jsd_xpc.h index 4dbfe7cab40..f114eaffce7 100644 --- a/js/jsd/jsd_xpc.h +++ b/js/jsd/jsd_xpc.h @@ -37,7 +37,7 @@ struct PCMapEntry { class jsdObject MOZ_FINAL : public jsdIObject { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDIOBJECT /* you'll normally use use FromPtr() instead of directly constructing one */ @@ -69,7 +69,7 @@ class jsdObject MOZ_FINAL : public jsdIObject class jsdProperty : public jsdIProperty { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDIPROPERTY NS_DECL_JSDIEPHEMERAL @@ -102,7 +102,7 @@ class jsdProperty : public jsdIProperty class jsdScript : public jsdIScript { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDISCRIPT NS_DECL_JSDIEPHEMERAL @@ -159,7 +159,7 @@ uint32_t jsdScript::LastTag = 0; class jsdContext : public jsdIContext { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDICONTEXT NS_DECL_JSDIEPHEMERAL @@ -187,7 +187,7 @@ uint32_t jsdContext::LastTag = 0; class jsdStackFrame : public jsdIStackFrame { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDISTACKFRAME NS_DECL_JSDIEPHEMERAL @@ -215,7 +215,7 @@ class jsdStackFrame : public jsdIStackFrame class jsdValue : public jsdIValue { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDIVALUE NS_DECL_JSDIEPHEMERAL @@ -294,7 +294,7 @@ class jsdService : public jsdIDebuggerService class jsdContext : public jsdIContext { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDICONTEXT /* you'll normally use use FromPtr() instead of directly constructing one */ @@ -334,7 +334,7 @@ class jsdContext : public jsdIContext class jsdThreadState : public jsdIThreadState { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_JSDITHREADSTATE /* you'll normally use use FromPtr() instead of directly constructing one */ diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp index 99ac615a04a..5ba824ebdf8 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -62,7 +62,7 @@ mozJSSubScriptLoader::~mozJSSubScriptLoader() /* empty */ } -NS_IMPL_THREADSAFE_ISUPPORTS1(mozJSSubScriptLoader, mozIJSSubScriptLoader) +NS_IMPL_ISUPPORTS1(mozJSSubScriptLoader, mozIJSSubScriptLoader) static nsresult ReportError(JSContext *cx, const char *msg) diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.h b/js/xpconnect/loader/mozJSSubScriptLoader.h index ab384df9e5d..58476754d56 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.h +++ b/js/xpconnect/loader/mozJSSubScriptLoader.h @@ -26,7 +26,7 @@ public: virtual ~mozJSSubScriptLoader(); // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZIJSSUBSCRIPTLOADER private: diff --git a/js/xpconnect/public/SandboxPrivate.h b/js/xpconnect/public/SandboxPrivate.h index c2757e4daf2..5a35919d00e 100644 --- a/js/xpconnect/public/SandboxPrivate.h +++ b/js/xpconnect/public/SandboxPrivate.h @@ -23,7 +23,7 @@ public: } virtual ~SandboxPrivate() { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsIPrincipal *GetPrincipal() { @@ -44,4 +44,4 @@ private: JSObject *mGlobalJSObject; }; -#endif // __SANDBOXPRIVATE_H__ \ No newline at end of file +#endif // __SANDBOXPRIVATE_H__ diff --git a/js/xpconnect/src/BackstagePass.h b/js/xpconnect/src/BackstagePass.h index eab2c3c2a75..f3f8ed78a55 100644 --- a/js/xpconnect/src/BackstagePass.h +++ b/js/xpconnect/src/BackstagePass.h @@ -16,7 +16,7 @@ class BackstagePass : public nsIGlobalObject, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index fac7ba88258..31ff8893748 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -108,7 +108,7 @@ class nsXPCComponents_Interfaces : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_INTERFACES NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -232,8 +232,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Interfaces) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Interfaces) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_Interfaces) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_Interfaces) +NS_IMPL_ADDREF(nsXPCComponents_Interfaces) +NS_IMPL_RELEASE(nsXPCComponents_Interfaces) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_Interfaces @@ -394,7 +394,7 @@ class nsXPCComponents_InterfacesByID : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_INTERFACESBYID NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -518,8 +518,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_InterfacesByID) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_InterfacesByID) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_InterfacesByID) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_InterfacesByID) +NS_IMPL_ADDREF(nsXPCComponents_InterfacesByID) +NS_IMPL_RELEASE(nsXPCComponents_InterfacesByID) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_InterfacesByID @@ -688,7 +688,7 @@ class nsXPCComponents_Classes : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_CLASSES NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -806,8 +806,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Classes) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Classes) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_Classes) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_Classes) +NS_IMPL_ADDREF(nsXPCComponents_Classes) +NS_IMPL_RELEASE(nsXPCComponents_Classes) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_Classes @@ -929,7 +929,7 @@ class nsXPCComponents_ClassesByID : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_CLASSESBYID NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -1047,8 +1047,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_ClassesByID) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_ClassesByID) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_ClassesByID) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_ClassesByID) +NS_IMPL_ADDREF(nsXPCComponents_ClassesByID) +NS_IMPL_RELEASE(nsXPCComponents_ClassesByID) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_ClassesByID @@ -1192,7 +1192,7 @@ class nsXPCComponents_Results : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_RESULTS NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -1310,8 +1310,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Results) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Results) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_Results) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_Results) +NS_IMPL_ADDREF(nsXPCComponents_Results) +NS_IMPL_RELEASE(nsXPCComponents_Results) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_Results @@ -1408,7 +1408,7 @@ class nsXPCComponents_ID : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_ID NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -1532,8 +1532,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_ID) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_ID) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_ID) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_ID) +NS_IMPL_ADDREF(nsXPCComponents_ID) +NS_IMPL_RELEASE(nsXPCComponents_ID) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_ID @@ -1627,7 +1627,7 @@ class nsXPCComponents_Exception : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_EXCEPTION NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -1751,8 +1751,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Exception) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Exception) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_Exception) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_Exception) +NS_IMPL_ADDREF(nsXPCComponents_Exception) +NS_IMPL_RELEASE(nsXPCComponents_Exception) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_Exception @@ -2007,7 +2007,7 @@ public: NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCCONSTRUCTOR_CID) public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCONSTRUCTOR NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -2170,8 +2170,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCConstructor) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCConstructor) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCConstructor) -NS_IMPL_THREADSAFE_RELEASE(nsXPCConstructor) +NS_IMPL_ADDREF(nsXPCConstructor) +NS_IMPL_RELEASE(nsXPCConstructor) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCConstructor @@ -2269,7 +2269,7 @@ class nsXPCComponents_Constructor : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_CONSTRUCTOR NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -2392,8 +2392,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Constructor) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Constructor) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_Constructor) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_Constructor) +NS_IMPL_ADDREF(nsXPCComponents_Constructor) +NS_IMPL_RELEASE(nsXPCComponents_Constructor) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_Constructor @@ -2592,7 +2592,7 @@ class nsXPCComponents_utils_Sandbox : public nsIXPCComponents_utils_Sandbox, { public: // Aren't macros nice? - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS_UTILS_SANDBOX NS_DECL_NSIXPCSCRIPTABLE @@ -2613,7 +2613,7 @@ class nsXPCComponents_Utils : { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSISECURITYCHECKEDCOMPONENT NS_DECL_NSIXPCCOMPONENTS_UTILS @@ -2633,8 +2633,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Utils) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Utils) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_Utils) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_Utils) +NS_IMPL_ADDREF(nsXPCComponents_Utils) +NS_IMPL_RELEASE(nsXPCComponents_Utils) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME nsXPCComponents_Utils @@ -2795,10 +2795,10 @@ nsXPCComponents_Utils::ReportError(const JS::Value &errorArg, JSContext *cx) #include "nsNetUtil.h" const char kScriptSecurityManagerContractID[] = NS_SCRIPTSECURITYMANAGER_CONTRACTID; -NS_IMPL_THREADSAFE_ISUPPORTS3(SandboxPrivate, - nsIScriptObjectPrincipal, - nsIGlobalObject, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(SandboxPrivate, + nsIScriptObjectPrincipal, + nsIGlobalObject, + nsISupportsWeakReference) static JSBool SandboxDump(JSContext *cx, unsigned argc, jsval *vp) @@ -3000,8 +3000,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents_utils_Sandbox) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_utils_Sandbox) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents_utils_Sandbox) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents_utils_Sandbox) +NS_IMPL_ADDREF(nsXPCComponents_utils_Sandbox) +NS_IMPL_RELEASE(nsXPCComponents_utils_Sandbox) // We use the nsIXPScriptable macros to generate lots of stuff for us. #define XPC_MAP_CLASSNAME nsXPCComponents_utils_Sandbox @@ -4556,8 +4556,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCComponents) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCComponents) -NS_IMPL_THREADSAFE_RELEASE(nsXPCComponents) +NS_IMPL_ADDREF(nsXPCComponents) +NS_IMPL_RELEASE(nsXPCComponents) /* void getInterfaces (out uint32_t count, [array, size_is (count), retval] out nsIIDPtr array); */ diff --git a/js/xpconnect/src/XPCException.cpp b/js/xpconnect/src/XPCException.cpp index a0b48c20ff1..0e593ad2d63 100644 --- a/js/xpconnect/src/XPCException.cpp +++ b/js/xpconnect/src/XPCException.cpp @@ -91,8 +91,8 @@ NS_INTERFACE_MAP_BEGIN(nsXPCException) NS_IMPL_QUERY_CLASSINFO(nsXPCException) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsXPCException) -NS_IMPL_THREADSAFE_RELEASE(nsXPCException) +NS_IMPL_ADDREF(nsXPCException) +NS_IMPL_RELEASE(nsXPCException) NS_IMPL_CI_INTERFACE_GETTER1(nsXPCException, nsIXPCException) diff --git a/js/xpconnect/src/XPCJSID.cpp b/js/xpconnect/src/XPCJSID.cpp index c50e8b548ef..dab373a2fc1 100644 --- a/js/xpconnect/src/XPCJSID.cpp +++ b/js/xpconnect/src/XPCJSID.cpp @@ -19,7 +19,7 @@ using namespace JS; /***************************************************************************/ // nsJSID -NS_IMPL_THREADSAFE_ISUPPORTS1(nsJSID, nsIJSID) +NS_IMPL_ISUPPORTS1(nsJSID, nsIJSID) char nsJSID::gNoString[] = ""; @@ -212,7 +212,7 @@ nsJSID::NewID(const nsID& id) class SharedScriptableHelperForJSIID MOZ_FINAL : public nsIXPCScriptable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCSCRIPTABLE SharedScriptableHelperForJSIID() {} }; @@ -222,8 +222,8 @@ NS_INTERFACE_MAP_BEGIN(SharedScriptableHelperForJSIID) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCScriptable) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(SharedScriptableHelperForJSIID) -NS_IMPL_THREADSAFE_RELEASE(SharedScriptableHelperForJSIID) +NS_IMPL_ADDREF(SharedScriptableHelperForJSIID) +NS_IMPL_RELEASE(SharedScriptableHelperForJSIID) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME SharedScriptableHelperForJSIID @@ -292,8 +292,8 @@ NS_INTERFACE_MAP_BEGIN(nsJSIID) NS_IMPL_QUERY_CLASSINFO(nsJSIID) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsJSIID) -NS_IMPL_THREADSAFE_RELEASE(nsJSIID) +NS_IMPL_ADDREF(nsJSIID) +NS_IMPL_RELEASE(nsJSIID) NS_IMPL_CI_INTERFACE_GETTER2(nsJSIID, nsIJSID, nsIJSIID) // The nsIXPCScriptable map declaration that will generate stubs for us... @@ -610,8 +610,8 @@ NS_INTERFACE_MAP_BEGIN(nsJSCID) NS_IMPL_QUERY_CLASSINFO(nsJSCID) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(nsJSCID) -NS_IMPL_THREADSAFE_RELEASE(nsJSCID) +NS_IMPL_ADDREF(nsJSCID) +NS_IMPL_RELEASE(nsJSCID) NS_IMPL_CI_INTERFACE_GETTER2(nsJSCID, nsIJSID, nsIJSCID) // The nsIXPCScriptable map declaration that will generate stubs for us... diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 63d87206feb..955a909c38e 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1948,7 +1948,7 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats, class JSCompartmentsMultiReporter MOZ_FINAL : public nsIMemoryMultiReporter { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD GetName(nsACString &name) { name.AssignLiteral("compartments"); @@ -1994,7 +1994,7 @@ class JSCompartmentsMultiReporter MOZ_FINAL : public nsIMemoryMultiReporter } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(JSCompartmentsMultiReporter +NS_IMPL_ISUPPORTS1(JSCompartmentsMultiReporter , nsIMemoryMultiReporter ) diff --git a/js/xpconnect/src/XPCRuntimeService.cpp b/js/xpconnect/src/XPCRuntimeService.cpp index aef22cadb4a..6e3644610d3 100644 --- a/js/xpconnect/src/XPCRuntimeService.cpp +++ b/js/xpconnect/src/XPCRuntimeService.cpp @@ -21,8 +21,8 @@ NS_INTERFACE_MAP_BEGIN(BackstagePass) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCScriptable) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(BackstagePass) -NS_IMPL_THREADSAFE_RELEASE(BackstagePass) +NS_IMPL_ADDREF(BackstagePass) +NS_IMPL_RELEASE(BackstagePass) // The nsIXPCScriptable map declaration that will generate stubs for us... #define XPC_MAP_CLASSNAME BackstagePass diff --git a/js/xpconnect/src/XPCStack.cpp b/js/xpconnect/src/XPCStack.cpp index db3055618d1..1e79a216014 100644 --- a/js/xpconnect/src/XPCStack.cpp +++ b/js/xpconnect/src/XPCStack.cpp @@ -11,7 +11,7 @@ class XPCJSStackFrame : public nsIStackFrame { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTACKFRAME static nsresult CreateStack(JSContext* cx, XPCJSStackFrame** stack); @@ -87,7 +87,7 @@ XPCJSStackFrame::~XPCJSStackFrame() nsMemory::Free(mFunname); } -NS_IMPL_THREADSAFE_ISUPPORTS1(XPCJSStackFrame, nsIStackFrame) +NS_IMPL_ISUPPORTS1(XPCJSStackFrame, nsIStackFrame) nsresult XPCJSStackFrame::CreateStack(JSContext* cx, XPCJSStackFrame** stack) diff --git a/js/xpconnect/src/XPCWrappedJS.cpp b/js/xpconnect/src/XPCWrappedJS.cpp index 3c135ec0587..51baf3ba2db 100644 --- a/js/xpconnect/src/XPCWrappedJS.cpp +++ b/js/xpconnect/src/XPCWrappedJS.cpp @@ -157,7 +157,7 @@ nsXPCWrappedJS::AddRef(void) { if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread())) MOZ_CRASH(); - nsrefcnt cnt = NS_AtomicIncrementRefcnt(mRefCnt); + nsrefcnt cnt = ++mRefCnt; NS_LOG_ADDREF(this, cnt, "nsXPCWrappedJS", sizeof(*this)); if (2 == cnt && IsValid()) { @@ -197,7 +197,7 @@ nsXPCWrappedJS::Release(void) do_decrement: - nsrefcnt cnt = NS_AtomicDecrementRefcnt(mRefCnt); + nsrefcnt cnt = --mRefCnt; NS_LOG_RELEASE(this, cnt, "nsXPCWrappedJS"); if (0 == cnt) { diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 25fe6290efe..6c89b17c5b1 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -21,7 +21,7 @@ using namespace xpc; using namespace JS; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsXPCWrappedJSClass, nsIXPCWrappedJSClass) +NS_IMPL_ISUPPORTS1(nsXPCWrappedJSClass, nsIXPCWrappedJSClass) // the value of this variable is never used - we use its address as a sentinel static uint32_t zero_methods_descriptor; diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 2b2f3097881..c7cadeb337d 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -1075,8 +1075,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(XPCWrappedNative) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPConnectWrappedNative) NS_INTERFACE_MAP_END_THREADSAFE -NS_IMPL_THREADSAFE_ADDREF(XPCWrappedNative) -NS_IMPL_THREADSAFE_RELEASE(XPCWrappedNative) +NS_IMPL_ADDREF(XPCWrappedNative) +NS_IMPL_RELEASE(XPCWrappedNative) /* * Wrapped Native lifetime management is messy! @@ -3379,7 +3379,7 @@ void DEBUG_ReportShadowedMembers(XPCNativeSet* set, } #endif -NS_IMPL_THREADSAFE_ISUPPORTS1(XPCJSObjectHolder, nsIXPConnectJSObjectHolder) +NS_IMPL_ISUPPORTS1(XPCJSObjectHolder, nsIXPConnectJSObjectHolder) JSObject* XPCJSObjectHolder::GetJSObject() diff --git a/js/xpconnect/src/nsScriptError.cpp b/js/xpconnect/src/nsScriptError.cpp index 980643ef23e..4be5d52585b 100644 --- a/js/xpconnect/src/nsScriptError.cpp +++ b/js/xpconnect/src/nsScriptError.cpp @@ -14,7 +14,7 @@ #include "nsILoadContext.h" #include "nsIDocShell.h" -NS_IMPL_THREADSAFE_ISUPPORTS2(nsScriptError, nsIConsoleMessage, nsIScriptError) +NS_IMPL_ISUPPORTS2(nsScriptError, nsIConsoleMessage, nsIScriptError) nsScriptError::nsScriptError() : mMessage(), diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index 30a2f5445b9..eb4e90759b7 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -54,12 +54,12 @@ using namespace mozilla::dom; using namespace xpc; using namespace JS; -NS_IMPL_THREADSAFE_ISUPPORTS5(nsXPConnect, - nsIXPConnect, - nsISupportsWeakReference, - nsIThreadObserver, - nsIJSRuntimeService, - nsIJSEngineTelemetryStats) +NS_IMPL_ISUPPORTS5(nsXPConnect, + nsIXPConnect, + nsISupportsWeakReference, + nsIThreadObserver, + nsIJSRuntimeService, + nsIJSEngineTelemetryStats) nsXPConnect* nsXPConnect::gSelf = nullptr; JSBool nsXPConnect::gOnceAliveNowDead = false; diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 57ec58efea5..e3e89e8067d 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -439,7 +439,7 @@ class nsXPConnect : public nsIXPConnect, { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCONNECT NS_DECL_NSITHREADOBSERVER NS_DECL_NSIJSRUNTIMESERVICE @@ -2228,7 +2228,7 @@ void *xpc_GetJSPrivate(JSObject *obj); class XPCWrappedNative : public nsIXPConnectWrappedNative { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCONNECTJSOBJECTHOLDER NS_DECL_NSIXPCONNECTWRAPPEDNATIVE // No need to unlink the JS objects, if the XPCWrappedNative will be cycle @@ -2618,7 +2618,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIXPCWrappedJSClass, class nsXPCWrappedJSClass : public nsIXPCWrappedJSClass { // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD DebugDump(int16_t depth); public: @@ -2715,7 +2715,7 @@ class nsXPCWrappedJS : protected nsAutoXPTCStub, public XPCRootSetElem { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCONNECTJSOBJECTHOLDER NS_DECL_NSIXPCONNECTWRAPPEDJS NS_DECL_NSISUPPORTSWEAKREFERENCE @@ -2812,7 +2812,7 @@ class XPCJSObjectHolder : public nsIXPConnectJSObjectHolder, { public: // all the interface method declarations... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCONNECTJSOBJECTHOLDER // non-interface implementation @@ -3026,7 +3026,7 @@ class nsXPCException : public: NS_DEFINE_STATIC_CID_ACCESSOR(NS_XPCEXCEPTION_CID) - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEXCEPTION NS_DECL_NSIXPCEXCEPTION @@ -3085,7 +3085,7 @@ class nsJSID : public nsIJSID public: NS_DEFINE_STATIC_CID_ACCESSOR(NS_JS_ID_CID) - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIJSID bool InitWithName(const nsID& id, const char *nameString); @@ -3120,7 +3120,7 @@ class nsJSIID : public nsIJSIID, public nsISecurityCheckedComponent { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // we manually delagate these to nsJSID NS_DECL_NSIJSID @@ -3145,7 +3145,7 @@ private: class nsJSCID : public nsIJSCID, public nsIXPCScriptable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // we manually delagate these to nsJSID NS_DECL_NSIJSID @@ -3243,7 +3243,7 @@ class nsXPCComponents : public nsIXPCComponents, public nsISecurityCheckedComponent { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIXPCCOMPONENTS NS_DECL_NSIXPCSCRIPTABLE NS_DECL_NSICLASSINFO @@ -3319,7 +3319,7 @@ public: // TODO - do something reasonable on getting null from these babies. - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICONSOLEMESSAGE NS_DECL_NSISCRIPTERROR From 96a1370053db028ff891230afd7acd523d460c50 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:32 -0500 Subject: [PATCH 37/69] Bug 884061 - Part 3o: Use NS_DECL_THREADSAFE_ISUPPORTS in media/, r=abr --HG-- extra : rebase_source : cdad785f54f50c012ea4f904369b120656c68a55 --- media/mtransport/nr_socket_prsock.cpp | 2 +- media/mtransport/nr_socket_prsock.h | 2 +- media/mtransport/nr_timer.cpp | 6 +++--- media/mtransport/nriceresolver.cpp | 2 +- media/mtransport/nriceresolver.h | 2 +- media/mtransport/test/sctp_unittest.cpp | 4 ++-- media/mtransport/transportlayerloopback.cpp | 3 +-- media/mtransport/transportlayerloopback.h | 2 +- media/mtransport/transportlayerprsock.cpp | 2 +- media/mtransport/transportlayerprsock.h | 2 +- .../signaling/src/peerconnection/PeerConnectionImpl.cpp | 2 +- .../signaling/src/peerconnection/PeerConnectionImpl.h | 2 +- media/webrtc/signaling/test/FakeMediaStreams.h | 4 ++-- media/webrtc/signaling/test/FakeMediaStreamsImpl.h | 4 ++-- media/webrtc/signaling/test/signaling_unittests.cpp | 8 ++++---- 15 files changed, 23 insertions(+), 24 deletions(-) diff --git a/media/mtransport/nr_socket_prsock.cpp b/media/mtransport/nr_socket_prsock.cpp index 86820a02bef..101c925fafe 100644 --- a/media/mtransport/nr_socket_prsock.cpp +++ b/media/mtransport/nr_socket_prsock.cpp @@ -116,7 +116,7 @@ extern "C" { // Implement the nsISupports ref counting namespace mozilla { -NS_IMPL_THREADSAFE_ISUPPORTS0(NrSocket) +NS_IMPL_ISUPPORTS0(NrSocket) // The nsASocket callbacks diff --git a/media/mtransport/nr_socket_prsock.h b/media/mtransport/nr_socket_prsock.h index ac458a80559..2dcc26fb992 100644 --- a/media/mtransport/nr_socket_prsock.h +++ b/media/mtransport/nr_socket_prsock.h @@ -84,7 +84,7 @@ public: virtual uint64_t ByteCountReceived() { return 0; } // nsISupports methods - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // Implementations of the async_event APIs int async_wait(int how, NR_async_cb cb, void *cb_arg, diff --git a/media/mtransport/nr_timer.cpp b/media/mtransport/nr_timer.cpp index 16e72633810..96518b5eed7 100644 --- a/media/mtransport/nr_timer.cpp +++ b/media/mtransport/nr_timer.cpp @@ -70,7 +70,8 @@ namespace mozilla { class nrappkitTimerCallback : public nsITimerCallback { public: - NS_DECL_ISUPPORTS + // We're going to release ourself in the callback, so we need to be threadsafe + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK nrappkitTimerCallback(NR_async_cb cb, void *cb_arg, @@ -89,8 +90,7 @@ protected: int line_; }; -// We're going to release ourself in the callback, so we need to be threadsafe -NS_IMPL_THREADSAFE_ISUPPORTS1(nrappkitTimerCallback, nsITimerCallback) +NS_IMPL_ISUPPORTS1(nrappkitTimerCallback, nsITimerCallback) NS_IMETHODIMP nrappkitTimerCallback::Notify(nsITimer *timer) { r_log(LOG_GENERIC, LOG_DEBUG, "Timer callback fired (set in %s:%d)", diff --git a/media/mtransport/nriceresolver.cpp b/media/mtransport/nriceresolver.cpp index c330fd66d15..4ad17d1f3b0 100644 --- a/media/mtransport/nriceresolver.cpp +++ b/media/mtransport/nriceresolver.cpp @@ -212,5 +212,5 @@ int NrIceResolver::PendingResolution::cancel() { return 0; } -NS_IMPL_THREADSAFE_ISUPPORTS1(NrIceResolver::PendingResolution, nsIDNSListener); +NS_IMPL_ISUPPORTS1(NrIceResolver::PendingResolution, nsIDNSListener); } // End of namespace mozilla diff --git a/media/mtransport/nriceresolver.h b/media/mtransport/nriceresolver.h index d53dc5b299a..73d631d778f 100644 --- a/media/mtransport/nriceresolver.h +++ b/media/mtransport/nriceresolver.h @@ -98,7 +98,7 @@ class NrIceResolver nsresult status); int cancel(); nsCOMPtr request_; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS private: nsCOMPtr thread_; diff --git a/media/mtransport/test/sctp_unittest.cpp b/media/mtransport/test/sctp_unittest.cpp index 471d2083df5..034e7875fa9 100644 --- a/media/mtransport/test/sctp_unittest.cpp +++ b/media/mtransport/test/sctp_unittest.cpp @@ -49,7 +49,7 @@ class SendPeriodic : public nsITimerCallback { to_send_(to_send) {} virtual ~SendPeriodic() {} - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK protected: @@ -57,7 +57,7 @@ class SendPeriodic : public nsITimerCallback { int to_send_; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(SendPeriodic, nsITimerCallback) +NS_IMPL_ISUPPORTS1(SendPeriodic, nsITimerCallback) class TransportTestPeer : public sigslot::has_slots<> { diff --git a/media/mtransport/transportlayerloopback.cpp b/media/mtransport/transportlayerloopback.cpp index 99c47bb245d..97195ad315b 100644 --- a/media/mtransport/transportlayerloopback.cpp +++ b/media/mtransport/transportlayerloopback.cpp @@ -108,8 +108,7 @@ void TransportLayerLoopback::DeliverPackets() { } } -NS_IMPL_THREADSAFE_ISUPPORTS1(TransportLayerLoopback::Deliverer, - nsITimerCallback) +NS_IMPL_ISUPPORTS1(TransportLayerLoopback::Deliverer, nsITimerCallback) NS_IMETHODIMP TransportLayerLoopback::Deliverer::Notify(nsITimer *timer) { if (!layer_) diff --git a/media/mtransport/transportlayerloopback.h b/media/mtransport/transportlayerloopback.h index 55adc66101e..da0736e6b47 100644 --- a/media/mtransport/transportlayerloopback.h +++ b/media/mtransport/transportlayerloopback.h @@ -115,7 +115,7 @@ class TransportLayerLoopback : public TransportLayer { layer_ = nullptr; } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK private: diff --git a/media/mtransport/transportlayerprsock.cpp b/media/mtransport/transportlayerprsock.cpp index 014106e76fc..05349c278b0 100644 --- a/media/mtransport/transportlayerprsock.cpp +++ b/media/mtransport/transportlayerprsock.cpp @@ -112,5 +112,5 @@ void TransportLayerPrsock::OnSocketReady(PRFileDesc *fd, int16_t outflags) { } } -NS_IMPL_THREADSAFE_ISUPPORTS0(TransportLayerPrsock::SocketHandler) +NS_IMPL_ISUPPORTS0(TransportLayerPrsock::SocketHandler) } // close namespace diff --git a/media/mtransport/transportlayerprsock.h b/media/mtransport/transportlayerprsock.h index ac8eb20112a..5004b1fead9 100644 --- a/media/mtransport/transportlayerprsock.h +++ b/media/mtransport/transportlayerprsock.h @@ -86,7 +86,7 @@ class TransportLayerPrsock : public TransportLayer { virtual uint64_t ByteCountReceived() { return 0; } // nsISupports methods - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS private: TransportLayerPrsock *prsock_; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index b1b78b7f23b..51f299f1f07 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -316,7 +316,7 @@ private: nsRefPtr mRemoteStream; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(PeerConnectionImpl, IPeerConnection) +NS_IMPL_ISUPPORTS1(PeerConnectionImpl, IPeerConnection) PeerConnectionImpl::PeerConnectionImpl() : mRole(kRoleUnknown) diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index 5c23a826a9f..087753a71ee 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -179,7 +179,7 @@ public: kInternalError = 9 }; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_IPEERCONNECTION static PeerConnectionImpl* CreatePeerConnection(); diff --git a/media/webrtc/signaling/test/FakeMediaStreams.h b/media/webrtc/signaling/test/FakeMediaStreams.h index 7ecf9726ba5..b7cbc1f2553 100644 --- a/media/webrtc/signaling/test/FakeMediaStreams.h +++ b/media/webrtc/signaling/test/FakeMediaStreams.h @@ -91,7 +91,7 @@ Fake_MediaPeriodic(Fake_MediaStream *aStream) : mStream(aStream), int GetTimesCalled() { return mCount; } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK protected: @@ -192,7 +192,7 @@ public: mMediaStream->Stop(); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS static already_AddRefed CreateSourceStream(nsIDOMWindow* aWindow, uint32_t aHintContents) { diff --git a/media/webrtc/signaling/test/FakeMediaStreamsImpl.h b/media/webrtc/signaling/test/FakeMediaStreamsImpl.h index 63d4d7aa581..0ee5525092d 100644 --- a/media/webrtc/signaling/test/FakeMediaStreamsImpl.h +++ b/media/webrtc/signaling/test/FakeMediaStreamsImpl.h @@ -13,7 +13,7 @@ static const int AUDIO_BUFFER_SIZE = 1600; static const int NUM_CHANNELS = 2; -NS_IMPL_THREADSAFE_ISUPPORTS1(Fake_DOMMediaStream, nsIDOMMediaStream) +NS_IMPL_ISUPPORTS1(Fake_DOMMediaStream, nsIDOMMediaStream) // Fake_SourceMediaStream nsresult Fake_SourceMediaStream::Start() { @@ -106,7 +106,7 @@ void Fake_AudioStreamSource::Periodic() { // Fake_MediaPeriodic -NS_IMPL_THREADSAFE_ISUPPORTS1(Fake_MediaPeriodic, nsITimerCallback) +NS_IMPL_ISUPPORTS1(Fake_MediaPeriodic, nsITimerCallback) NS_IMETHODIMP Fake_MediaPeriodic::Notify(nsITimer *timer) { diff --git a/media/webrtc/signaling/test/signaling_unittests.cpp b/media/webrtc/signaling/test/signaling_unittests.cpp index 5ec447009ca..bcb7393f6e5 100644 --- a/media/webrtc/signaling/test/signaling_unittests.cpp +++ b/media/webrtc/signaling/test/signaling_unittests.cpp @@ -177,7 +177,7 @@ public: std::vector GetStreams() { return streams; } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_IPEERCONNECTIONOBSERVER ResponseState state; @@ -193,9 +193,9 @@ private: std::vector streams; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(TestObserver, - IPeerConnectionObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS2(TestObserver, + IPeerConnectionObserver, + nsISupportsWeakReference) NS_IMETHODIMP TestObserver::OnCreateOfferSuccess(const char* offer) From abccf4f45f7b6dea627b3ad09c9ad87451a7fdc2 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:23:44 -0500 Subject: [PATCH 38/69] Bug 884061 - Part 3p: Use NS_DECL_THREADSAFE_ISUPPORTS in modules/, r=taras,bsmedberg --HG-- extra : rebase_source : e7b1a1d25ae9e602cae50f11d718dd1a94db782d --- modules/libjar/nsJAR.cpp | 12 ++++++------ modules/libjar/nsJAR.h | 8 ++++---- modules/libjar/nsJARChannel.cpp | 4 ++-- modules/libjar/nsJARChannel.h | 2 +- modules/libjar/nsJARInputStream.cpp | 2 +- modules/libjar/nsJARInputStream.h | 2 +- modules/libjar/nsJARProtocolHandler.cpp | 2 +- modules/libjar/nsJARProtocolHandler.h | 2 +- modules/libjar/nsJARURI.cpp | 4 ++-- modules/libjar/nsJARURI.h | 2 +- modules/libjar/nsZipArchive.cpp | 8 ++++---- modules/libjar/nsZipArchive.h | 7 +++++-- modules/libjar/zipwriter/src/nsZipDataStream.cpp | 2 +- modules/libjar/zipwriter/src/nsZipDataStream.h | 2 +- modules/libpref/public/Preferences.h | 2 +- modules/libpref/src/Preferences.cpp | 4 ++-- modules/libpref/src/nsPrefBranch.cpp | 10 +++++----- modules/libpref/src/nsPrefBranch.h | 6 +++--- 18 files changed, 42 insertions(+), 39 deletions(-) diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index 358859c503a..b00aed5ed1e 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -98,15 +98,15 @@ nsJAR::~nsJAR() Close(); } -NS_IMPL_THREADSAFE_QUERY_INTERFACE1(nsJAR, nsIZipReader) -NS_IMPL_THREADSAFE_ADDREF(nsJAR) +NS_IMPL_QUERY_INTERFACE1(nsJAR, nsIZipReader) +NS_IMPL_ADDREF(nsJAR) // Custom Release method works with nsZipReaderCache... nsrefcnt nsJAR::Release(void) { nsrefcnt count; NS_PRECONDITION(0 != mRefCnt, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; NS_LOG_RELEASE(this, count, "nsJAR"); if (0 == count) { mRefCnt = 1; /* stabilize */ @@ -866,7 +866,7 @@ nsresult nsJAR::CalculateDigest(const char* aInBuf, uint32_t aLen, return hasher->Finish(true, digest); } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsJAREnumerator, nsIUTF8StringEnumerator) +NS_IMPL_ISUPPORTS1(nsJAREnumerator, nsIUTF8StringEnumerator) //---------------------------------------------- // nsJAREnumerator::HasMore @@ -908,7 +908,7 @@ nsJAREnumerator::GetNext(nsACString& aResult) } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARItem, nsIZipEntry) +NS_IMPL_ISUPPORTS1(nsJARItem, nsIZipEntry) nsJARItem::nsJARItem(nsZipItem* aZipItem) : mSize(aZipItem->Size()), @@ -1008,7 +1008,7 @@ nsJARItem::GetLastModifiedTime(PRTime* aLastModTime) //////////////////////////////////////////////////////////////////////////////// // nsIZipReaderCache -NS_IMPL_THREADSAFE_ISUPPORTS3(nsZipReaderCache, nsIZipReaderCache, nsIObserver, nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(nsZipReaderCache, nsIZipReaderCache, nsIObserver, nsISupportsWeakReference) nsZipReaderCache::nsZipReaderCache() : mLock("nsZipReaderCache.mLock") diff --git a/modules/libjar/nsJAR.h b/modules/libjar/nsJAR.h index fb08ae50701..82328c8051b 100644 --- a/modules/libjar/nsJAR.h +++ b/modules/libjar/nsJAR.h @@ -66,7 +66,7 @@ class nsJAR : public nsIZipReader NS_DEFINE_STATIC_CID_ACCESSOR( NS_ZIPREADER_CID ) - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIZIPREADER @@ -130,7 +130,7 @@ class nsJAR : public nsIZipReader class nsJARItem : public nsIZipEntry { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIZIPENTRY nsJARItem(nsZipItem* aZipItem); @@ -155,7 +155,7 @@ private: class nsJAREnumerator MOZ_FINAL : public nsIUTF8StringEnumerator { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIUTF8STRINGENUMERATOR nsJAREnumerator(nsZipFind *aFind) : mFind(aFind), mName(nullptr) { @@ -180,7 +180,7 @@ class nsZipReaderCache : public nsIZipReaderCache, public nsIObserver, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIZIPREADERCACHE NS_DECL_NSIOBSERVER diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index 22b483a8f6c..f0b819bbdd2 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -61,7 +61,7 @@ static PRLogModuleInfo *gJarProtocolLog = nullptr; class nsJARInputThunk : public nsIInputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM nsJARInputThunk(nsIZipReader *zipReader, @@ -104,7 +104,7 @@ private: int64_t mContentLength; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputThunk, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsJARInputThunk, nsIInputStream) nsresult nsJARInputThunk::Init() diff --git a/modules/libjar/nsJARChannel.h b/modules/libjar/nsJARChannel.h index d155ccbde43..4775188fb84 100644 --- a/modules/libjar/nsJARChannel.h +++ b/modules/libjar/nsJARChannel.h @@ -34,7 +34,7 @@ class nsJARChannel : public nsIJARChannel , public nsHashPropertyBag { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUEST NS_DECL_NSICHANNEL NS_DECL_NSIJARCHANNEL diff --git a/modules/libjar/nsJARInputStream.cpp b/modules/libjar/nsJARInputStream.cpp index c0ff5495f6e..a5b4ac25454 100644 --- a/modules/libjar/nsJARInputStream.cpp +++ b/modules/libjar/nsJARInputStream.cpp @@ -22,7 +22,7 @@ * nsISupports implementation *--------------------------------------------*/ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputStream, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsJARInputStream, nsIInputStream) /*---------------------------------------------------------- * nsJARInputStream implementation diff --git a/modules/libjar/nsJARInputStream.h b/modules/libjar/nsJARInputStream.h index f0df2f91fbb..8bb52341551 100644 --- a/modules/libjar/nsJARInputStream.h +++ b/modules/libjar/nsJARInputStream.h @@ -29,7 +29,7 @@ class nsJARInputStream MOZ_FINAL : public nsIInputStream ~nsJARInputStream() { Close(); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM // takes ownership of |fd|, even on failure diff --git a/modules/libjar/nsJARProtocolHandler.cpp b/modules/libjar/nsJARProtocolHandler.cpp index 2bc7145daf3..4eec71df5a3 100644 --- a/modules/libjar/nsJARProtocolHandler.cpp +++ b/modules/libjar/nsJARProtocolHandler.cpp @@ -124,7 +124,7 @@ nsJARProtocolHandler::RemoteOpenFileComplete(nsIHashable *aRemoteFile, } } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsJARProtocolHandler, +NS_IMPL_ISUPPORTS3(nsJARProtocolHandler, nsIJARProtocolHandler, nsIProtocolHandler, nsISupportsWeakReference) diff --git a/modules/libjar/nsJARProtocolHandler.h b/modules/libjar/nsJARProtocolHandler.h index 8e87c782830..5895ad10f52 100644 --- a/modules/libjar/nsJARProtocolHandler.h +++ b/modules/libjar/nsJARProtocolHandler.h @@ -27,7 +27,7 @@ class nsJARProtocolHandler : public nsIJARProtocolHandler RemoteFileListenerArray; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_DECL_NSIJARPROTOCOLHANDLER diff --git a/modules/libjar/nsJARURI.cpp b/modules/libjar/nsJARURI.cpp index b44b3e04eec..671148637a5 100644 --- a/modules/libjar/nsJARURI.cpp +++ b/modules/libjar/nsJARURI.cpp @@ -37,8 +37,8 @@ nsJARURI::~nsJARURI() } // XXX Why is this threadsafe? -NS_IMPL_THREADSAFE_ADDREF(nsJARURI) -NS_IMPL_THREADSAFE_RELEASE(nsJARURI) +NS_IMPL_ADDREF(nsJARURI) +NS_IMPL_RELEASE(nsJARURI) NS_INTERFACE_MAP_BEGIN(nsJARURI) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIJARURI) NS_INTERFACE_MAP_ENTRY(nsIURI) diff --git a/modules/libjar/nsJARURI.h b/modules/libjar/nsJARURI.h index f7d62605063..7f235d99d82 100644 --- a/modules/libjar/nsJARURI.h +++ b/modules/libjar/nsJARURI.h @@ -39,7 +39,7 @@ class nsJARURI : public nsIJARURI, public nsIIPCSerializableURI { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURI NS_DECL_NSIURL NS_DECL_NSIJARURI diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 6fb09f66a7b..2c1920176bd 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -163,8 +163,8 @@ nsZipHandle::nsZipHandle() MOZ_COUNT_CTOR(nsZipHandle); } -NS_IMPL_THREADSAFE_ADDREF(nsZipHandle) -NS_IMPL_THREADSAFE_RELEASE(nsZipHandle) +NS_IMPL_ADDREF(nsZipHandle) +NS_IMPL_RELEASE(nsZipHandle) nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret, PRFileDesc **aFd) { @@ -825,8 +825,8 @@ nsZipArchive::nsZipArchive() memset(mFiles, 0, sizeof(mFiles)); } -NS_IMPL_THREADSAFE_ADDREF(nsZipArchive) -NS_IMPL_THREADSAFE_RELEASE(nsZipArchive) +NS_IMPL_ADDREF(nsZipArchive) +NS_IMPL_RELEASE(nsZipArchive) nsZipArchive::~nsZipArchive() { diff --git a/modules/libjar/nsZipArchive.h b/modules/libjar/nsZipArchive.h index 991d19a1dc1..cd61a936787 100644 --- a/modules/libjar/nsZipArchive.h +++ b/modules/libjar/nsZipArchive.h @@ -20,6 +20,7 @@ #include "zipstruct.h" #include "nsAutoPtr.h" #include "nsIFile.h" +#include "nsISupportsImpl.h" // For mozilla::ThreadSafeAutoRefCnt #include "mozilla/FileUtils.h" #include "mozilla/FileLocation.h" @@ -204,7 +205,8 @@ public: private: //--- private members --- - nsrefcnt mRefCnt; /* ref count */ + mozilla::ThreadSafeAutoRefCnt mRefCnt; /* ref count */ + NS_DECL_OWNINGTHREAD nsZipItem* mFiles[ZIP_TABSIZE]; PLArenaPool mArena; @@ -396,7 +398,8 @@ private: PRFileMap * mMap; /* nspr datastructure for mmap */ nsAutoPtr > mBuf; - nsrefcnt mRefCnt; /* ref count */ + mozilla::ThreadSafeAutoRefCnt mRefCnt; /* ref count */ + NS_DECL_OWNINGTHREAD }; nsresult gZlibInit(z_stream *zs); diff --git a/modules/libjar/zipwriter/src/nsZipDataStream.cpp b/modules/libjar/zipwriter/src/nsZipDataStream.cpp index f2bd19f2c26..d9edb4e1008 100644 --- a/modules/libjar/zipwriter/src/nsZipDataStream.cpp +++ b/modules/libjar/zipwriter/src/nsZipDataStream.cpp @@ -22,7 +22,7 @@ * Currently only the deflate compression method is supported. * The CRC checksum for the entry's data is also generated here. */ -NS_IMPL_THREADSAFE_ISUPPORTS2(nsZipDataStream, nsIStreamListener, +NS_IMPL_ISUPPORTS2(nsZipDataStream, nsIStreamListener, nsIRequestObserver) nsresult nsZipDataStream::Init(nsZipWriter *aWriter, diff --git a/modules/libjar/zipwriter/src/nsZipDataStream.h b/modules/libjar/zipwriter/src/nsZipDataStream.h index 42516dbda70..42555b15f02 100644 --- a/modules/libjar/zipwriter/src/nsZipDataStream.h +++ b/modules/libjar/zipwriter/src/nsZipDataStream.h @@ -15,7 +15,7 @@ class nsZipDataStream MOZ_FINAL : public nsIStreamListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER diff --git a/modules/libpref/public/Preferences.h b/modules/libpref/public/Preferences.h index 4bfb5c6292a..58c5a8ee000 100644 --- a/modules/libpref/public/Preferences.h +++ b/modules/libpref/public/Preferences.h @@ -43,7 +43,7 @@ class Preferences : public nsIPrefService, public: typedef mozilla::dom::PrefSetting PrefSetting; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPREFSERVICE NS_FORWARD_NSIPREFBRANCH(sRootBranch->) NS_DECL_NSIOBSERVER diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index 72729b175e9..2310af101af 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -327,8 +327,8 @@ Preferences::~Preferences() * nsISupports Implementation */ -NS_IMPL_THREADSAFE_ADDREF(Preferences) -NS_IMPL_THREADSAFE_RELEASE(Preferences) +NS_IMPL_ADDREF(Preferences) +NS_IMPL_RELEASE(Preferences) NS_INTERFACE_MAP_BEGIN(Preferences) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefService) diff --git a/modules/libpref/src/nsPrefBranch.cpp b/modules/libpref/src/nsPrefBranch.cpp index 61bde383321..f2f4f407f80 100644 --- a/modules/libpref/src/nsPrefBranch.cpp +++ b/modules/libpref/src/nsPrefBranch.cpp @@ -99,8 +99,8 @@ nsPrefBranch::~nsPrefBranch() * nsISupports Implementation */ -NS_IMPL_THREADSAFE_ADDREF(nsPrefBranch) -NS_IMPL_THREADSAFE_RELEASE(nsPrefBranch) +NS_IMPL_ADDREF(nsPrefBranch) +NS_IMPL_RELEASE(nsPrefBranch) NS_INTERFACE_MAP_BEGIN(nsPrefBranch) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefBranch) @@ -833,8 +833,8 @@ nsPrefLocalizedString::~nsPrefLocalizedString() * nsISupports Implementation */ -NS_IMPL_THREADSAFE_ADDREF(nsPrefLocalizedString) -NS_IMPL_THREADSAFE_RELEASE(nsPrefLocalizedString) +NS_IMPL_ADDREF(nsPrefLocalizedString) +NS_IMPL_RELEASE(nsPrefLocalizedString) NS_INTERFACE_MAP_BEGIN(nsPrefLocalizedString) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrefLocalizedString) @@ -887,7 +887,7 @@ nsPrefLocalizedString::SetDataWithLength(uint32_t aLength, // nsRelativeFilePref //---------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS1(nsRelativeFilePref, nsIRelativeFilePref) +NS_IMPL_ISUPPORTS1(nsRelativeFilePref, nsIRelativeFilePref) nsRelativeFilePref::nsRelativeFilePref() { diff --git a/modules/libpref/src/nsPrefBranch.h b/modules/libpref/src/nsPrefBranch.h index 539a12a37cf..da1a34ef924 100644 --- a/modules/libpref/src/nsPrefBranch.h +++ b/modules/libpref/src/nsPrefBranch.h @@ -174,7 +174,7 @@ class nsPrefBranch : public nsIPrefBranchInternal, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPREFBRANCH NS_DECL_NSIPREFBRANCH2 NS_DECL_NSIOBSERVER @@ -227,7 +227,7 @@ public: nsPrefLocalizedString(); virtual ~nsPrefLocalizedString(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_FORWARD_NSISUPPORTSSTRING(mUnicodeString->) NS_FORWARD_NSISUPPORTSPRIMITIVE(mUnicodeString->) @@ -245,7 +245,7 @@ private: class nsRelativeFilePref : public nsIRelativeFilePref { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRELATIVEFILEPREF nsRelativeFilePref(); From 35b47f34ec29e1de574139dbf5c41b20eab7ce1c Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:13 -0500 Subject: [PATCH 39/69] Bug 884061 - Part 3q: Use NS_DECL_THREADSAFE_ISUPPORTS in netwerk/, r=macmanus --HG-- extra : rebase_source : d029f73a1f27896c142f76dce263dd3542763b18 --- .../base/public/nsAsyncRedirectVerifyHelper.h | 2 +- netwerk/base/src/BackgroundFileSaver.cpp | 22 ++++----- netwerk/base/src/BackgroundFileSaver.h | 6 +-- netwerk/base/src/Dashboard.cpp | 2 +- netwerk/base/src/Dashboard.h | 2 +- netwerk/base/src/EventTokenBucket.cpp | 6 +-- netwerk/base/src/EventTokenBucket.h | 2 +- netwerk/base/src/ProxyAutoConfig.cpp | 4 +- netwerk/base/src/Tickler.cpp | 8 ++-- netwerk/base/src/Tickler.h | 4 +- .../base/src/nsAsyncRedirectVerifyHelper.cpp | 6 +-- netwerk/base/src/nsAsyncStreamCopier.cpp | 2 +- netwerk/base/src/nsAsyncStreamCopier.h | 2 +- netwerk/base/src/nsBaseContentStream.cpp | 4 +- netwerk/base/src/nsBaseContentStream.h | 2 +- netwerk/base/src/nsBufferedStreams.cpp | 2 +- netwerk/base/src/nsBufferedStreams.h | 2 +- netwerk/base/src/nsDNSPrefetch.cpp | 2 +- netwerk/base/src/nsDNSPrefetch.h | 2 +- netwerk/base/src/nsDirectoryIndexStream.cpp | 2 +- netwerk/base/src/nsDirectoryIndexStream.h | 2 +- netwerk/base/src/nsFileStreams.cpp | 6 +-- netwerk/base/src/nsFileStreams.h | 2 +- netwerk/base/src/nsIOService.cpp | 14 +++--- netwerk/base/src/nsIOService.h | 2 +- netwerk/base/src/nsIOThreadPool.cpp | 4 +- netwerk/base/src/nsInputStreamPump.cpp | 10 ++-- netwerk/base/src/nsInputStreamPump.h | 2 +- netwerk/base/src/nsLoadGroup.cpp | 4 +- netwerk/base/src/nsMIMEInputStream.cpp | 6 +-- netwerk/base/src/nsPACMan.cpp | 4 +- netwerk/base/src/nsPACMan.h | 2 +- netwerk/base/src/nsPreloadedStream.cpp | 6 +-- netwerk/base/src/nsPreloadedStream.h | 2 +- netwerk/base/src/nsProtocolProxyService.cpp | 8 ++-- netwerk/base/src/nsProxyInfo.cpp | 2 +- netwerk/base/src/nsProxyInfo.h | 2 +- netwerk/base/src/nsRequestObserverProxy.cpp | 6 +-- netwerk/base/src/nsRequestObserverProxy.h | 2 +- netwerk/base/src/nsServerSocket.cpp | 8 ++-- netwerk/base/src/nsServerSocket.h | 2 +- netwerk/base/src/nsSocketTransport2.cpp | 18 +++---- netwerk/base/src/nsSocketTransport2.h | 6 +-- .../base/src/nsSocketTransportService2.cpp | 14 +++--- netwerk/base/src/nsSocketTransportService2.h | 2 +- netwerk/base/src/nsStreamListenerTee.cpp | 10 ++-- netwerk/base/src/nsStreamListenerTee.h | 2 +- netwerk/base/src/nsStreamTransportService.cpp | 24 +++++----- netwerk/base/src/nsStreamTransportService.h | 2 +- .../base/src/nsTemporaryFileInputStream.cpp | 2 +- netwerk/base/src/nsTemporaryFileInputStream.h | 2 +- netwerk/base/src/nsTransportUtils.cpp | 4 +- netwerk/base/src/nsUDPServerSocket.cpp | 12 ++--- netwerk/base/src/nsUDPServerSocket.h | 6 +-- netwerk/base/src/nsURLParsers.cpp | 7 +-- netwerk/base/src/nsURLParsers.h | 4 +- netwerk/cache/nsCacheEntryDescriptor.cpp | 22 ++++----- netwerk/cache/nsCacheEntryDescriptor.h | 10 ++-- netwerk/cache/nsCacheService.cpp | 10 ++-- netwerk/cache/nsCacheService.h | 2 +- netwerk/cache/nsDiskCacheBinding.cpp | 2 +- netwerk/cache/nsDiskCacheBinding.h | 2 +- netwerk/cache/nsDiskCacheDeviceSQL.cpp | 8 ++-- netwerk/cache/nsDiskCacheDeviceSQL.h | 4 +- netwerk/cache/nsDiskCacheStreams.cpp | 6 +-- netwerk/cache/nsDiskCacheStreams.h | 2 +- netwerk/dns/nsDNSService2.cpp | 14 +++--- netwerk/dns/nsDNSService2.h | 2 +- netwerk/dns/nsIDNService.cpp | 8 ++-- netwerk/dns/nsIDNService.h | 2 +- netwerk/ipc/RemoteOpenFileChild.cpp | 8 ++-- netwerk/ipc/RemoteOpenFileChild.h | 2 +- .../device/AndroidCaptureProvider.cpp | 4 +- .../protocol/device/AndroidCaptureProvider.h | 4 +- .../device/nsDeviceProtocolHandler.cpp | 4 +- .../protocol/device/nsDeviceProtocolHandler.h | 2 +- .../protocol/file/nsFileProtocolHandler.cpp | 8 ++-- netwerk/protocol/file/nsFileProtocolHandler.h | 2 +- netwerk/protocol/ftp/nsFTPChannel.cpp | 4 +- netwerk/protocol/ftp/nsFtpProtocolHandler.cpp | 10 ++-- netwerk/protocol/ftp/nsFtpProtocolHandler.h | 2 +- netwerk/protocol/http/NullHttpTransaction.cpp | 2 +- netwerk/protocol/http/NullHttpTransaction.h | 2 +- netwerk/protocol/http/SpdyPush3.cpp | 2 +- netwerk/protocol/http/SpdyPush3.h | 2 +- netwerk/protocol/http/SpdySession2.cpp | 4 +- netwerk/protocol/http/SpdySession2.h | 2 +- netwerk/protocol/http/SpdySession3.cpp | 4 +- netwerk/protocol/http/SpdySession3.h | 2 +- .../http/nsHttpActivityDistributor.cpp | 6 +-- .../protocol/http/nsHttpActivityDistributor.h | 2 +- netwerk/protocol/http/nsHttpConnection.cpp | 10 ++-- netwerk/protocol/http/nsHttpConnection.h | 2 +- netwerk/protocol/http/nsHttpConnectionInfo.h | 6 +-- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 14 +++--- netwerk/protocol/http/nsHttpConnectionMgr.h | 6 +-- netwerk/protocol/http/nsHttpHandler.cpp | 26 +++++----- netwerk/protocol/http/nsHttpHandler.h | 4 +- netwerk/protocol/http/nsHttpPipeline.cpp | 4 +- netwerk/protocol/http/nsHttpPipeline.h | 2 +- netwerk/protocol/http/nsHttpTransaction.cpp | 10 ++-- netwerk/protocol/http/nsHttpTransaction.h | 2 +- netwerk/protocol/res/nsResProtocolHandler.cpp | 8 ++-- netwerk/protocol/res/nsResProtocolHandler.h | 2 +- .../protocol/websocket/WebSocketChannel.cpp | 48 +++++++++---------- netwerk/protocol/websocket/WebSocketChannel.h | 2 +- .../websocket/WebSocketChannelParent.cpp | 2 +- .../websocket/WebSocketChannelParent.h | 2 +- netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp | 16 +++---- netwerk/protocol/wyciwyg/nsWyciwygChannel.h | 2 +- netwerk/sctp/datachannel/DataChannel.cpp | 4 +- netwerk/sctp/datachannel/DataChannel.h | 2 +- netwerk/socket/nsSOCKSIOLayer.cpp | 4 +- netwerk/socket/nsSOCKSSocketProvider.cpp | 2 +- netwerk/socket/nsSOCKSSocketProvider.h | 2 +- netwerk/socket/nsSocketProviderService.cpp | 2 +- netwerk/socket/nsSocketProviderService.h | 2 +- netwerk/socket/nsUDPSocketProvider.cpp | 2 +- netwerk/socket/nsUDPSocketProvider.h | 2 +- .../converters/nsHTTPCompressConv.cpp | 8 ++-- .../converters/nsHTTPCompressConv.h | 2 +- netwerk/system/win32/nsNotifyAddrListener.cpp | 8 ++-- netwerk/system/win32/nsNotifyAddrListener.h | 2 +- netwerk/test/TestCallbacks.cpp | 8 ++-- netwerk/test/TestCommon.h | 4 +- netwerk/test/TestDNS.cpp | 4 +- netwerk/test/TestHttp.cpp | 8 ++-- netwerk/test/TestIOThreads.cpp | 4 +- netwerk/test/TestPageLoad.cpp | 8 ++-- netwerk/test/TestProtocols.cpp | 4 +- netwerk/test/TestServ.cpp | 4 +- netwerk/test/TestSocketTransport.cpp | 8 ++-- netwerk/test/TestStreamTransport.cpp | 8 ++-- netwerk/test/TestUDPServerSocket.cpp | 6 +-- netwerk/wifi/nsWifiAccessPoint.cpp | 2 +- netwerk/wifi/nsWifiAccessPoint.h | 2 +- netwerk/wifi/nsWifiMonitor.cpp | 20 ++++---- netwerk/wifi/nsWifiMonitor.h | 2 +- 138 files changed, 383 insertions(+), 386 deletions(-) diff --git a/netwerk/base/public/nsAsyncRedirectVerifyHelper.h b/netwerk/base/public/nsAsyncRedirectVerifyHelper.h index 33ca479ec96..56e839cf1bc 100644 --- a/netwerk/base/public/nsAsyncRedirectVerifyHelper.h +++ b/netwerk/base/public/nsAsyncRedirectVerifyHelper.h @@ -26,7 +26,7 @@ class nsIChannel; class nsAsyncRedirectVerifyHelper MOZ_FINAL : public nsIRunnable, public nsIAsyncVerifyRedirectCallback { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK diff --git a/netwerk/base/src/BackgroundFileSaver.cpp b/netwerk/base/src/BackgroundFileSaver.cpp index 185d1f60c0b..18168345446 100644 --- a/netwerk/base/src/BackgroundFileSaver.cpp +++ b/netwerk/base/src/BackgroundFileSaver.cpp @@ -708,11 +708,11 @@ BackgroundFileSaver::NotifySaveComplete() //////////////////////////////////////////////////////////////////////////////// //// BackgroundFileSaverOutputStream -NS_IMPL_THREADSAFE_ISUPPORTS4(BackgroundFileSaverOutputStream, - nsIBackgroundFileSaver, - nsIOutputStream, - nsIAsyncOutputStream, - nsIOutputStreamCallback) +NS_IMPL_ISUPPORTS4(BackgroundFileSaverOutputStream, + nsIBackgroundFileSaver, + nsIOutputStream, + nsIAsyncOutputStream, + nsIOutputStreamCallback) BackgroundFileSaverOutputStream::BackgroundFileSaverOutputStream() : BackgroundFileSaver() @@ -811,10 +811,10 @@ BackgroundFileSaverOutputStream::OnOutputStreamReady( //////////////////////////////////////////////////////////////////////////////// //// BackgroundFileSaverStreamListener -NS_IMPL_THREADSAFE_ISUPPORTS3(BackgroundFileSaverStreamListener, - nsIBackgroundFileSaver, - nsIRequestObserver, - nsIStreamListener) +NS_IMPL_ISUPPORTS3(BackgroundFileSaverStreamListener, + nsIBackgroundFileSaver, + nsIRequestObserver, + nsIStreamListener) BackgroundFileSaverStreamListener::BackgroundFileSaverStreamListener() : BackgroundFileSaver() @@ -975,8 +975,8 @@ BackgroundFileSaverStreamListener::NotifySuspendOrResume() //////////////////////////////////////////////////////////////////////////////// //// DigestOutputStream -NS_IMPL_THREADSAFE_ISUPPORTS1(DigestOutputStream, - nsIOutputStream) +NS_IMPL_ISUPPORTS1(DigestOutputStream, + nsIOutputStream) DigestOutputStream::DigestOutputStream(nsIOutputStream* aStream, PK11Context* aContext) : diff --git a/netwerk/base/src/BackgroundFileSaver.h b/netwerk/base/src/BackgroundFileSaver.h index 974cd924797..a41eb210c66 100644 --- a/netwerk/base/src/BackgroundFileSaver.h +++ b/netwerk/base/src/BackgroundFileSaver.h @@ -271,7 +271,7 @@ class BackgroundFileSaverOutputStream : public BackgroundFileSaver , public nsIOutputStreamCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM NS_DECL_NSIASYNCOUTPUTSTREAM NS_DECL_NSIOUTPUTSTREAMCALLBACK @@ -299,7 +299,7 @@ class BackgroundFileSaverStreamListener : public BackgroundFileSaver , public nsIStreamListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER @@ -351,7 +351,7 @@ class DigestOutputStream : public nsNSSShutDownObject, public nsIOutputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM // Constructor. Neither parameter may be null. The caller owns both. DigestOutputStream(nsIOutputStream* outputStream, PK11Context* aContext); diff --git a/netwerk/base/src/Dashboard.cpp b/netwerk/base/src/Dashboard.cpp index 0325ac8af32..abe1aedc164 100644 --- a/netwerk/base/src/Dashboard.cpp +++ b/netwerk/base/src/Dashboard.cpp @@ -13,7 +13,7 @@ using mozilla::AutoSafeJSContext; namespace mozilla { namespace net { -NS_IMPL_THREADSAFE_ISUPPORTS2(Dashboard, nsIDashboard, nsIDashboardEventNotifier) +NS_IMPL_ISUPPORTS2(Dashboard, nsIDashboard, nsIDashboardEventNotifier) using mozilla::dom::Sequence; Dashboard::Dashboard() diff --git a/netwerk/base/src/Dashboard.h b/netwerk/base/src/Dashboard.h index 5c2e1e406d0..eeeb97f6a68 100644 --- a/netwerk/base/src/Dashboard.h +++ b/netwerk/base/src/Dashboard.h @@ -24,7 +24,7 @@ class Dashboard: public nsIDashboardEventNotifier { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDASHBOARD NS_DECL_NSIDASHBOARDEVENTNOTIFIER diff --git a/netwerk/base/src/EventTokenBucket.cpp b/netwerk/base/src/EventTokenBucket.cpp index ea3a7888e9b..525dfc1582a 100644 --- a/netwerk/base/src/EventTokenBucket.cpp +++ b/netwerk/base/src/EventTokenBucket.cpp @@ -26,7 +26,7 @@ namespace net { class TokenBucketCancelable : public nsICancelable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICANCELABLE TokenBucketCancelable(class ATokenBucketEvent *event); @@ -38,7 +38,7 @@ private: ATokenBucketEvent *mEvent; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(TokenBucketCancelable, nsICancelable) +NS_IMPL_ISUPPORTS1(TokenBucketCancelable, nsICancelable) TokenBucketCancelable::TokenBucketCancelable(ATokenBucketEvent *event) : mEvent(event) @@ -68,7 +68,7 @@ TokenBucketCancelable::Fire() // EventTokenBucket //////////////////////////////////////////// -NS_IMPL_THREADSAFE_ISUPPORTS1(EventTokenBucket, nsITimerCallback) +NS_IMPL_ISUPPORTS1(EventTokenBucket, nsITimerCallback) // by default 1hz with no burst EventTokenBucket::EventTokenBucket(uint32_t eventsPerSecond, diff --git a/netwerk/base/src/EventTokenBucket.h b/netwerk/base/src/EventTokenBucket.h index 7cd303fd36e..fa5575d840e 100644 --- a/netwerk/base/src/EventTokenBucket.h +++ b/netwerk/base/src/EventTokenBucket.h @@ -69,7 +69,7 @@ class TokenBucketCancelable; class EventTokenBucket : public nsITimerCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK // This should be constructed on the main thread diff --git a/netwerk/base/src/ProxyAutoConfig.cpp b/netwerk/base/src/ProxyAutoConfig.cpp index 2ab74cc9b0f..b41166671ac 100644 --- a/netwerk/base/src/ProxyAutoConfig.cpp +++ b/netwerk/base/src/ProxyAutoConfig.cpp @@ -249,7 +249,7 @@ class PACResolver MOZ_FINAL : public nsIDNSListener , public nsITimerCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS PACResolver() : mStatus(NS_ERROR_FAILURE) @@ -286,7 +286,7 @@ public: nsCOMPtr mResponse; nsCOMPtr mTimer; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(PACResolver, nsIDNSListener, nsITimerCallback) +NS_IMPL_ISUPPORTS2(PACResolver, nsIDNSListener, nsITimerCallback) static void PACLogToConsole(nsString &aMessage) diff --git a/netwerk/base/src/Tickler.cpp b/netwerk/base/src/Tickler.cpp index 6ee4e30883e..d0a7f91374e 100644 --- a/netwerk/base/src/Tickler.cpp +++ b/netwerk/base/src/Tickler.cpp @@ -17,7 +17,7 @@ namespace mozilla { namespace net { -NS_IMPL_THREADSAFE_ISUPPORTS1(Tickler, nsISupportsWeakReference) +NS_IMPL_ISUPPORTS1(Tickler, nsISupportsWeakReference) Tickler::Tickler() : mLock("Tickler::mLock") @@ -190,7 +190,7 @@ void Tickler::StopTickler() class TicklerTimer MOZ_FINAL : public nsITimerCallback { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK TicklerTimer(Tickler *aTickler) @@ -229,7 +229,7 @@ void Tickler::SetIPV4Port(uint16_t port) mAddr.inet.port = port; } -NS_IMPL_THREADSAFE_ISUPPORTS1(TicklerTimer, nsITimerCallback) +NS_IMPL_ISUPPORTS1(TicklerTimer, nsITimerCallback) NS_IMETHODIMP TicklerTimer::Notify(nsITimer *timer) { @@ -263,7 +263,7 @@ NS_IMETHODIMP TicklerTimer::Notify(nsITimer *timer) namespace mozilla { namespace net { -NS_IMPL_THREADSAFE_ISUPPORTS0(Tickler) +NS_IMPL_ISUPPORTS0(Tickler) } // namespace mozilla::net } // namespace mozilla diff --git a/netwerk/base/src/Tickler.h b/netwerk/base/src/Tickler.h index 5630ab015ac..f8af5f93419 100644 --- a/netwerk/base/src/Tickler.h +++ b/netwerk/base/src/Tickler.h @@ -50,7 +50,7 @@ namespace net { class Tickler MOZ_FINAL : public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // These methods are main thread only Tickler(); @@ -97,7 +97,7 @@ private: class Tickler MOZ_FINAL : public nsISupports { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS Tickler() { } ~Tickler() { } diff --git a/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp b/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp index 52941303e94..edc34d6b80c 100644 --- a/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp +++ b/netwerk/base/src/nsAsyncRedirectVerifyHelper.cpp @@ -31,9 +31,9 @@ GetRedirectLog() #define LOG(args) #endif -NS_IMPL_THREADSAFE_ISUPPORTS2(nsAsyncRedirectVerifyHelper, - nsIAsyncVerifyRedirectCallback, - nsIRunnable) +NS_IMPL_ISUPPORTS2(nsAsyncRedirectVerifyHelper, + nsIAsyncVerifyRedirectCallback, + nsIRunnable) class nsAsyncVerifyRedirectCallbackEvent : public nsRunnable { public: diff --git a/netwerk/base/src/nsAsyncStreamCopier.cpp b/netwerk/base/src/nsAsyncStreamCopier.cpp index 0e5fb5bb558..1cb0c612942 100644 --- a/netwerk/base/src/nsAsyncStreamCopier.cpp +++ b/netwerk/base/src/nsAsyncStreamCopier.cpp @@ -88,7 +88,7 @@ nsAsyncStreamCopier::OnAsyncCopyComplete(void *closure, nsresult status) //----------------------------------------------------------------------------- // nsISupports -NS_IMPL_THREADSAFE_ISUPPORTS2(nsAsyncStreamCopier, +NS_IMPL_ISUPPORTS2(nsAsyncStreamCopier, nsIRequest, nsIAsyncStreamCopier) diff --git a/netwerk/base/src/nsAsyncStreamCopier.h b/netwerk/base/src/nsAsyncStreamCopier.h index 6df2618b86d..8f3bf174eb5 100644 --- a/netwerk/base/src/nsAsyncStreamCopier.h +++ b/netwerk/base/src/nsAsyncStreamCopier.h @@ -18,7 +18,7 @@ class nsAsyncStreamCopier : public nsIAsyncStreamCopier { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUEST NS_DECL_NSIASYNCSTREAMCOPIER diff --git a/netwerk/base/src/nsBaseContentStream.cpp b/netwerk/base/src/nsBaseContentStream.cpp index a6474618163..ee5a8ef3cf8 100644 --- a/netwerk/base/src/nsBaseContentStream.cpp +++ b/netwerk/base/src/nsBaseContentStream.cpp @@ -32,8 +32,8 @@ nsBaseContentStream::DispatchCallback(bool async) //----------------------------------------------------------------------------- // nsBaseContentStream::nsISupports -NS_IMPL_THREADSAFE_ADDREF(nsBaseContentStream) -NS_IMPL_THREADSAFE_RELEASE(nsBaseContentStream) +NS_IMPL_ADDREF(nsBaseContentStream) +NS_IMPL_RELEASE(nsBaseContentStream) // We only support nsIAsyncInputStream when we are in non-blocking mode. NS_INTERFACE_MAP_BEGIN(nsBaseContentStream) diff --git a/netwerk/base/src/nsBaseContentStream.h b/netwerk/base/src/nsBaseContentStream.h index 943fa899386..a8708cae637 100644 --- a/netwerk/base/src/nsBaseContentStream.h +++ b/netwerk/base/src/nsBaseContentStream.h @@ -36,7 +36,7 @@ class nsBaseContentStream : public nsIAsyncInputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM diff --git a/netwerk/base/src/nsBufferedStreams.cpp b/netwerk/base/src/nsBufferedStreams.cpp index 82ed1fb4fcf..234a0d94e4d 100644 --- a/netwerk/base/src/nsBufferedStreams.cpp +++ b/netwerk/base/src/nsBufferedStreams.cpp @@ -61,7 +61,7 @@ nsBufferedStream::~nsBufferedStream() Close(); } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsBufferedStream, nsISeekableStream) +NS_IMPL_ISUPPORTS1(nsBufferedStream, nsISeekableStream) nsresult nsBufferedStream::Init(nsISupports* stream, uint32_t bufferSize) diff --git a/netwerk/base/src/nsBufferedStreams.h b/netwerk/base/src/nsBufferedStreams.h index cc52f9e3bd0..084720fd96f 100644 --- a/netwerk/base/src/nsBufferedStreams.h +++ b/netwerk/base/src/nsBufferedStreams.h @@ -20,7 +20,7 @@ class nsBufferedStream : public nsISeekableStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISEEKABLESTREAM nsBufferedStream(); diff --git a/netwerk/base/src/nsDNSPrefetch.cpp b/netwerk/base/src/nsDNSPrefetch.cpp index cf75c9861c2..0909754d240 100644 --- a/netwerk/base/src/nsDNSPrefetch.cpp +++ b/netwerk/base/src/nsDNSPrefetch.cpp @@ -79,7 +79,7 @@ nsDNSPrefetch::PrefetchHigh() } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDNSPrefetch, nsIDNSListener) +NS_IMPL_ISUPPORTS1(nsDNSPrefetch, nsIDNSListener) NS_IMETHODIMP nsDNSPrefetch::OnLookupComplete(nsICancelable *request, diff --git a/netwerk/base/src/nsDNSPrefetch.h b/netwerk/base/src/nsDNSPrefetch.h index 8d34538b0e0..7853993759e 100644 --- a/netwerk/base/src/nsDNSPrefetch.h +++ b/netwerk/base/src/nsDNSPrefetch.h @@ -19,7 +19,7 @@ class nsIDNSService; class nsDNSPrefetch MOZ_FINAL : public nsIDNSListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDNSLISTENER nsDNSPrefetch(nsIURI *aURI, bool storeTiming); diff --git a/netwerk/base/src/nsDirectoryIndexStream.cpp b/netwerk/base/src/nsDirectoryIndexStream.cpp index 5a50e5d887c..a4021b7e559 100644 --- a/netwerk/base/src/nsDirectoryIndexStream.cpp +++ b/netwerk/base/src/nsDirectoryIndexStream.cpp @@ -188,7 +188,7 @@ nsDirectoryIndexStream::Create(nsIFile* aDir, nsIInputStream** aResult) return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDirectoryIndexStream, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsDirectoryIndexStream, nsIInputStream) // The below routines are proxied to the UI thread! NS_IMETHODIMP diff --git a/netwerk/base/src/nsDirectoryIndexStream.h b/netwerk/base/src/nsDirectoryIndexStream.h index afd3eb11d47..9de724bc545 100644 --- a/netwerk/base/src/nsDirectoryIndexStream.h +++ b/netwerk/base/src/nsDirectoryIndexStream.h @@ -40,7 +40,7 @@ public: Create(nsIFile* aDir, nsIInputStream** aStreamResult); // nsISupportsInterface - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // nsIInputStream interface NS_DECL_NSIINPUTSTREAM diff --git a/netwerk/base/src/nsFileStreams.cpp b/netwerk/base/src/nsFileStreams.cpp index ecc26aa19fa..c332f8b9e76 100644 --- a/netwerk/base/src/nsFileStreams.cpp +++ b/netwerk/base/src/nsFileStreams.cpp @@ -51,9 +51,9 @@ nsFileStreamBase::~nsFileStreamBase() Close(); } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsFileStreamBase, - nsISeekableStream, - nsIFileMetadata) +NS_IMPL_ISUPPORTS2(nsFileStreamBase, + nsISeekableStream, + nsIFileMetadata) NS_IMETHODIMP nsFileStreamBase::Seek(int32_t whence, int64_t offset) diff --git a/netwerk/base/src/nsFileStreams.h b/netwerk/base/src/nsFileStreams.h index ed4c58e3ed0..efab19a39b2 100644 --- a/netwerk/base/src/nsFileStreams.h +++ b/netwerk/base/src/nsFileStreams.h @@ -29,7 +29,7 @@ class nsFileStreamBase : public nsISeekableStream, public nsIFileMetadata { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISEEKABLESTREAM NS_DECL_NSIFILEMETADATA diff --git a/netwerk/base/src/nsIOService.cpp b/netwerk/base/src/nsIOService.cpp index 9652c1248c2..f55f2e0bdd2 100644 --- a/netwerk/base/src/nsIOService.cpp +++ b/netwerk/base/src/nsIOService.cpp @@ -301,13 +301,13 @@ nsIOService::GetInstance() { return gIOService; } -NS_IMPL_THREADSAFE_ISUPPORTS6(nsIOService, - nsIIOService, - nsIIOService2, - nsINetUtil, - nsISpeculativeConnect, - nsIObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS6(nsIOService, + nsIIOService, + nsIIOService2, + nsINetUtil, + nsISpeculativeConnect, + nsIObserver, + nsISupportsWeakReference) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/base/src/nsIOService.h b/netwerk/base/src/nsIOService.h index f972a9a1deb..3e38aac2e26 100644 --- a/netwerk/base/src/nsIOService.h +++ b/netwerk/base/src/nsIOService.h @@ -48,7 +48,7 @@ class nsIOService MOZ_FINAL : public nsIIOService2 , public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIIOSERVICE NS_DECL_NSIIOSERVICE2 NS_DECL_NSIOBSERVER diff --git a/netwerk/base/src/nsIOThreadPool.cpp b/netwerk/base/src/nsIOThreadPool.cpp index 522a5d550d1..41b4870d5b5 100644 --- a/netwerk/base/src/nsIOThreadPool.cpp +++ b/netwerk/base/src/nsIOThreadPool.cpp @@ -43,7 +43,7 @@ class nsIOThreadPool : public nsIEventTarget , public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEVENTTARGET NS_DECL_NSIOBSERVER @@ -66,7 +66,7 @@ private: nsThreadPoolNaming mNaming; // thread name numbering }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsIOThreadPool, nsIEventTarget, nsIObserver) +NS_IMPL_ISUPPORTS2(nsIOThreadPool, nsIEventTarget, nsIObserver) nsresult nsIOThreadPool::Init() diff --git a/netwerk/base/src/nsInputStreamPump.cpp b/netwerk/base/src/nsInputStreamPump.cpp index baaebe8882e..d46a2ff0bfd 100644 --- a/netwerk/base/src/nsInputStreamPump.cpp +++ b/netwerk/base/src/nsInputStreamPump.cpp @@ -155,11 +155,11 @@ nsInputStreamPump::EnsureWaiting() // although this class can only be accessed from one thread at a time, we do // allow its ownership to move from thread to thread, assuming the consumer // understands the limitations of this. -NS_IMPL_THREADSAFE_ISUPPORTS4(nsInputStreamPump, - nsIRequest, - nsIThreadRetargetableRequest, - nsIInputStreamCallback, - nsIInputStreamPump) +NS_IMPL_ISUPPORTS4(nsInputStreamPump, + nsIRequest, + nsIThreadRetargetableRequest, + nsIInputStreamCallback, + nsIInputStreamPump) //----------------------------------------------------------------------------- // nsInputStreamPump::nsIRequest diff --git a/netwerk/base/src/nsInputStreamPump.h b/netwerk/base/src/nsInputStreamPump.h index d2768cee322..526517073dc 100644 --- a/netwerk/base/src/nsInputStreamPump.h +++ b/netwerk/base/src/nsInputStreamPump.h @@ -24,7 +24,7 @@ class nsInputStreamPump MOZ_FINAL : public nsIInputStreamPump , public nsIThreadRetargetableRequest { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUEST NS_DECL_NSIINPUTSTREAMPUMP NS_DECL_NSIINPUTSTREAMCALLBACK diff --git a/netwerk/base/src/nsLoadGroup.cpp b/netwerk/base/src/nsLoadGroup.cpp index 3096f4b5f53..e360293089f 100644 --- a/netwerk/base/src/nsLoadGroup.cpp +++ b/netwerk/base/src/nsLoadGroup.cpp @@ -1048,7 +1048,7 @@ nsresult nsLoadGroup::MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& outFlags class nsLoadGroupConnectionInfo MOZ_FINAL : public nsILoadGroupConnectionInfo { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSILOADGROUPCONNECTIONINFO nsLoadGroupConnectionInfo(); @@ -1057,7 +1057,7 @@ private: nsAutoPtr mSpdyCache3; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsLoadGroupConnectionInfo, nsILoadGroupConnectionInfo) +NS_IMPL_ISUPPORTS1(nsLoadGroupConnectionInfo, nsILoadGroupConnectionInfo) nsLoadGroupConnectionInfo::nsLoadGroupConnectionInfo() : mBlockingTransactionCount(0) diff --git a/netwerk/base/src/nsMIMEInputStream.cpp b/netwerk/base/src/nsMIMEInputStream.cpp index 0e7a47937a3..bd21ae1fa58 100644 --- a/netwerk/base/src/nsMIMEInputStream.cpp +++ b/netwerk/base/src/nsMIMEInputStream.cpp @@ -32,7 +32,7 @@ public: nsMIMEInputStream(); virtual ~nsMIMEInputStream(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSIMIMEINPUTSTREAM NS_DECL_NSISEEKABLESTREAM @@ -65,8 +65,8 @@ private: bool mStartedReading; }; -NS_IMPL_THREADSAFE_ADDREF(nsMIMEInputStream) -NS_IMPL_THREADSAFE_RELEASE(nsMIMEInputStream) +NS_IMPL_ADDREF(nsMIMEInputStream) +NS_IMPL_RELEASE(nsMIMEInputStream) NS_IMPL_CLASSINFO(nsMIMEInputStream, NULL, nsIClassInfo::THREADSAFE, NS_MIMEINPUTSTREAM_CID) diff --git a/netwerk/base/src/nsPACMan.cpp b/netwerk/base/src/nsPACMan.cpp index f3313d03c85..be1a8e08123 100644 --- a/netwerk/base/src/nsPACMan.cpp +++ b/netwerk/base/src/nsPACMan.cpp @@ -562,8 +562,8 @@ nsPACMan::ProcessPending() return true; } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsPACMan, nsIStreamLoaderObserver, - nsIInterfaceRequestor, nsIChannelEventSink) +NS_IMPL_ISUPPORTS3(nsPACMan, nsIStreamLoaderObserver, + nsIInterfaceRequestor, nsIChannelEventSink) NS_IMETHODIMP nsPACMan::OnStreamComplete(nsIStreamLoader *loader, diff --git a/netwerk/base/src/nsPACMan.h b/netwerk/base/src/nsPACMan.h index 7d092829308..df1e2b8f823 100644 --- a/netwerk/base/src/nsPACMan.h +++ b/netwerk/base/src/nsPACMan.h @@ -83,7 +83,7 @@ class nsPACMan MOZ_FINAL : public nsIStreamLoaderObserver , public nsIChannelEventSink { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsPACMan(); diff --git a/netwerk/base/src/nsPreloadedStream.cpp b/netwerk/base/src/nsPreloadedStream.cpp index 408f36d84aa..c1a09833820 100644 --- a/netwerk/base/src/nsPreloadedStream.cpp +++ b/netwerk/base/src/nsPreloadedStream.cpp @@ -13,9 +13,9 @@ namespace mozilla { namespace net { -NS_IMPL_THREADSAFE_ISUPPORTS2(nsPreloadedStream, - nsIInputStream, - nsIAsyncInputStream) +NS_IMPL_ISUPPORTS2(nsPreloadedStream, + nsIInputStream, + nsIAsyncInputStream) nsPreloadedStream::nsPreloadedStream(nsIAsyncInputStream *aStream, const char *data, uint32_t datalen) diff --git a/netwerk/base/src/nsPreloadedStream.h b/netwerk/base/src/nsPreloadedStream.h index 7c8d7a1f0a2..323e9fa6e69 100644 --- a/netwerk/base/src/nsPreloadedStream.h +++ b/netwerk/base/src/nsPreloadedStream.h @@ -30,7 +30,7 @@ namespace net { class nsPreloadedStream MOZ_FINAL : public nsIAsyncInputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM diff --git a/netwerk/base/src/nsProtocolProxyService.cpp b/netwerk/base/src/nsProtocolProxyService.cpp index 19e1d6fc412..cd0b32df571 100644 --- a/netwerk/base/src/nsProtocolProxyService.cpp +++ b/netwerk/base/src/nsProtocolProxyService.cpp @@ -76,7 +76,7 @@ class nsAsyncResolveRequest MOZ_FINAL : public nsIRunnable , public nsICancelable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIURI *uri, uint32_t aResolveFlags, @@ -273,7 +273,7 @@ private: nsCOMPtr mProxyInfo; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsAsyncResolveRequest, nsICancelable, nsIRunnable) +NS_IMPL_ISUPPORTS2(nsAsyncResolveRequest, nsICancelable, nsIRunnable) //---------------------------------------------------------------------------- @@ -972,7 +972,7 @@ nsProtocolProxyService::ReloadPAC() // a false mainThreadResponse parameter. class nsAsyncBridgeRequest MOZ_FINAL : public nsPACManCallback { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsAsyncBridgeRequest() : mMutex("nsDeprecatedCallback") @@ -1012,7 +1012,7 @@ private: nsCString mPACURL; bool mCompleted; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsAsyncBridgeRequest, nsPACManCallback) +NS_IMPL_ISUPPORTS1(nsAsyncBridgeRequest, nsPACManCallback) // nsIProtocolProxyService2 NS_IMETHODIMP diff --git a/netwerk/base/src/nsProxyInfo.cpp b/netwerk/base/src/nsProxyInfo.cpp index d21e579f3c4..fd54abcee56 100644 --- a/netwerk/base/src/nsProxyInfo.cpp +++ b/netwerk/base/src/nsProxyInfo.cpp @@ -8,7 +8,7 @@ #include "nsCOMPtr.h" // Yes, we support QI to nsProxyInfo -NS_IMPL_THREADSAFE_ISUPPORTS2(nsProxyInfo, nsProxyInfo, nsIProxyInfo) +NS_IMPL_ISUPPORTS2(nsProxyInfo, nsProxyInfo, nsIProxyInfo) using namespace mozilla; diff --git a/netwerk/base/src/nsProxyInfo.h b/netwerk/base/src/nsProxyInfo.h index 9f11f041f42..550bbf2d3a2 100644 --- a/netwerk/base/src/nsProxyInfo.h +++ b/netwerk/base/src/nsProxyInfo.h @@ -27,7 +27,7 @@ class nsProxyInfo MOZ_FINAL : public nsIProxyInfo public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROXYINFO_IID) - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROXYINFO // Cheap accessors for use within Necko diff --git a/netwerk/base/src/nsRequestObserverProxy.cpp b/netwerk/base/src/nsRequestObserverProxy.cpp index 7e3c8ec6577..cca7ae15185 100644 --- a/netwerk/base/src/nsRequestObserverProxy.cpp +++ b/netwerk/base/src/nsRequestObserverProxy.cpp @@ -115,9 +115,9 @@ public: // nsRequestObserverProxy::nsISupports implementation... //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS2(nsRequestObserverProxy, - nsIRequestObserver, - nsIRequestObserverProxy) +NS_IMPL_ISUPPORTS2(nsRequestObserverProxy, + nsIRequestObserver, + nsIRequestObserverProxy) //----------------------------------------------------------------------------- // nsRequestObserverProxy::nsIRequestObserver implementation... diff --git a/netwerk/base/src/nsRequestObserverProxy.h b/netwerk/base/src/nsRequestObserverProxy.h index 0ec4f55f6c8..db26c99e873 100644 --- a/netwerk/base/src/nsRequestObserverProxy.h +++ b/netwerk/base/src/nsRequestObserverProxy.h @@ -18,7 +18,7 @@ class nsARequestObserverEvent; class nsRequestObserverProxy MOZ_FINAL : public nsIRequestObserverProxy { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSIREQUESTOBSERVERPROXY diff --git a/netwerk/base/src/nsServerSocket.cpp b/netwerk/base/src/nsServerSocket.cpp index 84fd506f07e..cdef53f4f8b 100644 --- a/netwerk/base/src/nsServerSocket.cpp +++ b/netwerk/base/src/nsServerSocket.cpp @@ -244,7 +244,7 @@ nsServerSocket::KeepWhenOffline(bool *aKeepWhenOffline) // nsServerSocket::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS1(nsServerSocket, nsIServerSocket) +NS_IMPL_ISUPPORTS1(nsServerSocket, nsIServerSocket) //----------------------------------------------------------------------------- @@ -364,7 +364,7 @@ public: , mTargetThread(do_GetCurrentThread()) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISERVERSOCKETLISTENER class OnSocketAcceptedRunnable : public nsRunnable @@ -410,8 +410,8 @@ private: nsCOMPtr mTargetThread; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(ServerSocketListenerProxy, - nsIServerSocketListener) +NS_IMPL_ISUPPORTS1(ServerSocketListenerProxy, + nsIServerSocketListener) NS_IMETHODIMP ServerSocketListenerProxy::OnSocketAccepted(nsIServerSocket* aServ, diff --git a/netwerk/base/src/nsServerSocket.h b/netwerk/base/src/nsServerSocket.h index 43735e0ea7e..79c2327bf5b 100644 --- a/netwerk/base/src/nsServerSocket.h +++ b/netwerk/base/src/nsServerSocket.h @@ -16,7 +16,7 @@ class nsServerSocket : public nsASocketHandler , public nsIServerSocket { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISERVERSOCKET // nsASocketHandler methods: diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp index 071cca25544..7ee6f2974d1 100644 --- a/netwerk/base/src/nsSocketTransport2.cpp +++ b/netwerk/base/src/nsSocketTransport2.cpp @@ -235,14 +235,14 @@ NS_IMPL_QUERY_INTERFACE2(nsSocketInputStream, NS_IMETHODIMP_(nsrefcnt) nsSocketInputStream::AddRef() { - NS_AtomicIncrementRefcnt(mReaderRefCnt); + ++mReaderRefCnt; return mTransport->AddRef(); } NS_IMETHODIMP_(nsrefcnt) nsSocketInputStream::Release() { - if (NS_AtomicDecrementRefcnt(mReaderRefCnt) == 0) + if (--mReaderRefCnt == 0) Close(); return mTransport->Release(); } @@ -498,14 +498,14 @@ NS_IMPL_QUERY_INTERFACE2(nsSocketOutputStream, NS_IMETHODIMP_(nsrefcnt) nsSocketOutputStream::AddRef() { - NS_AtomicIncrementRefcnt(mWriterRefCnt); + ++mWriterRefCnt; return mTransport->AddRef(); } NS_IMETHODIMP_(nsrefcnt) nsSocketOutputStream::Release() { - if (NS_AtomicDecrementRefcnt(mWriterRefCnt) == 0) + if (--mWriterRefCnt == 0) Close(); return mTransport->Release(); } @@ -1732,11 +1732,11 @@ nsSocketTransport::IsLocal(bool *aIsLocal) //----------------------------------------------------------------------------- // xpcom api -NS_IMPL_THREADSAFE_ISUPPORTS4(nsSocketTransport, - nsISocketTransport, - nsITransport, - nsIDNSListener, - nsIClassInfo) +NS_IMPL_ISUPPORTS4(nsSocketTransport, + nsISocketTransport, + nsITransport, + nsIDNSListener, + nsIClassInfo) NS_IMPL_CI_INTERFACE_GETTER3(nsSocketTransport, nsISocketTransport, nsITransport, diff --git a/netwerk/base/src/nsSocketTransport2.h b/netwerk/base/src/nsSocketTransport2.h index 73cb3feaacf..9943ae2c49c 100644 --- a/netwerk/base/src/nsSocketTransport2.h +++ b/netwerk/base/src/nsSocketTransport2.h @@ -57,7 +57,7 @@ public: private: nsSocketTransport *mTransport; - nsrefcnt mReaderRefCnt; + mozilla::ThreadSafeAutoRefCnt mReaderRefCnt; // access to these is protected by mTransport->mLock nsresult mCondition; @@ -91,7 +91,7 @@ private: uint32_t count, uint32_t *countRead); nsSocketTransport *mTransport; - nsrefcnt mWriterRefCnt; + mozilla::ThreadSafeAutoRefCnt mWriterRefCnt; // access to these is protected by mTransport->mLock nsresult mCondition; @@ -110,7 +110,7 @@ class nsSocketTransport : public nsASocketHandler typedef mozilla::Mutex Mutex; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITRANSPORT NS_DECL_NSISOCKETTRANSPORT NS_DECL_NSIDNSLISTENER diff --git a/netwerk/base/src/nsSocketTransportService2.cpp b/netwerk/base/src/nsSocketTransportService2.cpp index a3d555d8bc6..c6e3fa233d9 100644 --- a/netwerk/base/src/nsSocketTransportService2.cpp +++ b/netwerk/base/src/nsSocketTransportService2.cpp @@ -401,13 +401,13 @@ nsSocketTransportService::Poll(bool wait, uint32_t *interval) //----------------------------------------------------------------------------- // xpcom api -NS_IMPL_THREADSAFE_ISUPPORTS6(nsSocketTransportService, - nsISocketTransportService, - nsIEventTarget, - nsIThreadObserver, - nsIRunnable, - nsPISocketTransportService, - nsIObserver) +NS_IMPL_ISUPPORTS6(nsSocketTransportService, + nsISocketTransportService, + nsIEventTarget, + nsIThreadObserver, + nsIRunnable, + nsPISocketTransportService, + nsIObserver) // called from main thread only NS_IMETHODIMP diff --git a/netwerk/base/src/nsSocketTransportService2.h b/netwerk/base/src/nsSocketTransportService2.h index e3ea11b4034..a8744b96153 100644 --- a/netwerk/base/src/nsSocketTransportService2.h +++ b/netwerk/base/src/nsSocketTransportService2.h @@ -47,7 +47,7 @@ class nsSocketTransportService : public nsPISocketTransportService typedef mozilla::Mutex Mutex; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSPISOCKETTRANSPORTSERVICE NS_DECL_NSISOCKETTRANSPORTSERVICE NS_DECL_NSIEVENTTARGET diff --git a/netwerk/base/src/nsStreamListenerTee.cpp b/netwerk/base/src/nsStreamListenerTee.cpp index 625cd75efa7..b438dee646b 100644 --- a/netwerk/base/src/nsStreamListenerTee.cpp +++ b/netwerk/base/src/nsStreamListenerTee.cpp @@ -5,11 +5,11 @@ #include "nsStreamListenerTee.h" #include "nsProxyRelease.h" -NS_IMPL_THREADSAFE_ISUPPORTS4(nsStreamListenerTee, - nsIStreamListener, - nsIRequestObserver, - nsIStreamListenerTee, - nsIThreadRetargetableStreamListener) +NS_IMPL_ISUPPORTS4(nsStreamListenerTee, + nsIStreamListener, + nsIRequestObserver, + nsIStreamListenerTee, + nsIThreadRetargetableStreamListener) NS_IMETHODIMP nsStreamListenerTee::OnStartRequest(nsIRequest *request, diff --git a/netwerk/base/src/nsStreamListenerTee.h b/netwerk/base/src/nsStreamListenerTee.h index 601f3b5e9ad..cf2b6b2ea20 100644 --- a/netwerk/base/src/nsStreamListenerTee.h +++ b/netwerk/base/src/nsStreamListenerTee.h @@ -16,7 +16,7 @@ class nsStreamListenerTee : public nsIStreamListenerTee , public nsIThreadRetargetableStreamListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER diff --git a/netwerk/base/src/nsStreamTransportService.cpp b/netwerk/base/src/nsStreamTransportService.cpp index 817aed84b74..01c4c88c887 100644 --- a/netwerk/base/src/nsStreamTransportService.cpp +++ b/netwerk/base/src/nsStreamTransportService.cpp @@ -32,7 +32,7 @@ class nsInputStreamTransport : public nsITransport , public nsIInputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITRANSPORT NS_DECL_NSIINPUTSTREAM @@ -70,9 +70,9 @@ private: bool mInProgress; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsInputStreamTransport, - nsITransport, - nsIInputStream) +NS_IMPL_ISUPPORTS2(nsInputStreamTransport, + nsITransport, + nsIInputStream) /** nsITransport **/ @@ -232,7 +232,7 @@ class nsOutputStreamTransport : public nsITransport , public nsIOutputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITRANSPORT NS_DECL_NSIOUTPUTSTREAM @@ -270,9 +270,9 @@ private: bool mInProgress; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsOutputStreamTransport, - nsITransport, - nsIOutputStream) +NS_IMPL_ISUPPORTS2(nsOutputStreamTransport, + nsITransport, + nsIOutputStream) /** nsITransport **/ @@ -454,10 +454,10 @@ nsStreamTransportService::Init() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsStreamTransportService, - nsIStreamTransportService, - nsIEventTarget, - nsIObserver) +NS_IMPL_ISUPPORTS3(nsStreamTransportService, + nsIStreamTransportService, + nsIEventTarget, + nsIObserver) NS_IMETHODIMP nsStreamTransportService::Dispatch(nsIRunnable *task, uint32_t flags) diff --git a/netwerk/base/src/nsStreamTransportService.h b/netwerk/base/src/nsStreamTransportService.h index 0b01a8bd4d2..b198640fa8c 100644 --- a/netwerk/base/src/nsStreamTransportService.h +++ b/netwerk/base/src/nsStreamTransportService.h @@ -14,7 +14,7 @@ class nsStreamTransportService MOZ_FINAL : public nsIStreamTransportService , public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTREAMTRANSPORTSERVICE NS_DECL_NSIEVENTTARGET NS_DECL_NSIOBSERVER diff --git a/netwerk/base/src/nsTemporaryFileInputStream.cpp b/netwerk/base/src/nsTemporaryFileInputStream.cpp index 3da64a89763..030c21982e2 100644 --- a/netwerk/base/src/nsTemporaryFileInputStream.cpp +++ b/netwerk/base/src/nsTemporaryFileInputStream.cpp @@ -6,7 +6,7 @@ #include "nsTemporaryFileInputStream.h" #include "nsStreamUtils.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsTemporaryFileInputStream, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsTemporaryFileInputStream, nsIInputStream) nsTemporaryFileInputStream::nsTemporaryFileInputStream(FileDescOwner* aFileDescOwner, uint64_t aStartPos, uint64_t aEndPos) : mFileDescOwner(aFileDescOwner), diff --git a/netwerk/base/src/nsTemporaryFileInputStream.h b/netwerk/base/src/nsTemporaryFileInputStream.h index 5eb086bb8aa..cb86146ec69 100644 --- a/netwerk/base/src/nsTemporaryFileInputStream.h +++ b/netwerk/base/src/nsTemporaryFileInputStream.h @@ -39,7 +39,7 @@ public: virtual ~nsTemporaryFileInputStream() { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM private: diff --git a/netwerk/base/src/nsTransportUtils.cpp b/netwerk/base/src/nsTransportUtils.cpp index 1b1845d32ac..39e5d8f6bba 100644 --- a/netwerk/base/src/nsTransportUtils.cpp +++ b/netwerk/base/src/nsTransportUtils.cpp @@ -19,7 +19,7 @@ class nsTransportStatusEvent; class nsTransportEventSinkProxy : public nsITransportEventSink { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITRANSPORTEVENTSINK nsTransportEventSinkProxy(nsITransportEventSink *sink, @@ -89,7 +89,7 @@ public: uint64_t mProgressMax; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsTransportEventSinkProxy, nsITransportEventSink) +NS_IMPL_ISUPPORTS1(nsTransportEventSinkProxy, nsITransportEventSink) NS_IMETHODIMP nsTransportEventSinkProxy::OnTransportStatus(nsITransport *transport, diff --git a/netwerk/base/src/nsUDPServerSocket.cpp b/netwerk/base/src/nsUDPServerSocket.cpp index 26c534a30c5..a524a27cbe7 100644 --- a/netwerk/base/src/nsUDPServerSocket.cpp +++ b/netwerk/base/src/nsUDPServerSocket.cpp @@ -43,7 +43,7 @@ PostEvent(nsUDPServerSocket *s, nsUDPServerSocketFunc func) //----------------------------------------------------------------------------- // nsUPDOutputStream impl //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPOutputStream, nsIOutputStream) +NS_IMPL_ISUPPORTS1(nsUDPOutputStream, nsIOutputStream) nsUDPOutputStream::nsUDPOutputStream(nsUDPServerSocket* aServer, PRFileDesc* aFD, @@ -117,7 +117,7 @@ NS_IMETHODIMP nsUDPOutputStream::IsNonBlocking(bool *_retval) //----------------------------------------------------------------------------- // nsUPDMessage impl //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPMessage, nsIUDPMessage) +NS_IMPL_ISUPPORTS1(nsUDPMessage, nsIUDPMessage) nsUDPMessage::nsUDPMessage(PRNetAddr* aAddr, nsIOutputStream* aOutputStream, @@ -383,7 +383,7 @@ nsUDPServerSocket::IsLocal(bool *aIsLocal) // nsServerSocket::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPServerSocket, nsIUDPServerSocket) +NS_IMPL_ISUPPORTS1(nsUDPServerSocket, nsIUDPServerSocket) //----------------------------------------------------------------------------- @@ -517,7 +517,7 @@ public: , mTargetThread(do_GetCurrentThread()) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIUDPSERVERSOCKETLISTENER class OnPacketReceivedRunnable : public nsRunnable @@ -563,8 +563,8 @@ private: nsCOMPtr mTargetThread; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(ServerSocketListenerProxy, - nsIUDPServerSocketListener) +NS_IMPL_ISUPPORTS1(ServerSocketListenerProxy, + nsIUDPServerSocketListener) NS_IMETHODIMP ServerSocketListenerProxy::OnPacketReceived(nsIUDPServerSocket* aServ, diff --git a/netwerk/base/src/nsUDPServerSocket.h b/netwerk/base/src/nsUDPServerSocket.h index 0900aa46555..183ac7f9f93 100644 --- a/netwerk/base/src/nsUDPServerSocket.h +++ b/netwerk/base/src/nsUDPServerSocket.h @@ -17,7 +17,7 @@ class nsUDPServerSocket : public nsASocketHandler , public nsIUDPServerSocket { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIUDPSERVERSOCKET // nsASocketHandler methods: @@ -61,7 +61,7 @@ private: class nsUDPMessage : public nsIUDPMessage { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIUDPMESSAGE nsUDPMessage(PRNetAddr* aAddr, @@ -82,7 +82,7 @@ private: class nsUDPOutputStream : public nsIOutputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM nsUDPOutputStream(nsUDPServerSocket* aServer, diff --git a/netwerk/base/src/nsURLParsers.cpp b/netwerk/base/src/nsURLParsers.cpp index 03cfd7428a2..5b4984b8dde 100644 --- a/netwerk/base/src/nsURLParsers.cpp +++ b/netwerk/base/src/nsURLParsers.cpp @@ -32,11 +32,8 @@ CountConsecutiveSlashes(const char *str, int32_t len) // nsBaseURLParser implementation //---------------------------------------------------------------------------- -// The URL parser service does not have any internal state; however, it can -// be called from multiple threads, so we must use a threadsafe AddRef and -// Release implementation. -NS_IMPL_THREADSAFE_ISUPPORTS1(nsAuthURLParser, nsIURLParser) -NS_IMPL_THREADSAFE_ISUPPORTS1(nsNoAuthURLParser, nsIURLParser) +NS_IMPL_ISUPPORTS1(nsAuthURLParser, nsIURLParser) +NS_IMPL_ISUPPORTS1(nsNoAuthURLParser, nsIURLParser) #define SET_RESULT(component, pos, len) \ PR_BEGIN_MACRO \ diff --git a/netwerk/base/src/nsURLParsers.h b/netwerk/base/src/nsURLParsers.h index e3849dd2c1d..e49bd5d7d60 100644 --- a/netwerk/base/src/nsURLParsers.h +++ b/netwerk/base/src/nsURLParsers.h @@ -43,7 +43,7 @@ protected: class nsNoAuthURLParser MOZ_FINAL : public nsBaseURLParser { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS #if defined(XP_WIN) || defined(XP_OS2) NS_IMETHOD ParseFilePath(const char *, int32_t, @@ -75,7 +75,7 @@ public: class nsAuthURLParser : public nsBaseURLParser { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS virtual ~nsAuthURLParser() {} diff --git a/netwerk/cache/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp index 7c23840197f..d6592a772ce 100644 --- a/netwerk/cache/nsCacheEntryDescriptor.cpp +++ b/netwerk/cache/nsCacheEntryDescriptor.cpp @@ -70,9 +70,9 @@ private: }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsCacheEntryDescriptor, - nsICacheEntryDescriptor, - nsICacheEntryInfo) +NS_IMPL_ISUPPORTS2(nsCacheEntryDescriptor, + nsICacheEntryDescriptor, + nsICacheEntryInfo) nsCacheEntryDescriptor::nsCacheEntryDescriptor(nsCacheEntry * entry, nsCacheAccessMode accessGranted) @@ -654,7 +654,7 @@ nsCacheEntryDescriptor::VisitMetaData(nsICacheMetaDataVisitor * visitor) * open while referenced. ******************************************************************************/ -NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsInputStreamWrapper) +NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsInputStreamWrapper) NS_IMETHODIMP_(nsrefcnt) nsCacheEntryDescriptor::nsInputStreamWrapper::Release() { @@ -672,7 +672,7 @@ nsCacheEntryDescriptor::nsInputStreamWrapper::Release() nsrefcnt count; NS_PRECONDITION(0 != mRefCnt, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; NS_LOG_RELEASE(this, count, "nsCacheEntryDescriptor::nsInputStreamWrapper"); if (0 == count) { @@ -846,7 +846,7 @@ nsInputStreamWrapper::IsNonBlocking(bool *result) * nsDecompressInputStreamWrapper - an input stream wrapper that decompresses ******************************************************************************/ -NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsDecompressInputStreamWrapper) +NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsDecompressInputStreamWrapper) NS_IMETHODIMP_(nsrefcnt) nsCacheEntryDescriptor::nsDecompressInputStreamWrapper::Release() { @@ -865,7 +865,7 @@ nsCacheEntryDescriptor::nsDecompressInputStreamWrapper::Release() nsrefcnt count; NS_PRECONDITION(0 != mRefCnt, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; NS_LOG_RELEASE(this, count, "nsCacheEntryDescriptor::nsDecompressInputStreamWrapper"); @@ -1036,7 +1036,7 @@ nsDecompressInputStreamWrapper::EndZstream() * - also keeps the cache entry open while referenced. ******************************************************************************/ -NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsOutputStreamWrapper) +NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsOutputStreamWrapper) NS_IMETHODIMP_(nsrefcnt) nsCacheEntryDescriptor::nsOutputStreamWrapper::Release() { @@ -1054,7 +1054,7 @@ nsCacheEntryDescriptor::nsOutputStreamWrapper::Release() nsrefcnt count; NS_PRECONDITION(0 != mRefCnt, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; NS_LOG_RELEASE(this, count, "nsCacheEntryDescriptor::nsOutputStreamWrapper"); @@ -1266,7 +1266,7 @@ nsOutputStreamWrapper::IsNonBlocking(bool *result) * data before it is written ******************************************************************************/ -NS_IMPL_THREADSAFE_ADDREF(nsCacheEntryDescriptor::nsCompressOutputStreamWrapper) +NS_IMPL_ADDREF(nsCacheEntryDescriptor::nsCompressOutputStreamWrapper) NS_IMETHODIMP_(nsrefcnt) nsCacheEntryDescriptor::nsCompressOutputStreamWrapper::Release() { @@ -1284,7 +1284,7 @@ nsCacheEntryDescriptor::nsCompressOutputStreamWrapper::Release() nsrefcnt count; NS_PRECONDITION(0 != mRefCnt, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; NS_LOG_RELEASE(this, count, "nsCacheEntryDescriptor::nsCompressOutputStreamWrapper"); diff --git a/netwerk/cache/nsCacheEntryDescriptor.h b/netwerk/cache/nsCacheEntryDescriptor.h index 2c59a0788ce..477927aa80d 100644 --- a/netwerk/cache/nsCacheEntryDescriptor.h +++ b/netwerk/cache/nsCacheEntryDescriptor.h @@ -25,7 +25,7 @@ class nsCacheEntryDescriptor : public nsICacheEntryDescriptor { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICACHEENTRYDESCRIPTOR NS_DECL_NSICACHEENTRYINFO @@ -82,7 +82,7 @@ private: bool mInitialized; mozilla::Mutex mLock; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM nsInputStreamWrapper(nsCacheEntryDescriptor * desc, uint32_t off) @@ -115,7 +115,7 @@ private: bool mStreamInitialized; bool mStreamEnded; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsDecompressInputStreamWrapper(nsCacheEntryDescriptor * desc, uint32_t off) @@ -154,7 +154,7 @@ private: bool mInitialized; mozilla::Mutex mLock; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM nsOutputStreamWrapper(nsCacheEntryDescriptor * desc, uint32_t off) @@ -194,7 +194,7 @@ private: bool mStreamEnded; uint32_t mUncompressedCount; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsCompressOutputStreamWrapper(nsCacheEntryDescriptor * desc, uint32_t off) diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index 92970541280..35e92beb936 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -121,7 +121,7 @@ const int32_t PRE_GECKO_2_0_DEFAULT_CACHE_SIZE = 50 * 1024; class nsCacheProfilePrefObserver : public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER nsCacheProfilePrefObserver() @@ -201,12 +201,12 @@ private: bool mClearCacheOnShutdown; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsCacheProfilePrefObserver, nsIObserver) +NS_IMPL_ISUPPORTS1(nsCacheProfilePrefObserver, nsIObserver) class nsSetDiskSmartSizeCallback MOZ_FINAL : public nsITimerCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Notify(nsITimer* aTimer) { if (nsCacheService::gService) { @@ -218,7 +218,7 @@ public: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSetDiskSmartSizeCallback, nsITimerCallback) +NS_IMPL_ISUPPORTS1(nsSetDiskSmartSizeCallback, nsITimerCallback) // Runnable sent to main thread after the cache IO thread calculates available // disk space, so that there is no race in setting mDiskCacheCapacity. @@ -1072,7 +1072,7 @@ private: *****************************************************************************/ nsCacheService * nsCacheService::gService = nullptr; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsCacheService, nsICacheService, nsICacheServiceInternal) +NS_IMPL_ISUPPORTS2(nsCacheService, nsICacheService, nsICacheServiceInternal) nsCacheService::nsCacheService() : mObserver(nullptr), diff --git a/netwerk/cache/nsCacheService.h b/netwerk/cache/nsCacheService.h index 38a8fa665f2..53c42e8409c 100644 --- a/netwerk/cache/nsCacheService.h +++ b/netwerk/cache/nsCacheService.h @@ -64,7 +64,7 @@ private: class nsCacheService : public nsICacheServiceInternal { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICACHESERVICE NS_DECL_NSICACHESERVICEINTERNAL diff --git a/netwerk/cache/nsDiskCacheBinding.cpp b/netwerk/cache/nsDiskCacheBinding.cpp index 558905daa39..50e6a03da42 100644 --- a/netwerk/cache/nsDiskCacheBinding.cpp +++ b/netwerk/cache/nsDiskCacheBinding.cpp @@ -70,7 +70,7 @@ GetCacheEntryBinding(nsCacheEntry * entry) * nsDiskCacheBinding *****************************************************************************/ -NS_IMPL_THREADSAFE_ISUPPORTS0(nsDiskCacheBinding) +NS_IMPL_ISUPPORTS0(nsDiskCacheBinding) nsDiskCacheBinding::nsDiskCacheBinding(nsCacheEntry* entry, nsDiskCacheRecord * record) : mCacheEntry(entry) diff --git a/netwerk/cache/nsDiskCacheBinding.h b/netwerk/cache/nsDiskCacheBinding.h index 0290a9487ac..2f7f508a399 100644 --- a/netwerk/cache/nsDiskCacheBinding.h +++ b/netwerk/cache/nsDiskCacheBinding.h @@ -32,7 +32,7 @@ class nsDiskCacheDeviceDeactivateEntryEvent; class nsDiskCacheBinding : public nsISupports, public PRCList { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsDiskCacheBinding(nsCacheEntry* entry, nsDiskCacheRecord * record); virtual ~nsDiskCacheBinding(); diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.cpp b/netwerk/cache/nsDiskCacheDeviceSQL.cpp index 702ac4b7029..dceecf31713 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp +++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp @@ -150,7 +150,7 @@ DCacheHash(const char * key) * nsOfflineCacheEvictionFunction */ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsOfflineCacheEvictionFunction, mozIStorageFunction) +NS_IMPL_ISUPPORTS1(nsOfflineCacheEvictionFunction, mozIStorageFunction) // helper function for directly exposing the same data file binding // path algorithm used in nsOfflineCacheBinding::Create @@ -347,7 +347,7 @@ nsOfflineCacheDeviceInfo::GetMaximumSize(uint32_t *aMaximumSize) class nsOfflineCacheBinding MOZ_FINAL : public nsISupports { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS static nsOfflineCacheBinding * Create(nsIFile *cacheDir, const nsCString *key, int generation); @@ -363,7 +363,7 @@ public: void ClearNewEntry() { mFlags &= ~FLAG_NEW_ENTRY; } }; -NS_IMPL_THREADSAFE_ISUPPORTS0(nsOfflineCacheBinding) +NS_IMPL_ISUPPORTS0(nsOfflineCacheBinding) nsOfflineCacheBinding * nsOfflineCacheBinding::Create(nsIFile *cacheDir, @@ -875,7 +875,7 @@ private: * nsOfflineCacheDevice */ -NS_IMPL_THREADSAFE_ISUPPORTS0(nsOfflineCacheDevice) +NS_IMPL_ISUPPORTS0(nsOfflineCacheDevice) nsOfflineCacheDevice::nsOfflineCacheDevice() : mDB(nullptr) diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.h b/netwerk/cache/nsDiskCacheDeviceSQL.h index 77adf753e27..0356c44dbaa 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.h +++ b/netwerk/cache/nsDiskCacheDeviceSQL.h @@ -41,7 +41,7 @@ private: class nsOfflineCacheEvictionFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION nsOfflineCacheEvictionFunction(nsOfflineCacheDevice *device) @@ -63,7 +63,7 @@ class nsOfflineCacheDevice : public nsCacheDevice public: nsOfflineCacheDevice(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS /** * nsCacheDevice methods diff --git a/netwerk/cache/nsDiskCacheStreams.cpp b/netwerk/cache/nsDiskCacheStreams.cpp index 447cf3b52b2..795fe780220 100644 --- a/netwerk/cache/nsDiskCacheStreams.cpp +++ b/netwerk/cache/nsDiskCacheStreams.cpp @@ -44,7 +44,7 @@ public: virtual ~nsDiskCacheInputStream(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM private: @@ -57,7 +57,7 @@ private: }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDiskCacheInputStream, nsIInputStream) +NS_IMPL_ISUPPORTS1(nsDiskCacheInputStream, nsIInputStream) nsDiskCacheInputStream::nsDiskCacheInputStream( nsDiskCacheStreamIO * parent, @@ -190,7 +190,7 @@ nsDiskCacheInputStream::IsNonBlocking(bool * nonBlocking) /****************************************************************************** * nsDiskCacheStreamIO *****************************************************************************/ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDiskCacheStreamIO, nsIOutputStream) +NS_IMPL_ISUPPORTS1(nsDiskCacheStreamIO, nsIOutputStream) nsDiskCacheStreamIO::nsDiskCacheStreamIO(nsDiskCacheBinding * binding) : mBinding(binding) diff --git a/netwerk/cache/nsDiskCacheStreams.h b/netwerk/cache/nsDiskCacheStreams.h index b018af60f68..e50f3804c4d 100644 --- a/netwerk/cache/nsDiskCacheStreams.h +++ b/netwerk/cache/nsDiskCacheStreams.h @@ -26,7 +26,7 @@ public: nsDiskCacheStreamIO(nsDiskCacheBinding * binding); virtual ~nsDiskCacheStreamIO(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM nsresult GetInputStream(uint32_t offset, nsIInputStream ** inputStream); diff --git a/netwerk/dns/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp index 64dd0bf0e3a..1250af9df5b 100644 --- a/netwerk/dns/nsDNSService2.cpp +++ b/netwerk/dns/nsDNSService2.cpp @@ -49,7 +49,7 @@ static const char kPrefDnsLocalDomains[] = "network.dns.localDomains"; class nsDNSRecord : public nsIDNSRecord { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDNSRECORD nsDNSRecord(nsHostRecord *hostRecord) @@ -69,7 +69,7 @@ private: bool mDone; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDNSRecord, nsIDNSRecord) +NS_IMPL_ISUPPORTS1(nsDNSRecord, nsIDNSRecord) NS_IMETHODIMP nsDNSRecord::GetCanonicalName(nsACString &result) @@ -246,7 +246,7 @@ class nsDNSAsyncRequest MOZ_FINAL : public nsResolveHostCallback , public nsICancelable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICANCELABLE nsDNSAsyncRequest(nsHostResolver *res, @@ -306,7 +306,7 @@ nsDNSAsyncRequest::EqualsAsyncListener(nsIDNSListener *aListener) return (aListener == mListener); } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDNSAsyncRequest, nsICancelable) +NS_IMPL_ISUPPORTS1(nsDNSAsyncRequest, nsICancelable) NS_IMETHODIMP nsDNSAsyncRequest::Cancel(nsresult reason) @@ -372,7 +372,7 @@ nsDNSService::~nsDNSService() { } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsDNSService, nsIDNSService, nsPIDNSService, +NS_IMPL_ISUPPORTS3(nsDNSService, nsIDNSService, nsPIDNSService, nsIObserver) NS_IMETHODIMP @@ -532,7 +532,7 @@ public: , mTargetThread(aTargetThread) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDNSLISTENER class OnLookupCompleteRunnable : public nsRunnable @@ -562,7 +562,7 @@ private: nsCOMPtr mTargetThread; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(DNSListenerProxy, nsIDNSListener) +NS_IMPL_ISUPPORTS1(DNSListenerProxy, nsIDNSListener) NS_IMETHODIMP DNSListenerProxy::OnLookupComplete(nsICancelable* aRequest, diff --git a/netwerk/dns/nsDNSService2.h b/netwerk/dns/nsDNSService2.h index 6126dd24dba..248d12a7487 100644 --- a/netwerk/dns/nsDNSService2.h +++ b/netwerk/dns/nsDNSService2.h @@ -20,7 +20,7 @@ class nsDNSService MOZ_FINAL : public nsPIDNSService , public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSPIDNSSERVICE NS_DECL_NSIDNSSERVICE NS_DECL_NSIOBSERVER diff --git a/netwerk/dns/nsIDNService.cpp b/netwerk/dns/nsIDNService.cpp index 4e9cf0410bd..7917cd74747 100644 --- a/netwerk/dns/nsIDNService.cpp +++ b/netwerk/dns/nsIDNService.cpp @@ -46,10 +46,10 @@ inline bool isOnlySafeChars(const nsAFlatString& in, //----------------------------------------------------------------------------- /* Implementation file */ -NS_IMPL_THREADSAFE_ISUPPORTS3(nsIDNService, - nsIIDNService, - nsIObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(nsIDNService, + nsIIDNService, + nsIObserver, + nsISupportsWeakReference) nsresult nsIDNService::Init() { diff --git a/netwerk/dns/nsIDNService.h b/netwerk/dns/nsIDNService.h index 705e57ddbfd..75c0637fd3f 100644 --- a/netwerk/dns/nsIDNService.h +++ b/netwerk/dns/nsIDNService.h @@ -27,7 +27,7 @@ class nsIDNService : public nsIIDNService, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIIDNSERVICE NS_DECL_NSIOBSERVER diff --git a/netwerk/ipc/RemoteOpenFileChild.cpp b/netwerk/ipc/RemoteOpenFileChild.cpp index f8135269210..8b60a9adde6 100644 --- a/netwerk/ipc/RemoteOpenFileChild.cpp +++ b/netwerk/ipc/RemoteOpenFileChild.cpp @@ -62,10 +62,10 @@ private: // RemoteOpenFileChild //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS3(RemoteOpenFileChild, - nsIFile, - nsIHashable, - nsICachedFileDescriptorListener) +NS_IMPL_ISUPPORTS3(RemoteOpenFileChild, + nsIFile, + nsIHashable, + nsICachedFileDescriptorListener) RemoteOpenFileChild::RemoteOpenFileChild(const RemoteOpenFileChild& other) : mTabChild(other.mTabChild) diff --git a/netwerk/ipc/RemoteOpenFileChild.h b/netwerk/ipc/RemoteOpenFileChild.h index 70fc6ccbfcd..b691618a67b 100644 --- a/netwerk/ipc/RemoteOpenFileChild.h +++ b/netwerk/ipc/RemoteOpenFileChild.h @@ -59,7 +59,7 @@ public: virtual ~RemoteOpenFileChild(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIFILE NS_DECL_NSIHASHABLE diff --git a/netwerk/protocol/device/AndroidCaptureProvider.cpp b/netwerk/protocol/device/AndroidCaptureProvider.cpp index 145c6000eae..d43757e6ee5 100644 --- a/netwerk/protocol/device/AndroidCaptureProvider.cpp +++ b/netwerk/protocol/device/AndroidCaptureProvider.cpp @@ -17,7 +17,7 @@ using namespace mozilla::net; -NS_IMPL_THREADSAFE_ISUPPORTS2(AndroidCameraInputStream, nsIInputStream, nsIAsyncInputStream) +NS_IMPL_ISUPPORTS2(AndroidCameraInputStream, nsIInputStream, nsIAsyncInputStream) AndroidCameraInputStream::AndroidCameraInputStream() : mWidth(0), mHeight(0), mCamera(0), mHeaderSent(false), mClosed(true), mFrameSize(0), @@ -255,7 +255,7 @@ NS_IMETHODIMP AndroidCameraInputStream::CloseWithStatus(nsresult status) * AndroidCaptureProvider implementation */ -NS_IMPL_THREADSAFE_ISUPPORTS0(AndroidCaptureProvider) +NS_IMPL_ISUPPORTS0(AndroidCaptureProvider) AndroidCaptureProvider* AndroidCaptureProvider::sInstance = NULL; diff --git a/netwerk/protocol/device/AndroidCaptureProvider.h b/netwerk/protocol/device/AndroidCaptureProvider.h index 6320870f0bf..92f7cb141c6 100644 --- a/netwerk/protocol/device/AndroidCaptureProvider.h +++ b/netwerk/protocol/device/AndroidCaptureProvider.h @@ -21,7 +21,7 @@ class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider { AndroidCaptureProvider(); ~AndroidCaptureProvider(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsresult Init(nsACString& aContentType, nsCaptureParams* aParams, nsIInputStream** aStream); static AndroidCaptureProvider* sInstance; @@ -34,7 +34,7 @@ class AndroidCameraInputStream MOZ_FINAL : public nsIAsyncInputStream, mozilla:: NS_IMETHODIMP Init(nsACString& aContentType, nsCaptureParams* aParams); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSIASYNCINPUTSTREAM diff --git a/netwerk/protocol/device/nsDeviceProtocolHandler.cpp b/netwerk/protocol/device/nsDeviceProtocolHandler.cpp index 0ef739fd33e..8917aeb0e04 100644 --- a/netwerk/protocol/device/nsDeviceProtocolHandler.cpp +++ b/netwerk/protocol/device/nsDeviceProtocolHandler.cpp @@ -12,8 +12,8 @@ //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS1(nsDeviceProtocolHandler, - nsIProtocolHandler) +NS_IMPL_ISUPPORTS1(nsDeviceProtocolHandler, + nsIProtocolHandler) nsresult nsDeviceProtocolHandler::Init(){ diff --git a/netwerk/protocol/device/nsDeviceProtocolHandler.h b/netwerk/protocol/device/nsDeviceProtocolHandler.h index 459c96a60ee..bc72708a357 100644 --- a/netwerk/protocol/device/nsDeviceProtocolHandler.h +++ b/netwerk/protocol/device/nsDeviceProtocolHandler.h @@ -17,7 +17,7 @@ class nsDeviceProtocolHandler MOZ_FINAL : public nsIProtocolHandler { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER nsDeviceProtocolHandler() {} diff --git a/netwerk/protocol/file/nsFileProtocolHandler.cpp b/netwerk/protocol/file/nsFileProtocolHandler.cpp index eab73befe89..2b7666480af 100644 --- a/netwerk/protocol/file/nsFileProtocolHandler.cpp +++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp @@ -51,10 +51,10 @@ nsFileProtocolHandler::Init() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsFileProtocolHandler, - nsIFileProtocolHandler, - nsIProtocolHandler, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(nsFileProtocolHandler, + nsIFileProtocolHandler, + nsIProtocolHandler, + nsISupportsWeakReference) //----------------------------------------------------------------------------- // nsIProtocolHandler methods: diff --git a/netwerk/protocol/file/nsFileProtocolHandler.h b/netwerk/protocol/file/nsFileProtocolHandler.h index f3f03fde74a..e0e4c27028e 100644 --- a/netwerk/protocol/file/nsFileProtocolHandler.h +++ b/netwerk/protocol/file/nsFileProtocolHandler.h @@ -13,7 +13,7 @@ class nsFileProtocolHandler : public nsIFileProtocolHandler , public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_DECL_NSIFILEPROTOCOLHANDLER diff --git a/netwerk/protocol/ftp/nsFTPChannel.cpp b/netwerk/protocol/ftp/nsFTPChannel.cpp index d7deeebb9da..1f21bf6a018 100644 --- a/netwerk/protocol/ftp/nsFTPChannel.cpp +++ b/netwerk/protocol/ftp/nsFTPChannel.cpp @@ -159,7 +159,7 @@ public: , mTargetThread(do_GetCurrentThread()) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIFTPEVENTSINK class OnFTPControlLogRunnable : public nsRunnable @@ -186,7 +186,7 @@ private: nsCOMPtr mTargetThread; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(FTPEventSinkProxy, nsIFTPEventSink) +NS_IMPL_ISUPPORTS1(FTPEventSinkProxy, nsIFTPEventSink) NS_IMETHODIMP FTPEventSinkProxy::OnFTPControlLog(bool aServer, const char* aMsg) diff --git a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp index d6605ce36b2..baab7e6b164 100644 --- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp +++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp @@ -94,11 +94,11 @@ nsFtpProtocolHandler::~nsFtpProtocolHandler() gFtpHandler = nullptr; } -NS_IMPL_THREADSAFE_ISUPPORTS4(nsFtpProtocolHandler, - nsIProtocolHandler, - nsIProxiedProtocolHandler, - nsIObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS4(nsFtpProtocolHandler, + nsIProtocolHandler, + nsIProxiedProtocolHandler, + nsIObserver, + nsISupportsWeakReference) nsresult nsFtpProtocolHandler::Init() diff --git a/netwerk/protocol/ftp/nsFtpProtocolHandler.h b/netwerk/protocol/ftp/nsFtpProtocolHandler.h index afc21cc3396..8a571b7f91d 100644 --- a/netwerk/protocol/ftp/nsFtpProtocolHandler.h +++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.h @@ -28,7 +28,7 @@ class nsFtpProtocolHandler : public nsIProxiedProtocolHandler , public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_DECL_NSIPROXIEDPROTOCOLHANDLER NS_DECL_NSIOBSERVER diff --git a/netwerk/protocol/http/NullHttpTransaction.cpp b/netwerk/protocol/http/NullHttpTransaction.cpp index e357775e8bd..8fc9f25b755 100644 --- a/netwerk/protocol/http/NullHttpTransaction.cpp +++ b/netwerk/protocol/http/NullHttpTransaction.cpp @@ -15,7 +15,7 @@ namespace mozilla { namespace net { -NS_IMPL_THREADSAFE_ISUPPORTS0(NullHttpTransaction) +NS_IMPL_ISUPPORTS0(NullHttpTransaction) NullHttpTransaction::NullHttpTransaction(nsHttpConnectionInfo *ci, nsIInterfaceRequestor *callbacks, diff --git a/netwerk/protocol/http/NullHttpTransaction.h b/netwerk/protocol/http/NullHttpTransaction.h index 79eafc3f25d..31c4930e2b8 100644 --- a/netwerk/protocol/http/NullHttpTransaction.h +++ b/netwerk/protocol/http/NullHttpTransaction.h @@ -24,7 +24,7 @@ namespace mozilla { namespace net { class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPTRANSACTION NullHttpTransaction(nsHttpConnectionInfo *ci, diff --git a/netwerk/protocol/http/SpdyPush3.cpp b/netwerk/protocol/http/SpdyPush3.cpp index fca9cc7fb9a..70b0998d19d 100644 --- a/netwerk/protocol/http/SpdyPush3.cpp +++ b/netwerk/protocol/http/SpdyPush3.cpp @@ -208,7 +208,7 @@ SpdyPushCache3::RemovePushedStream(nsCString key) // stream has not yet been matched with a pull request ////////////////////////////////////////// -NS_IMPL_THREADSAFE_ISUPPORTS0(SpdyPush3TransactionBuffer) +NS_IMPL_ISUPPORTS0(SpdyPush3TransactionBuffer) SpdyPush3TransactionBuffer::SpdyPush3TransactionBuffer() : mStatus(NS_OK) diff --git a/netwerk/protocol/http/SpdyPush3.h b/netwerk/protocol/http/SpdyPush3.h index b3fa0dbd2b8..8505080d290 100644 --- a/netwerk/protocol/http/SpdyPush3.h +++ b/netwerk/protocol/http/SpdyPush3.h @@ -73,7 +73,7 @@ private: class SpdyPush3TransactionBuffer MOZ_FINAL : public nsAHttpTransaction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPTRANSACTION SpdyPush3TransactionBuffer(); diff --git a/netwerk/protocol/http/SpdySession2.cpp b/netwerk/protocol/http/SpdySession2.cpp index b705ddde6ad..caeb8bd9c37 100644 --- a/netwerk/protocol/http/SpdySession2.cpp +++ b/netwerk/protocol/http/SpdySession2.cpp @@ -29,8 +29,8 @@ namespace net { // SpdySession2 has multiple inheritance of things that implement // nsISupports, so this magic is taken from nsHttpPipeline that // implements some of the same abstract classes. -NS_IMPL_THREADSAFE_ADDREF(SpdySession2) -NS_IMPL_THREADSAFE_RELEASE(SpdySession2) +NS_IMPL_ADDREF(SpdySession2) +NS_IMPL_RELEASE(SpdySession2) NS_INTERFACE_MAP_BEGIN(SpdySession2) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsAHttpConnection) NS_INTERFACE_MAP_END diff --git a/netwerk/protocol/http/SpdySession2.h b/netwerk/protocol/http/SpdySession2.h index cd5f0a10c8c..e518aae7e65 100644 --- a/netwerk/protocol/http/SpdySession2.h +++ b/netwerk/protocol/http/SpdySession2.h @@ -31,7 +31,7 @@ class SpdySession2 MOZ_FINAL : public ASpdySession , public nsAHttpSegmentWriter { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPTRANSACTION NS_DECL_NSAHTTPCONNECTION(mConnection) NS_DECL_NSAHTTPSEGMENTREADER diff --git a/netwerk/protocol/http/SpdySession3.cpp b/netwerk/protocol/http/SpdySession3.cpp index eec9994e4f7..66af37ae1ab 100644 --- a/netwerk/protocol/http/SpdySession3.cpp +++ b/netwerk/protocol/http/SpdySession3.cpp @@ -32,8 +32,8 @@ namespace net { // SpdySession3 has multiple inheritance of things that implement // nsISupports, so this magic is taken from nsHttpPipeline that // implements some of the same abstract classes. -NS_IMPL_THREADSAFE_ADDREF(SpdySession3) -NS_IMPL_THREADSAFE_RELEASE(SpdySession3) +NS_IMPL_ADDREF(SpdySession3) +NS_IMPL_RELEASE(SpdySession3) NS_INTERFACE_MAP_BEGIN(SpdySession3) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsAHttpConnection) NS_INTERFACE_MAP_END diff --git a/netwerk/protocol/http/SpdySession3.h b/netwerk/protocol/http/SpdySession3.h index 7e215c0ddf0..97e9ab2c072 100644 --- a/netwerk/protocol/http/SpdySession3.h +++ b/netwerk/protocol/http/SpdySession3.h @@ -29,7 +29,7 @@ class SpdySession3 MOZ_FINAL : public ASpdySession , public nsAHttpSegmentWriter { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPTRANSACTION NS_DECL_NSAHTTPCONNECTION(mConnection) NS_DECL_NSAHTTPSEGMENTREADER diff --git a/netwerk/protocol/http/nsHttpActivityDistributor.cpp b/netwerk/protocol/http/nsHttpActivityDistributor.cpp index 4d38ce7d76e..683931b9fa7 100644 --- a/netwerk/protocol/http/nsHttpActivityDistributor.cpp +++ b/netwerk/protocol/http/nsHttpActivityDistributor.cpp @@ -61,9 +61,9 @@ private: ObserverArray mObservers; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsHttpActivityDistributor, - nsIHttpActivityDistributor, - nsIHttpActivityObserver) +NS_IMPL_ISUPPORTS2(nsHttpActivityDistributor, + nsIHttpActivityDistributor, + nsIHttpActivityObserver) nsHttpActivityDistributor::nsHttpActivityDistributor() : mLock("nsHttpActivityDistributor.mLock") diff --git a/netwerk/protocol/http/nsHttpActivityDistributor.h b/netwerk/protocol/http/nsHttpActivityDistributor.h index 460da0c7c83..c92ffbb51d5 100644 --- a/netwerk/protocol/http/nsHttpActivityDistributor.h +++ b/netwerk/protocol/http/nsHttpActivityDistributor.h @@ -15,7 +15,7 @@ class nsHttpActivityDistributor : public nsIHttpActivityDistributor { public: typedef nsTArray > ObserverArray; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIHTTPACTIVITYOBSERVER NS_DECL_NSIHTTPACTIVITYDISTRIBUTOR diff --git a/netwerk/protocol/http/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp index e0c105ce61e..986a7549feb 100644 --- a/netwerk/protocol/http/nsHttpConnection.cpp +++ b/netwerk/protocol/http/nsHttpConnection.cpp @@ -1514,11 +1514,11 @@ nsHttpConnection::SetupProxyConnect() // nsHttpConnection::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS4(nsHttpConnection, - nsIInputStreamCallback, - nsIOutputStreamCallback, - nsITransportEventSink, - nsIInterfaceRequestor) +NS_IMPL_ISUPPORTS4(nsHttpConnection, + nsIInputStreamCallback, + nsIOutputStreamCallback, + nsITransportEventSink, + nsIInterfaceRequestor) //----------------------------------------------------------------------------- // nsHttpConnection::nsIInputStreamCallback diff --git a/netwerk/protocol/http/nsHttpConnection.h b/netwerk/protocol/http/nsHttpConnection.h index 9f4ca58855c..34ce7209a75 100644 --- a/netwerk/protocol/http/nsHttpConnection.h +++ b/netwerk/protocol/http/nsHttpConnection.h @@ -41,7 +41,7 @@ class nsHttpConnection : public nsAHttpSegmentReader , public nsIInterfaceRequestor { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPSEGMENTREADER NS_DECL_NSAHTTPSEGMENTWRITER NS_DECL_NSIINPUTSTREAMCALLBACK diff --git a/netwerk/protocol/http/nsHttpConnectionInfo.h b/netwerk/protocol/http/nsHttpConnectionInfo.h index 0863063e983..699679b7606 100644 --- a/netwerk/protocol/http/nsHttpConnectionInfo.h +++ b/netwerk/protocol/http/nsHttpConnectionInfo.h @@ -36,14 +36,14 @@ public: nsrefcnt AddRef() { - nsrefcnt n = NS_AtomicIncrementRefcnt(mRef); + nsrefcnt n = ++mRef; NS_LOG_ADDREF(this, n, "nsHttpConnectionInfo", sizeof(*this)); return n; } nsrefcnt Release() { - nsrefcnt n = NS_AtomicDecrementRefcnt(mRef); + nsrefcnt n = --mRef; NS_LOG_RELEASE(this, n, "nsHttpConnectionInfo"); if (n == 0) delete this; @@ -97,7 +97,7 @@ public: bool UsingProxy(); private: - nsrefcnt mRef; + mozilla::ThreadSafeAutoRefCnt mRef; nsCString mHashKey; nsCString mHost; int32_t mPort; diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index efd10e26533..d098805809a 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -37,7 +37,7 @@ static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID); //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS1(nsHttpConnectionMgr, nsIObserver) +NS_IMPL_ISUPPORTS1(nsHttpConnectionMgr, nsIObserver) static void InsertTransactionSorted(nsTArray &pendingQ, nsHttpTransaction *trans) @@ -2459,7 +2459,7 @@ nsHttpConnectionMgr::nsConnectionHandle::~nsConnectionHandle() } } -NS_IMPL_THREADSAFE_ISUPPORTS0(nsHttpConnectionMgr::nsConnectionHandle) +NS_IMPL_ISUPPORTS0(nsHttpConnectionMgr::nsConnectionHandle) nsHttpConnectionMgr::nsConnectionEntry * nsHttpConnectionMgr::GetOrCreateConnectionEntry(nsHttpConnectionInfo *ci) @@ -2557,11 +2557,11 @@ nsHttpConnectionMgr::nsConnectionHandle::PushBack(const char *buf, uint32_t bufL //////////////////////// nsHalfOpenSocket -NS_IMPL_THREADSAFE_ISUPPORTS4(nsHttpConnectionMgr::nsHalfOpenSocket, - nsIOutputStreamCallback, - nsITransportEventSink, - nsIInterfaceRequestor, - nsITimerCallback) +NS_IMPL_ISUPPORTS4(nsHttpConnectionMgr::nsHalfOpenSocket, + nsIOutputStreamCallback, + nsITransportEventSink, + nsIInterfaceRequestor, + nsITimerCallback) nsHttpConnectionMgr:: nsHalfOpenSocket::nsHalfOpenSocket(nsConnectionEntry *ent, diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index acd5635f9f6..16036dd929f 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -40,7 +40,7 @@ class EventTokenBucket; class nsHttpConnectionMgr : public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER // parameter names @@ -390,7 +390,7 @@ private: class nsConnectionHandle : public nsAHttpConnection { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPCONNECTION(mConn) nsConnectionHandle(nsHttpConnection *conn) { NS_ADDREF(mConn = conn); } @@ -408,7 +408,7 @@ private: public nsITimerCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAMCALLBACK NS_DECL_NSITRANSPORTEVENTSINK NS_DECL_NSIINTERFACEREQUESTOR diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 296d6b86f80..50c4debd0b8 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -1502,13 +1502,13 @@ nsHttpHandler::SetAcceptEncodings(const char *aAcceptEncodings) // nsHttpHandler::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS6(nsHttpHandler, - nsIHttpProtocolHandler, - nsIProxiedProtocolHandler, - nsIProtocolHandler, - nsIObserver, - nsISupportsWeakReference, - nsISpeculativeConnect) +NS_IMPL_ISUPPORTS6(nsHttpHandler, + nsIHttpProtocolHandler, + nsIProxiedProtocolHandler, + nsIProtocolHandler, + nsIObserver, + nsISupportsWeakReference, + nsISpeculativeConnect) //----------------------------------------------------------------------------- // nsHttpHandler::nsIProtocolHandler @@ -1939,12 +1939,12 @@ nsHttpHandler::TickleWifi(nsIInterfaceRequestor *cb) // nsHttpsHandler implementation //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS5(nsHttpsHandler, - nsIHttpProtocolHandler, - nsIProxiedProtocolHandler, - nsIProtocolHandler, - nsISupportsWeakReference, - nsISpeculativeConnect) +NS_IMPL_ISUPPORTS5(nsHttpsHandler, + nsIHttpProtocolHandler, + nsIProxiedProtocolHandler, + nsIProtocolHandler, + nsISupportsWeakReference, + nsISpeculativeConnect) nsresult nsHttpsHandler::Init() diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h index ac661244021..db57e50e6ae 100644 --- a/netwerk/protocol/http/nsHttpHandler.h +++ b/netwerk/protocol/http/nsHttpHandler.h @@ -55,7 +55,7 @@ class nsHttpHandler : public nsIHttpProtocolHandler , public nsISpeculativeConnect { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_DECL_NSIPROXIEDPROTOCOLHANDLER NS_DECL_NSIHTTPPROTOCOLHANDLER @@ -495,7 +495,7 @@ public: // we basically just want to override GetScheme and GetDefaultPort... // all other methods should be forwarded to the nsHttpHandler instance. - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_FORWARD_NSIPROXIEDPROTOCOLHANDLER (gHttpHandler->) NS_FORWARD_NSIHTTPPROTOCOLHANDLER (gHttpHandler->) diff --git a/netwerk/protocol/http/nsHttpPipeline.cpp b/netwerk/protocol/http/nsHttpPipeline.cpp index 90f58cbfa9f..e7c04a46002 100644 --- a/netwerk/protocol/http/nsHttpPipeline.cpp +++ b/netwerk/protocol/http/nsHttpPipeline.cpp @@ -161,8 +161,8 @@ nsHttpPipeline::QueryPipeline() // nsHttpPipeline::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ADDREF(nsHttpPipeline) -NS_IMPL_THREADSAFE_RELEASE(nsHttpPipeline) +NS_IMPL_ADDREF(nsHttpPipeline) +NS_IMPL_RELEASE(nsHttpPipeline) // multiple inheritance fun :-) NS_INTERFACE_MAP_BEGIN(nsHttpPipeline) diff --git a/netwerk/protocol/http/nsHttpPipeline.h b/netwerk/protocol/http/nsHttpPipeline.h index 32afe7bd801..8570e83ca9d 100644 --- a/netwerk/protocol/http/nsHttpPipeline.h +++ b/netwerk/protocol/http/nsHttpPipeline.h @@ -19,7 +19,7 @@ class nsHttpPipeline : public nsAHttpConnection , public nsAHttpSegmentReader { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPCONNECTION(mConnection) NS_DECL_NSAHTTPTRANSACTION NS_DECL_NSAHTTPSEGMENTREADER diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index fbfdfa39d9f..44e880fc8f5 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -1681,14 +1681,14 @@ nsHttpTransaction::CancelPacing(nsresult reason) // nsHttpTransaction::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ADDREF(nsHttpTransaction) +NS_IMPL_ADDREF(nsHttpTransaction) NS_IMETHODIMP_(nsrefcnt) nsHttpTransaction::Release() { nsrefcnt count; NS_PRECONDITION(0 != mRefCnt, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; NS_LOG_RELEASE(this, count, "nsHttpTransaction"); if (0 == count) { mRefCnt = 1; /* stablize */ @@ -1700,9 +1700,9 @@ nsHttpTransaction::Release() return count; } -NS_IMPL_THREADSAFE_QUERY_INTERFACE2(nsHttpTransaction, - nsIInputStreamCallback, - nsIOutputStreamCallback) +NS_IMPL_QUERY_INTERFACE2(nsHttpTransaction, + nsIInputStreamCallback, + nsIOutputStreamCallback) //----------------------------------------------------------------------------- // nsHttpTransaction::nsIInputStreamCallback diff --git a/netwerk/protocol/http/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h index 557a8cbe1b0..f0b61a2f44f 100644 --- a/netwerk/protocol/http/nsHttpTransaction.h +++ b/netwerk/protocol/http/nsHttpTransaction.h @@ -42,7 +42,7 @@ class nsHttpTransaction : public nsAHttpTransaction , public nsIOutputStreamCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSAHTTPTRANSACTION NS_DECL_NSIINPUTSTREAMCALLBACK NS_DECL_NSIOUTPUTSTREAMCALLBACK diff --git a/netwerk/protocol/res/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp index f115c809c63..aedcda9c891 100644 --- a/netwerk/protocol/res/nsResProtocolHandler.cpp +++ b/netwerk/protocol/res/nsResProtocolHandler.cpp @@ -199,10 +199,10 @@ nsResProtocolHandler::CollectSubstitutions(InfallibleTArray& aR // nsResProtocolHandler::nsISupports //---------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS3(nsResProtocolHandler, - nsIResProtocolHandler, - nsIProtocolHandler, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(nsResProtocolHandler, + nsIResProtocolHandler, + nsIProtocolHandler, + nsISupportsWeakReference) //---------------------------------------------------------------------------- // nsResProtocolHandler::nsIProtocolHandler diff --git a/netwerk/protocol/res/nsResProtocolHandler.h b/netwerk/protocol/res/nsResProtocolHandler.h index b6fdd50ceb9..9b9ce9020b5 100644 --- a/netwerk/protocol/res/nsResProtocolHandler.h +++ b/netwerk/protocol/res/nsResProtocolHandler.h @@ -27,7 +27,7 @@ public: class nsResProtocolHandler : public nsIResProtocolHandler, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_DECL_NSIRESPROTOCOLHANDLER diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index cc8ad0daaae..a5b6f31fafd 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -57,18 +57,18 @@ using namespace mozilla; namespace mozilla { namespace net { -NS_IMPL_THREADSAFE_ISUPPORTS11(WebSocketChannel, - nsIWebSocketChannel, - nsIHttpUpgradeListener, - nsIRequestObserver, - nsIStreamListener, - nsIProtocolHandler, - nsIInputStreamCallback, - nsIOutputStreamCallback, - nsITimerCallback, - nsIDNSListener, - nsIInterfaceRequestor, - nsIChannelEventSink) +NS_IMPL_ISUPPORTS11(WebSocketChannel, + nsIWebSocketChannel, + nsIHttpUpgradeListener, + nsIRequestObserver, + nsIStreamListener, + nsIProtocolHandler, + nsIInputStreamCallback, + nsIOutputStreamCallback, + nsITimerCallback, + nsIDNSListener, + nsIInterfaceRequestor, + nsIChannelEventSink) // We implement RFC 6455, which uses Sec-WebSocket-Version: 13 on the wire. #define SEC_WEBSOCKET_VERSION "13" @@ -490,7 +490,7 @@ static nsWSAdmissionManager *sWebSocketAdmissions = nullptr; class CallOnMessageAvailable MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS CallOnMessageAvailable(WebSocketChannel *aChannel, nsCString &aData, @@ -515,7 +515,7 @@ private: nsCString mData; int32_t mLen; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnMessageAvailable, nsIRunnable) +NS_IMPL_ISUPPORTS1(CallOnMessageAvailable, nsIRunnable) //----------------------------------------------------------------------------- // CallOnStop @@ -524,7 +524,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnMessageAvailable, nsIRunnable) class CallOnStop MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS CallOnStop(WebSocketChannel *aChannel, nsresult aReason) @@ -551,7 +551,7 @@ private: nsRefPtr mChannel; nsresult mReason; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnStop, nsIRunnable) +NS_IMPL_ISUPPORTS1(CallOnStop, nsIRunnable) //----------------------------------------------------------------------------- // CallOnServerClose @@ -560,7 +560,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnStop, nsIRunnable) class CallOnServerClose MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS CallOnServerClose(WebSocketChannel *aChannel, uint16_t aCode, @@ -582,7 +582,7 @@ private: uint16_t mCode; nsCString mReason; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnServerClose, nsIRunnable) +NS_IMPL_ISUPPORTS1(CallOnServerClose, nsIRunnable) //----------------------------------------------------------------------------- // CallAcknowledge @@ -591,7 +591,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnServerClose, nsIRunnable) class CallAcknowledge MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS CallAcknowledge(WebSocketChannel *aChannel, uint32_t aSize) @@ -611,7 +611,7 @@ private: nsRefPtr mChannel; uint32_t mSize; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(CallAcknowledge, nsIRunnable) +NS_IMPL_ISUPPORTS1(CallAcknowledge, nsIRunnable) //----------------------------------------------------------------------------- // CallOnTransportAvailable @@ -620,7 +620,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(CallAcknowledge, nsIRunnable) class CallOnTransportAvailable MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS CallOnTransportAvailable(WebSocketChannel *aChannel, nsISocketTransport *aTransport, @@ -645,7 +645,7 @@ private: nsCOMPtr mSocketIn; nsCOMPtr mSocketOut; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnTransportAvailable, nsIRunnable) +NS_IMPL_ISUPPORTS1(CallOnTransportAvailable, nsIRunnable) //----------------------------------------------------------------------------- // OutboundMessage @@ -764,7 +764,7 @@ private: class OutboundEnqueuer MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS OutboundEnqueuer(WebSocketChannel *aChannel, OutboundMessage *aMsg) : mChannel(aChannel), mMessage(aMsg) {} @@ -781,7 +781,7 @@ private: nsRefPtr mChannel; OutboundMessage *mMessage; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(OutboundEnqueuer, nsIRunnable) +NS_IMPL_ISUPPORTS1(OutboundEnqueuer, nsIRunnable) //----------------------------------------------------------------------------- // nsWSCompression diff --git a/netwerk/protocol/websocket/WebSocketChannel.h b/netwerk/protocol/websocket/WebSocketChannel.h index d2f2a148e3a..0bf902957ef 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.h +++ b/netwerk/protocol/websocket/WebSocketChannel.h @@ -62,7 +62,7 @@ class WebSocketChannel : public BaseWebSocketChannel, public nsIChannelEventSink { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIHTTPUPGRADELISTENER NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER diff --git a/netwerk/protocol/websocket/WebSocketChannelParent.cpp b/netwerk/protocol/websocket/WebSocketChannelParent.cpp index 04d0240f83e..51a3b2f36d1 100644 --- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp @@ -15,7 +15,7 @@ using namespace mozilla::ipc; namespace mozilla { namespace net { -NS_IMPL_THREADSAFE_ISUPPORTS2(WebSocketChannelParent, +NS_IMPL_ISUPPORTS2(WebSocketChannelParent, nsIWebSocketListener, nsIInterfaceRequestor) diff --git a/netwerk/protocol/websocket/WebSocketChannelParent.h b/netwerk/protocol/websocket/WebSocketChannelParent.h index 345691716ad..907ba69c839 100644 --- a/netwerk/protocol/websocket/WebSocketChannelParent.h +++ b/netwerk/protocol/websocket/WebSocketChannelParent.h @@ -26,7 +26,7 @@ class WebSocketChannelParent : public PWebSocketParent, public nsIInterfaceRequestor { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIWEBSOCKETLISTENER NS_DECL_NSIINTERFACEREQUESTOR diff --git a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp index 2c313e71774..932b2808bad 100644 --- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp +++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp @@ -95,14 +95,14 @@ nsWyciwygChannel::~nsWyciwygChannel() { } -NS_IMPL_THREADSAFE_ISUPPORTS7(nsWyciwygChannel, - nsIChannel, - nsIRequest, - nsIStreamListener, - nsIRequestObserver, - nsICacheListener, - nsIWyciwygChannel, - nsIPrivateBrowsingChannel) +NS_IMPL_ISUPPORTS7(nsWyciwygChannel, + nsIChannel, + nsIRequest, + nsIStreamListener, + nsIRequestObserver, + nsICacheListener, + nsIWyciwygChannel, + nsIPrivateBrowsingChannel) nsresult nsWyciwygChannel::Init(nsIURI* uri) diff --git a/netwerk/protocol/wyciwyg/nsWyciwygChannel.h b/netwerk/protocol/wyciwyg/nsWyciwygChannel.h index 576cedde75e..b494710437b 100644 --- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.h +++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.h @@ -38,7 +38,7 @@ class nsWyciwygChannel: public nsIWyciwygChannel, public mozilla::net::PrivateBrowsingChannel { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUEST NS_DECL_NSICHANNEL NS_DECL_NSIWYCIWYGCHANNEL diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index 6ec01239294..9de6e09caf8 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -272,8 +272,8 @@ void DataChannelConnection::DestroyOnSTS(struct socket *aMasterSocket, disconnect_all(); } -NS_IMPL_THREADSAFE_ISUPPORTS1(DataChannelConnection, - nsITimerCallback) +NS_IMPL_ISUPPORTS1(DataChannelConnection, + nsITimerCallback) bool DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUsingDtls) diff --git a/netwerk/sctp/datachannel/DataChannel.h b/netwerk/sctp/datachannel/DataChannel.h index a2d4e53804f..eb9994d7312 100644 --- a/netwerk/sctp/datachannel/DataChannel.h +++ b/netwerk/sctp/datachannel/DataChannel.h @@ -121,7 +121,7 @@ class DataChannelConnection: public nsITimerCallback #endif { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMERCALLBACK class DataConnectionListener : public SupportsWeakPtr diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp index 22c8b7f7262..46da9246db2 100644 --- a/netwerk/socket/nsSOCKSIOLayer.cpp +++ b/netwerk/socket/nsSOCKSIOLayer.cpp @@ -66,7 +66,7 @@ public: nsSOCKSSocketInfo(); virtual ~nsSOCKSSocketInfo() { HandshakeFinished(); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISOCKSSOCKETINFO NS_DECL_NSIDNSLISTENER @@ -177,7 +177,7 @@ nsSOCKSSocketInfo::Init(int32_t version, int32_t family, const char *proxyHost, mFlags = flags; } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsSOCKSSocketInfo, nsISOCKSSocketInfo, nsIDNSListener) +NS_IMPL_ISUPPORTS2(nsSOCKSSocketInfo, nsISOCKSSocketInfo, nsIDNSListener) NS_IMETHODIMP nsSOCKSSocketInfo::GetExternalProxyAddr(NetAddr * *aExternalProxyAddr) diff --git a/netwerk/socket/nsSOCKSSocketProvider.cpp b/netwerk/socket/nsSOCKSSocketProvider.cpp index 63ed38ceb54..d45adb73eb0 100644 --- a/netwerk/socket/nsSOCKSSocketProvider.cpp +++ b/netwerk/socket/nsSOCKSSocketProvider.cpp @@ -12,7 +12,7 @@ ////////////////////////////////////////////////////////////////////////// -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSOCKSSocketProvider, nsISocketProvider) +NS_IMPL_ISUPPORTS1(nsSOCKSSocketProvider, nsISocketProvider) nsresult nsSOCKSSocketProvider::CreateV4(nsISupports *aOuter, REFNSIID aIID, void **aResult) diff --git a/netwerk/socket/nsSOCKSSocketProvider.h b/netwerk/socket/nsSOCKSSocketProvider.h index 1d28c31c9d9..0112d939c4a 100644 --- a/netwerk/socket/nsSOCKSSocketProvider.h +++ b/netwerk/socket/nsSOCKSSocketProvider.h @@ -18,7 +18,7 @@ enum { class nsSOCKSSocketProvider : public nsISocketProvider { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISOCKETPROVIDER nsSOCKSSocketProvider(uint32_t version) : mVersion(version) {} diff --git a/netwerk/socket/nsSocketProviderService.cpp b/netwerk/socket/nsSocketProviderService.cpp index 225f741fbce..0f58f50a655 100644 --- a/netwerk/socket/nsSocketProviderService.cpp +++ b/netwerk/socket/nsSocketProviderService.cpp @@ -23,7 +23,7 @@ nsSocketProviderService::Create(nsISupports *aOuter, REFNSIID aIID, void **aResu return rv; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSocketProviderService, nsISocketProviderService) +NS_IMPL_ISUPPORTS1(nsSocketProviderService, nsISocketProviderService) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/socket/nsSocketProviderService.h b/netwerk/socket/nsSocketProviderService.h index 2c5ce4e74c7..1d54c629530 100644 --- a/netwerk/socket/nsSocketProviderService.h +++ b/netwerk/socket/nsSocketProviderService.h @@ -11,7 +11,7 @@ class nsSocketProviderService : public nsISocketProviderService { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISOCKETPROVIDERSERVICE nsSocketProviderService() {} diff --git a/netwerk/socket/nsUDPSocketProvider.cpp b/netwerk/socket/nsUDPSocketProvider.cpp index 17e19ab737f..bc216514f49 100644 --- a/netwerk/socket/nsUDPSocketProvider.cpp +++ b/netwerk/socket/nsUDPSocketProvider.cpp @@ -6,7 +6,7 @@ #include "nspr.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUDPSocketProvider, nsISocketProvider) +NS_IMPL_ISUPPORTS1(nsUDPSocketProvider, nsISocketProvider) nsUDPSocketProvider::~nsUDPSocketProvider() { diff --git a/netwerk/socket/nsUDPSocketProvider.h b/netwerk/socket/nsUDPSocketProvider.h index bcaf1c7a9f3..d37514577f4 100644 --- a/netwerk/socket/nsUDPSocketProvider.h +++ b/netwerk/socket/nsUDPSocketProvider.h @@ -11,7 +11,7 @@ class nsUDPSocketProvider MOZ_FINAL : public nsISocketProvider { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISOCKETPROVIDER private: diff --git a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp index 9e33a874229..71385ca2946 100644 --- a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp +++ b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp @@ -17,10 +17,10 @@ #include "nsComponentManagerUtils.h" // nsISupports implementation -NS_IMPL_THREADSAFE_ISUPPORTS3(nsHTTPCompressConv, - nsIStreamConverter, - nsIStreamListener, - nsIRequestObserver) +NS_IMPL_ISUPPORTS3(nsHTTPCompressConv, + nsIStreamConverter, + nsIStreamListener, + nsIRequestObserver) // nsFTPDirListingConv methods nsHTTPCompressConv::nsHTTPCompressConv() diff --git a/netwerk/streamconv/converters/nsHTTPCompressConv.h b/netwerk/streamconv/converters/nsHTTPCompressConv.h index 4c7f081b8f0..a64e3c1479d 100644 --- a/netwerk/streamconv/converters/nsHTTPCompressConv.h +++ b/netwerk/streamconv/converters/nsHTTPCompressConv.h @@ -40,7 +40,7 @@ typedef enum { class nsHTTPCompressConv : public nsIStreamConverter { public: // nsISupports methods - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER diff --git a/netwerk/system/win32/nsNotifyAddrListener.cpp b/netwerk/system/win32/nsNotifyAddrListener.cpp index 26ed003f97e..4493d5ef982 100644 --- a/netwerk/system/win32/nsNotifyAddrListener.cpp +++ b/netwerk/system/win32/nsNotifyAddrListener.cpp @@ -51,10 +51,10 @@ static void FreeDynamicLibraries(void) } } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsNotifyAddrListener, - nsINetworkLinkService, - nsIRunnable, - nsIObserver) +NS_IMPL_ISUPPORTS3(nsNotifyAddrListener, + nsINetworkLinkService, + nsIRunnable, + nsIObserver) nsNotifyAddrListener::nsNotifyAddrListener() : mLinkUp(true) // assume true by default diff --git a/netwerk/system/win32/nsNotifyAddrListener.h b/netwerk/system/win32/nsNotifyAddrListener.h index 13a86d1074b..433b99b1719 100644 --- a/netwerk/system/win32/nsNotifyAddrListener.h +++ b/netwerk/system/win32/nsNotifyAddrListener.h @@ -20,7 +20,7 @@ class nsNotifyAddrListener : public nsINetworkLinkService, public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSINETWORKLINKSERVICE NS_DECL_NSIRUNNABLE NS_DECL_NSIOBSERVER diff --git a/netwerk/test/TestCallbacks.cpp b/netwerk/test/TestCallbacks.cpp index 0499a7b8893..499bb1b2d2c 100644 --- a/netwerk/test/TestCallbacks.cpp +++ b/netwerk/test/TestCallbacks.cpp @@ -45,7 +45,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIEquals, NS_IEQUALS_IID) class ConsumerContext MOZ_FINAL : public nsIEquals { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS ConsumerContext() { } @@ -56,11 +56,11 @@ public: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(ConsumerContext, nsIEquals) +NS_IMPL_ISUPPORTS1(ConsumerContext, nsIEquals) class Consumer : public nsIStreamListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER @@ -79,7 +79,7 @@ public: }; // nsISupports implementation -NS_IMPL_THREADSAFE_ISUPPORTS2(Consumer, nsIStreamListener, nsIRequestObserver) +NS_IMPL_ISUPPORTS2(Consumer, nsIStreamListener, nsIRequestObserver) // nsIRequestObserver implementation diff --git a/netwerk/test/TestCommon.h b/netwerk/test/TestCommon.h index 81fb970af0d..072cba8ae33 100644 --- a/netwerk/test/TestCommon.h +++ b/netwerk/test/TestCommon.h @@ -20,13 +20,13 @@ static bool gKeepPumpingEvents = false; class nsQuitPumpingEvent MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Run() { gKeepPumpingEvents = false; return NS_OK; } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsQuitPumpingEvent, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsQuitPumpingEvent, nsIRunnable) static inline void PumpEvents() { diff --git a/netwerk/test/TestDNS.cpp b/netwerk/test/TestDNS.cpp index 80cef5502cb..4fe4fe8fb05 100644 --- a/netwerk/test/TestDNS.cpp +++ b/netwerk/test/TestDNS.cpp @@ -22,7 +22,7 @@ class myDNSListener : public nsIDNSListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS myDNSListener(const char *host, int32_t index) : mHost(host) @@ -57,7 +57,7 @@ private: int32_t mIndex; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(myDNSListener, nsIDNSListener) +NS_IMPL_ISUPPORTS1(myDNSListener, nsIDNSListener) static bool IsAscii(const char *s) { diff --git a/netwerk/test/TestHttp.cpp b/netwerk/test/TestHttp.cpp index da6f331042c..a6f0764ddd8 100644 --- a/netwerk/test/TestHttp.cpp +++ b/netwerk/test/TestHttp.cpp @@ -88,7 +88,7 @@ class MyNotifications : public nsIInterfaceRequestor , public nsIProgressEventSink { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIPROGRESSEVENTSINK @@ -96,9 +96,9 @@ public: virtual ~MyNotifications() {} }; -NS_IMPL_THREADSAFE_ISUPPORTS2(MyNotifications, - nsIInterfaceRequestor, - nsIProgressEventSink) +NS_IMPL_ISUPPORTS2(MyNotifications, + nsIInterfaceRequestor, + nsIProgressEventSink) NS_IMETHODIMP MyNotifications::GetInterface(const nsIID &iid, void **result) diff --git a/netwerk/test/TestIOThreads.cpp b/netwerk/test/TestIOThreads.cpp index 17635d92cc5..a594f8f7237 100644 --- a/netwerk/test/TestIOThreads.cpp +++ b/netwerk/test/TestIOThreads.cpp @@ -21,7 +21,7 @@ static PRLogModuleInfo *gTestLog = nullptr; class nsIOEvent : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsIOEvent(int i) : mIndex(i) {} @@ -33,7 +33,7 @@ public: private: int mIndex; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsIOEvent, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsIOEvent, nsIRunnable) static nsresult RunTest() { diff --git a/netwerk/test/TestPageLoad.cpp b/netwerk/test/TestPageLoad.cpp index 45c5988953e..e5e129e5147 100644 --- a/netwerk/test/TestPageLoad.cpp +++ b/netwerk/test/TestPageLoad.cpp @@ -196,7 +196,7 @@ class MyNotifications : public nsIInterfaceRequestor , public nsIProgressEventSink { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIPROGRESSEVENTSINK @@ -204,9 +204,9 @@ public: virtual ~MyNotifications() {} }; -NS_IMPL_THREADSAFE_ISUPPORTS2(MyNotifications, - nsIInterfaceRequestor, - nsIProgressEventSink) +NS_IMPL_ISUPPORTS2(MyNotifications, + nsIInterfaceRequestor, + nsIProgressEventSink) NS_IMETHODIMP MyNotifications::GetInterface(const nsIID &iid, void **result) diff --git a/netwerk/test/TestProtocols.cpp b/netwerk/test/TestProtocols.cpp index f5acfaa28cb..1a4161b6ce5 100644 --- a/netwerk/test/TestProtocols.cpp +++ b/netwerk/test/TestProtocols.cpp @@ -196,7 +196,7 @@ public: virtual ~URLLoadInfo(); // ISupports interface... - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS const char* Name() { return mURLString.get(); } int64_t mBytesRead; @@ -216,7 +216,7 @@ URLLoadInfo::~URLLoadInfo() } -NS_IMPL_THREADSAFE_ISUPPORTS0(URLLoadInfo) +NS_IMPL_ISUPPORTS0(URLLoadInfo) //----------------------------------------------------------------------------- // TestChannelEventSink diff --git a/netwerk/test/TestServ.cpp b/netwerk/test/TestServ.cpp index c9a586c1e38..596d903f3d9 100644 --- a/netwerk/test/TestServ.cpp +++ b/netwerk/test/TestServ.cpp @@ -24,14 +24,14 @@ static PRLogModuleInfo *gTestLog = nullptr; class MySocketListener : public nsIServerSocketListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISERVERSOCKETLISTENER MySocketListener() {} virtual ~MySocketListener() {} }; -NS_IMPL_THREADSAFE_ISUPPORTS1(MySocketListener, nsIServerSocketListener) +NS_IMPL_ISUPPORTS1(MySocketListener, nsIServerSocketListener) NS_IMETHODIMP MySocketListener::OnSocketAccepted(nsIServerSocket *serv, diff --git a/netwerk/test/TestSocketTransport.cpp b/netwerk/test/TestSocketTransport.cpp index 4f91d7692df..dfdfa98c49f 100644 --- a/netwerk/test/TestSocketTransport.cpp +++ b/netwerk/test/TestSocketTransport.cpp @@ -45,7 +45,7 @@ class MyHandler : public nsIOutputStreamCallback , public nsIInputStreamCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS MyHandler(const char *path, nsIAsyncInputStream *in, @@ -115,9 +115,9 @@ private: uint32_t mWriteOffset; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(MyHandler, - nsIOutputStreamCallback, - nsIInputStreamCallback) +NS_IMPL_ISUPPORTS2(MyHandler, + nsIOutputStreamCallback, + nsIInputStreamCallback) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/test/TestStreamTransport.cpp b/netwerk/test/TestStreamTransport.cpp index 60e44035fb5..96e2b3250ab 100644 --- a/netwerk/test/TestStreamTransport.cpp +++ b/netwerk/test/TestStreamTransport.cpp @@ -45,7 +45,7 @@ class MyCopier : public nsIInputStreamCallback , public nsIOutputStreamCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS MyCopier() : mLock(nullptr) @@ -162,9 +162,9 @@ protected: nsresult mInputCondition; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(MyCopier, - nsIInputStreamCallback, - nsIOutputStreamCallback) +NS_IMPL_ISUPPORTS2(MyCopier, + nsIInputStreamCallback, + nsIOutputStreamCallback) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/test/TestUDPServerSocket.cpp b/netwerk/test/TestUDPServerSocket.cpp index f80422d7b8b..891a6af7292 100644 --- a/netwerk/test/TestUDPServerSocket.cpp +++ b/netwerk/test/TestUDPServerSocket.cpp @@ -45,7 +45,7 @@ class UDPListener : public nsIUDPServerSocketListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIUDPSERVERSOCKETLISTENER virtual ~UDPListener(); @@ -53,8 +53,8 @@ public: nsresult mResult; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(UDPListener, - nsIUDPServerSocketListener) +NS_IMPL_ISUPPORTS1(UDPListener, + nsIUDPServerSocketListener) UDPListener::~UDPListener() { diff --git a/netwerk/wifi/nsWifiAccessPoint.cpp b/netwerk/wifi/nsWifiAccessPoint.cpp index 82574d927ae..0611cbe753f 100644 --- a/netwerk/wifi/nsWifiAccessPoint.cpp +++ b/netwerk/wifi/nsWifiAccessPoint.cpp @@ -13,7 +13,7 @@ extern PRLogModuleInfo *gWifiMonitorLog; #define LOG(args) PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args) -NS_IMPL_THREADSAFE_ISUPPORTS1(nsWifiAccessPoint, nsIWifiAccessPoint) +NS_IMPL_ISUPPORTS1(nsWifiAccessPoint, nsIWifiAccessPoint) nsWifiAccessPoint::nsWifiAccessPoint() { diff --git a/netwerk/wifi/nsWifiAccessPoint.h b/netwerk/wifi/nsWifiAccessPoint.h index 07c10fc3ce6..09b2ad19f45 100644 --- a/netwerk/wifi/nsWifiAccessPoint.h +++ b/netwerk/wifi/nsWifiAccessPoint.h @@ -15,7 +15,7 @@ class nsWifiAccessPoint MOZ_FINAL : public nsIWifiAccessPoint { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIWIFIACCESSPOINT nsWifiAccessPoint(); diff --git a/netwerk/wifi/nsWifiMonitor.cpp b/netwerk/wifi/nsWifiMonitor.cpp index 1315255a012..ed4882bc3af 100644 --- a/netwerk/wifi/nsWifiMonitor.cpp +++ b/netwerk/wifi/nsWifiMonitor.cpp @@ -24,10 +24,10 @@ using namespace mozilla; PRLogModuleInfo *gWifiMonitorLog; #endif -NS_IMPL_THREADSAFE_ISUPPORTS3(nsWifiMonitor, - nsIRunnable, - nsIObserver, - nsIWifiMonitor) +NS_IMPL_ISUPPORTS3(nsWifiMonitor, + nsIRunnable, + nsIObserver, + nsIWifiMonitor) nsWifiMonitor::nsWifiMonitor() : mKeepGoing(true) @@ -117,7 +117,7 @@ typedef nsTArray > WifiListenerArray; class nsPassErrorToWifiListeners MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE nsPassErrorToWifiListeners(nsAutoPtr aListeners, @@ -131,8 +131,8 @@ class nsPassErrorToWifiListeners MOZ_FINAL : public nsIRunnable nsresult mResult; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsPassErrorToWifiListeners, - nsIRunnable) +NS_IMPL_ISUPPORTS1(nsPassErrorToWifiListeners, + nsIRunnable) NS_IMETHODIMP nsPassErrorToWifiListeners::Run() { @@ -177,7 +177,7 @@ NS_IMETHODIMP nsWifiMonitor::Run() class nsCallWifiListeners MOZ_FINAL : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE nsCallWifiListeners(nsAutoPtr aListeners, @@ -191,8 +191,8 @@ class nsCallWifiListeners MOZ_FINAL : public nsIRunnable nsAutoPtr > mAccessPoints; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsCallWifiListeners, - nsIRunnable) +NS_IMPL_ISUPPORTS1(nsCallWifiListeners, + nsIRunnable) NS_IMETHODIMP nsCallWifiListeners::Run() { diff --git a/netwerk/wifi/nsWifiMonitor.h b/netwerk/wifi/nsWifiMonitor.h index fa8ae456a3e..2c89e2555fb 100644 --- a/netwerk/wifi/nsWifiMonitor.h +++ b/netwerk/wifi/nsWifiMonitor.h @@ -47,7 +47,7 @@ class nsWifiListener class nsWifiMonitor MOZ_FINAL : nsIRunnable, nsIWifiMonitor, nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIWIFIMONITOR NS_DECL_NSIRUNNABLE NS_DECL_NSIOBSERVER From 7c92902b45c571d458c7dfa37723d83fe5396684 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:14 -0500 Subject: [PATCH 40/69] Bug 884061 - Part 3r: Use NS_DECL_THREADSAFE_ISUPPORTS in rdf/, r=bsmedberg --HG-- extra : rebase_source : febfbb36e1c2bccf21f888e133f1e03451823b53 --- rdf/base/src/nsRDFContainerUtils.cpp | 2 +- rdf/base/src/nsRDFService.cpp | 8 ++++---- rdf/util/public/nsRDFResource.h | 2 +- rdf/util/src/nsRDFResource.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rdf/base/src/nsRDFContainerUtils.cpp b/rdf/base/src/nsRDFContainerUtils.cpp index 31f4fff040e..70dbed08509 100644 --- a/rdf/base/src/nsRDFContainerUtils.cpp +++ b/rdf/base/src/nsRDFContainerUtils.cpp @@ -72,7 +72,7 @@ nsIRDFLiteral* RDFContainerUtilsImpl::kOne; //////////////////////////////////////////////////////////////////////// // nsISupports interface -NS_IMPL_THREADSAFE_ISUPPORTS1(RDFContainerUtilsImpl, nsIRDFContainerUtils) +NS_IMPL_ISUPPORTS1(RDFContainerUtilsImpl, nsIRDFContainerUtils) //////////////////////////////////////////////////////////////////////// // nsIRDFContainerUtils interface diff --git a/rdf/base/src/nsRDFService.cpp b/rdf/base/src/nsRDFService.cpp index 6ba0f50867c..f5d83817757 100644 --- a/rdf/base/src/nsRDFService.cpp +++ b/rdf/base/src/nsRDFService.cpp @@ -398,7 +398,7 @@ public: Create(const PRUnichar* aValue, nsIRDFLiteral** aResult); // nsISupports - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // nsIRDFNode NS_DECL_NSIRDFNODE @@ -454,8 +454,8 @@ LiteralImpl::~LiteralImpl() NS_RELEASE2(RDFServiceImpl::gRDFService, refcnt); } -NS_IMPL_THREADSAFE_ADDREF(LiteralImpl) -NS_IMPL_THREADSAFE_RELEASE(LiteralImpl) +NS_IMPL_ADDREF(LiteralImpl) +NS_IMPL_RELEASE(LiteralImpl) nsresult LiteralImpl::QueryInterface(REFNSIID iid, void** result) @@ -838,7 +838,7 @@ RDFServiceImpl::CreateSingleton(nsISupports* aOuter, return serv->QueryInterface(aIID, aResult); } -NS_IMPL_THREADSAFE_ISUPPORTS2(RDFServiceImpl, nsIRDFService, nsISupportsWeakReference) +NS_IMPL_ISUPPORTS2(RDFServiceImpl, nsIRDFService, nsISupportsWeakReference) // Per RFC2396. static const uint8_t diff --git a/rdf/util/public/nsRDFResource.h b/rdf/util/public/nsRDFResource.h index 878c109aaf5..85f76d0e2ee 100644 --- a/rdf/util/public/nsRDFResource.h +++ b/rdf/util/public/nsRDFResource.h @@ -22,7 +22,7 @@ class nsIRDFService; class nsRDFResource : public nsIRDFResource { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // nsIRDFNode methods: NS_IMETHOD EqualsNode(nsIRDFNode* aNode, bool* aResult); diff --git a/rdf/util/src/nsRDFResource.cpp b/rdf/util/src/nsRDFResource.cpp index 13c17328478..43121970d1b 100644 --- a/rdf/util/src/nsRDFResource.cpp +++ b/rdf/util/src/nsRDFResource.cpp @@ -42,7 +42,7 @@ nsRDFResource::~nsRDFResource(void) NS_RELEASE(gRDFService); } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsRDFResource, nsIRDFResource, nsIRDFNode) +NS_IMPL_ISUPPORTS2(nsRDFResource, nsIRDFResource, nsIRDFNode) //////////////////////////////////////////////////////////////////////////////// // nsIRDFNode methods: From de65691b8527c9606b1bab5acd1187daf02c228f Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:14 -0500 Subject: [PATCH 41/69] Bug 884061 - Part 3s: Use NS_DECL_THREADSAFE_ISUPPORTS in security/, r=bsmith --HG-- extra : rebase_source : 2b3329c361a71c49ef7c0793006c7dbb6f855e28 --- .../manager/boot/src/nsEntropyCollector.cpp | 6 +++--- .../manager/boot/src/nsEntropyCollector.h | 2 +- .../boot/src/nsSecureBrowserUIImpl.cpp | 14 ++++++------- .../manager/boot/src/nsSecureBrowserUIImpl.h | 2 +- .../boot/src/nsSecurityWarningDialogs.cpp | 2 +- .../boot/src/nsSecurityWarningDialogs.h | 2 +- .../src/nsStrictTransportSecurityService.cpp | 6 +++--- .../src/nsStrictTransportSecurityService.h | 2 +- security/manager/pki/src/nsASN1Tree.cpp | 3 +-- security/manager/pki/src/nsASN1Tree.h | 2 +- .../manager/pki/src/nsFormSigningDialog.cpp | 2 +- .../manager/pki/src/nsFormSigningDialog.h | 2 +- security/manager/pki/src/nsNSSDialogs.cpp | 16 +++++++-------- security/manager/pki/src/nsNSSDialogs.h | 2 +- security/manager/pki/src/nsPKIParamBlock.cpp | 3 +-- security/manager/pki/src/nsPKIParamBlock.h | 2 +- .../manager/ssl/src/TransportSecurityInfo.cpp | 14 ++++++------- .../manager/ssl/src/TransportSecurityInfo.h | 2 +- security/manager/ssl/src/nsCMS.cpp | 7 +++---- security/manager/ssl/src/nsCMS.h | 6 +++--- .../manager/ssl/src/nsCertOverrideService.cpp | 8 ++++---- .../manager/ssl/src/nsCertOverrideService.h | 2 +- .../ssl/src/nsCertVerificationThread.cpp | 2 +- .../manager/ssl/src/nsClientAuthRemember.cpp | 6 +++--- .../manager/ssl/src/nsClientAuthRemember.h | 2 +- security/manager/ssl/src/nsKeyModule.cpp | 2 +- security/manager/ssl/src/nsKeyModule.h | 2 +- security/manager/ssl/src/nsKeygenHandler.cpp | 2 +- security/manager/ssl/src/nsKeygenHandler.h | 2 +- security/manager/ssl/src/nsKeygenThread.cpp | 2 +- security/manager/ssl/src/nsKeygenThread.h | 2 +- security/manager/ssl/src/nsNSSASN1Object.cpp | 6 ++---- security/manager/ssl/src/nsNSSASN1Object.h | 4 ++-- security/manager/ssl/src/nsNSSCallbacks.cpp | 6 +++--- security/manager/ssl/src/nsNSSCallbacks.h | 4 ++-- security/manager/ssl/src/nsNSSCertCache.cpp | 2 +- security/manager/ssl/src/nsNSSCertCache.h | 2 +- .../manager/ssl/src/nsNSSCertValidity.cpp | 2 +- security/manager/ssl/src/nsNSSCertValidity.h | 2 +- security/manager/ssl/src/nsNSSCertificate.cpp | 20 +++++++++---------- security/manager/ssl/src/nsNSSCertificate.h | 6 +++--- .../manager/ssl/src/nsNSSCertificateDB.cpp | 2 +- security/manager/ssl/src/nsNSSCertificateDB.h | 2 +- .../ssl/src/nsNSSCertificateFakeTransport.cpp | 7 ++++--- .../ssl/src/nsNSSCertificateFakeTransport.h | 2 +- security/manager/ssl/src/nsNSSComponent.cpp | 18 ++++++++--------- security/manager/ssl/src/nsNSSComponent.h | 2 +- security/manager/ssl/src/nsNSSHelper.h | 2 +- security/manager/ssl/src/nsNSSIOLayer.cpp | 4 ++-- .../manager/ssl/src/nsProtectedAuthThread.cpp | 2 +- .../manager/ssl/src/nsProtectedAuthThread.h | 2 +- .../manager/ssl/src/nsRandomGenerator.cpp | 2 +- security/manager/ssl/src/nsRandomGenerator.h | 2 +- security/manager/ssl/src/nsRecentBadCerts.cpp | 3 +-- security/manager/ssl/src/nsRecentBadCerts.h | 2 +- .../manager/ssl/src/nsSSLSocketProvider.cpp | 2 +- .../manager/ssl/src/nsSSLSocketProvider.h | 2 +- security/manager/ssl/src/nsSSLStatus.cpp | 2 +- security/manager/ssl/src/nsSSLStatus.h | 2 +- .../manager/ssl/src/nsTLSSocketProvider.cpp | 2 +- .../manager/ssl/src/nsTLSSocketProvider.h | 2 +- security/manager/ssl/src/nsVerificationJob.h | 2 +- 62 files changed, 122 insertions(+), 127 deletions(-) diff --git a/security/manager/boot/src/nsEntropyCollector.cpp b/security/manager/boot/src/nsEntropyCollector.cpp index e4ee4344751..ade1e614fcb 100644 --- a/security/manager/boot/src/nsEntropyCollector.cpp +++ b/security/manager/boot/src/nsEntropyCollector.cpp @@ -23,9 +23,9 @@ nsEntropyCollector::~nsEntropyCollector() { } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsEntropyCollector, - nsIEntropyCollector, - nsIBufEntropyCollector) +NS_IMPL_ISUPPORTS2(nsEntropyCollector, + nsIEntropyCollector, + nsIBufEntropyCollector) NS_IMETHODIMP nsEntropyCollector::RandomUpdate(void *new_entropy, int32_t bufLen) diff --git a/security/manager/boot/src/nsEntropyCollector.h b/security/manager/boot/src/nsEntropyCollector.h index 26618c50924..b14950a24eb 100644 --- a/security/manager/boot/src/nsEntropyCollector.h +++ b/security/manager/boot/src/nsEntropyCollector.h @@ -20,7 +20,7 @@ class nsEntropyCollector : public nsIBufEntropyCollector nsEntropyCollector(); virtual ~nsEntropyCollector(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIENTROPYCOLLECTOR NS_DECL_NSIBUFENTROPYCOLLECTOR diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp index 584ffd5cebf..f2e7fde4533 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.cpp +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.cpp @@ -150,13 +150,13 @@ nsSecureBrowserUIImpl::~nsSecureBrowserUIImpl() } } -NS_IMPL_THREADSAFE_ISUPPORTS6(nsSecureBrowserUIImpl, - nsISecureBrowserUI, - nsIWebProgressListener, - nsIFormSubmitObserver, - nsIObserver, - nsISupportsWeakReference, - nsISSLStatusProvider) +NS_IMPL_ISUPPORTS6(nsSecureBrowserUIImpl, + nsISecureBrowserUI, + nsIWebProgressListener, + nsIFormSubmitObserver, + nsIObserver, + nsISupportsWeakReference, + nsISSLStatusProvider) NS_IMETHODIMP nsSecureBrowserUIImpl::Init(nsIDOMWindow *aWindow) diff --git a/security/manager/boot/src/nsSecureBrowserUIImpl.h b/security/manager/boot/src/nsSecureBrowserUIImpl.h index 174bffe82c0..d819620194d 100644 --- a/security/manager/boot/src/nsSecureBrowserUIImpl.h +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.h @@ -48,7 +48,7 @@ public: nsSecureBrowserUIImpl(); virtual ~nsSecureBrowserUIImpl(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIWEBPROGRESSLISTENER NS_DECL_NSISECUREBROWSERUI diff --git a/security/manager/boot/src/nsSecurityWarningDialogs.cpp b/security/manager/boot/src/nsSecurityWarningDialogs.cpp index eee9b3cda00..fc20367d136 100644 --- a/security/manager/boot/src/nsSecurityWarningDialogs.cpp +++ b/security/manager/boot/src/nsSecurityWarningDialogs.cpp @@ -19,7 +19,7 @@ #include "mozilla/Telemetry.h" #include "nsISecurityUITelemetry.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSecurityWarningDialogs, nsISecurityWarningDialogs) +NS_IMPL_ISUPPORTS1(nsSecurityWarningDialogs, nsISecurityWarningDialogs) #define STRING_BUNDLE_URL "chrome://pipnss/locale/security.properties" diff --git a/security/manager/boot/src/nsSecurityWarningDialogs.h b/security/manager/boot/src/nsSecurityWarningDialogs.h index f9f964be567..c7b96bd39ff 100644 --- a/security/manager/boot/src/nsSecurityWarningDialogs.h +++ b/security/manager/boot/src/nsSecurityWarningDialogs.h @@ -15,7 +15,7 @@ class nsSecurityWarningDialogs : public nsISecurityWarningDialogs { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISECURITYWARNINGDIALOGS nsSecurityWarningDialogs(); diff --git a/security/manager/boot/src/nsStrictTransportSecurityService.cpp b/security/manager/boot/src/nsStrictTransportSecurityService.cpp index e27a2424ccf..53374ed2c90 100644 --- a/security/manager/boot/src/nsStrictTransportSecurityService.cpp +++ b/security/manager/boot/src/nsStrictTransportSecurityService.cpp @@ -83,9 +83,9 @@ nsStrictTransportSecurityService::~nsStrictTransportSecurityService() { } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsStrictTransportSecurityService, - nsIObserver, - nsIStrictTransportSecurityService) +NS_IMPL_ISUPPORTS2(nsStrictTransportSecurityService, + nsIObserver, + nsIStrictTransportSecurityService) nsresult nsStrictTransportSecurityService::Init() diff --git a/security/manager/boot/src/nsStrictTransportSecurityService.h b/security/manager/boot/src/nsStrictTransportSecurityService.h index 9563a1a41bf..d7c3dadf69a 100644 --- a/security/manager/boot/src/nsStrictTransportSecurityService.h +++ b/security/manager/boot/src/nsStrictTransportSecurityService.h @@ -125,7 +125,7 @@ class nsStrictTransportSecurityService : public nsIStrictTransportSecurityServic , public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER NS_DECL_NSISTRICTTRANSPORTSECURITYSERVICE diff --git a/security/manager/pki/src/nsASN1Tree.cpp b/security/manager/pki/src/nsASN1Tree.cpp index 0ac3622f81c..30719fa3a50 100644 --- a/security/manager/pki/src/nsASN1Tree.cpp +++ b/security/manager/pki/src/nsASN1Tree.cpp @@ -8,8 +8,7 @@ #include "nsIMutableArray.h" #include "nsArrayUtils.h" -NS_IMPL_THREADSAFE_ISUPPORTS2(nsNSSASN1Tree, nsIASN1Tree, - nsITreeView) +NS_IMPL_ISUPPORTS2(nsNSSASN1Tree, nsIASN1Tree, nsITreeView) nsNSSASN1Tree::nsNSSASN1Tree() :mTopNode(nullptr) diff --git a/security/manager/pki/src/nsASN1Tree.h b/security/manager/pki/src/nsASN1Tree.h index 84caaf9e5ca..15fa942b3ce 100644 --- a/security/manager/pki/src/nsASN1Tree.h +++ b/security/manager/pki/src/nsASN1Tree.h @@ -26,7 +26,7 @@ class nsNSSASN1Tree : public nsIASN1Tree { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIASN1TREE NS_DECL_NSITREEVIEW diff --git a/security/manager/pki/src/nsFormSigningDialog.cpp b/security/manager/pki/src/nsFormSigningDialog.cpp index 7c87b55f823..88298d8deb5 100644 --- a/security/manager/pki/src/nsFormSigningDialog.cpp +++ b/security/manager/pki/src/nsFormSigningDialog.cpp @@ -21,7 +21,7 @@ nsFormSigningDialog::~nsFormSigningDialog() { } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsFormSigningDialog, nsIFormSigningDialog) +NS_IMPL_ISUPPORTS1(nsFormSigningDialog, nsIFormSigningDialog) NS_IMETHODIMP nsFormSigningDialog::ConfirmSignText(nsIInterfaceRequestor *aContext, diff --git a/security/manager/pki/src/nsFormSigningDialog.h b/security/manager/pki/src/nsFormSigningDialog.h index b48827d9fa8..662ecb5034f 100644 --- a/security/manager/pki/src/nsFormSigningDialog.h +++ b/security/manager/pki/src/nsFormSigningDialog.h @@ -18,7 +18,7 @@ public: nsFormSigningDialog(); ~nsFormSigningDialog(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIFORMSIGNINGDIALOG }; diff --git a/security/manager/pki/src/nsNSSDialogs.cpp b/security/manager/pki/src/nsNSSDialogs.cpp index 07a49518aa3..2ceb9a5bc50 100644 --- a/security/manager/pki/src/nsNSSDialogs.cpp +++ b/security/manager/pki/src/nsNSSDialogs.cpp @@ -47,14 +47,14 @@ nsNSSDialogs::~nsNSSDialogs() { } -NS_IMPL_THREADSAFE_ISUPPORTS8(nsNSSDialogs, nsITokenPasswordDialogs, - nsICertificateDialogs, - nsIClientAuthDialogs, - nsICertPickDialogs, - nsITokenDialogs, - nsIDOMCryptoDialogs, - nsIGeneratingKeypairInfoDialogs, - nsISSLCertErrorDialog) +NS_IMPL_ISUPPORTS8(nsNSSDialogs, nsITokenPasswordDialogs, + nsICertificateDialogs, + nsIClientAuthDialogs, + nsICertPickDialogs, + nsITokenDialogs, + nsIDOMCryptoDialogs, + nsIGeneratingKeypairInfoDialogs, + nsISSLCertErrorDialog) nsresult nsNSSDialogs::Init() diff --git a/security/manager/pki/src/nsNSSDialogs.h b/security/manager/pki/src/nsNSSDialogs.h index 9748cd52360..7eff0a69989 100644 --- a/security/manager/pki/src/nsNSSDialogs.h +++ b/security/manager/pki/src/nsNSSDialogs.h @@ -34,7 +34,7 @@ class nsNSSDialogs public nsISSLCertErrorDialog { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITOKENPASSWORDDIALOGS NS_DECL_NSICERTIFICATEDIALOGS NS_DECL_NSICLIENTAUTHDIALOGS diff --git a/security/manager/pki/src/nsPKIParamBlock.cpp b/security/manager/pki/src/nsPKIParamBlock.cpp index d925a36df20..825d73057bc 100644 --- a/security/manager/pki/src/nsPKIParamBlock.cpp +++ b/security/manager/pki/src/nsPKIParamBlock.cpp @@ -9,8 +9,7 @@ #include "nsIDialogParamBlock.h" #include "nsIMutableArray.h" -NS_IMPL_THREADSAFE_ISUPPORTS2(nsPKIParamBlock, nsIPKIParamBlock, - nsIDialogParamBlock) +NS_IMPL_ISUPPORTS2(nsPKIParamBlock, nsIPKIParamBlock, nsIDialogParamBlock) nsPKIParamBlock::nsPKIParamBlock() { diff --git a/security/manager/pki/src/nsPKIParamBlock.h b/security/manager/pki/src/nsPKIParamBlock.h index 1f5d324d4ca..5aeee6d6f2b 100644 --- a/security/manager/pki/src/nsPKIParamBlock.h +++ b/security/manager/pki/src/nsPKIParamBlock.h @@ -27,7 +27,7 @@ public: NS_DECL_NSIPKIPARAMBLOCK NS_DECL_NSIDIALOGPARAMBLOCK - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS private: nsCOMPtr mDialogParamBlock; nsCOMPtr mSupports; diff --git a/security/manager/ssl/src/TransportSecurityInfo.cpp b/security/manager/ssl/src/TransportSecurityInfo.cpp index 43ccff62585..a9a33cf56b4 100644 --- a/security/manager/ssl/src/TransportSecurityInfo.cpp +++ b/security/manager/ssl/src/TransportSecurityInfo.cpp @@ -68,13 +68,13 @@ TransportSecurityInfo::virtualDestroyNSSReference() { } -NS_IMPL_THREADSAFE_ISUPPORTS6(TransportSecurityInfo, - nsITransportSecurityInfo, - nsIInterfaceRequestor, - nsISSLStatusProvider, - nsIAssociatedContentSecurity, - nsISerializable, - nsIClassInfo) +NS_IMPL_ISUPPORTS6(TransportSecurityInfo, + nsITransportSecurityInfo, + nsIInterfaceRequestor, + nsISSLStatusProvider, + nsIAssociatedContentSecurity, + nsISerializable, + nsIClassInfo) nsresult TransportSecurityInfo::SetHostName(const char* host) diff --git a/security/manager/ssl/src/TransportSecurityInfo.h b/security/manager/ssl/src/TransportSecurityInfo.h index c13d89d27f0..ef827cafe42 100644 --- a/security/manager/ssl/src/TransportSecurityInfo.h +++ b/security/manager/ssl/src/TransportSecurityInfo.h @@ -38,7 +38,7 @@ public: TransportSecurityInfo(); virtual ~TransportSecurityInfo(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITRANSPORTSECURITYINFO NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSISSLSTATUSPROVIDER diff --git a/security/manager/ssl/src/nsCMS.cpp b/security/manager/ssl/src/nsCMS.cpp index 8443a433b14..b9f7ad531ec 100644 --- a/security/manager/ssl/src/nsCMS.cpp +++ b/security/manager/ssl/src/nsCMS.cpp @@ -29,8 +29,7 @@ using namespace mozilla; static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID); -NS_IMPL_THREADSAFE_ISUPPORTS2(nsCMSMessage, nsICMSMessage, - nsICMSMessage2) +NS_IMPL_ISUPPORTS2(nsCMSMessage, nsICMSMessage, nsICMSMessage2) nsCMSMessage::nsCMSMessage() { @@ -726,7 +725,7 @@ loser: return rv; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsCMSDecoder, nsICMSDecoder) +NS_IMPL_ISUPPORTS1(nsCMSDecoder, nsICMSDecoder) nsCMSDecoder::nsCMSDecoder() : m_dcx(nullptr) @@ -812,7 +811,7 @@ NS_IMETHODIMP nsCMSDecoder::Finish(nsICMSMessage ** aCMSMsg) return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsCMSEncoder, nsICMSEncoder) +NS_IMPL_ISUPPORTS1(nsCMSEncoder, nsICMSEncoder) nsCMSEncoder::nsCMSEncoder() : m_ecx(nullptr) diff --git a/security/manager/ssl/src/nsCMS.h b/security/manager/ssl/src/nsCMS.h index 0e3db1de139..9b1e19f1983 100644 --- a/security/manager/ssl/src/nsCMS.h +++ b/security/manager/ssl/src/nsCMS.h @@ -28,7 +28,7 @@ class nsCMSMessage : public nsICMSMessage, public nsNSSShutDownObject { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICMSMESSAGE NS_DECL_NSICMSMESSAGE2 @@ -64,7 +64,7 @@ class nsCMSDecoder : public nsICMSDecoder, public nsNSSShutDownObject { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICMSDECODER nsCMSDecoder(); @@ -87,7 +87,7 @@ class nsCMSEncoder : public nsICMSEncoder, public nsNSSShutDownObject { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICMSENCODER nsCMSEncoder(); diff --git a/security/manager/ssl/src/nsCertOverrideService.cpp b/security/manager/ssl/src/nsCertOverrideService.cpp index 37f1f07d99f..f6e92abcac8 100644 --- a/security/manager/ssl/src/nsCertOverrideService.cpp +++ b/security/manager/ssl/src/nsCertOverrideService.cpp @@ -81,10 +81,10 @@ nsCertOverride::convertStringToBits(const nsACString &str, OverrideBits &ob) } } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsCertOverrideService, - nsICertOverrideService, - nsIObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(nsCertOverrideService, + nsICertOverrideService, + nsIObserver, + nsISupportsWeakReference) nsCertOverrideService::nsCertOverrideService() : monitor("nsCertOverrideService.monitor") diff --git a/security/manager/ssl/src/nsCertOverrideService.h b/security/manager/ssl/src/nsCertOverrideService.h index 1e13829d3ed..9a20e547b8e 100644 --- a/security/manager/ssl/src/nsCertOverrideService.h +++ b/security/manager/ssl/src/nsCertOverrideService.h @@ -131,7 +131,7 @@ class nsCertOverrideService MOZ_FINAL : public nsICertOverrideService , public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICERTOVERRIDESERVICE NS_DECL_NSIOBSERVER diff --git a/security/manager/ssl/src/nsCertVerificationThread.cpp b/security/manager/ssl/src/nsCertVerificationThread.cpp index e21127fa3d3..7447d710ae2 100644 --- a/security/manager/ssl/src/nsCertVerificationThread.cpp +++ b/security/manager/ssl/src/nsCertVerificationThread.cpp @@ -10,7 +10,7 @@ using namespace mozilla; nsCertVerificationThread *nsCertVerificationThread::verification_thread_singleton; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsCertVerificationResult, nsICertVerificationResult) +NS_IMPL_ISUPPORTS1(nsCertVerificationResult, nsICertVerificationResult) namespace { class DispatchCertVerificationResult : public nsRunnable diff --git a/security/manager/ssl/src/nsClientAuthRemember.cpp b/security/manager/ssl/src/nsClientAuthRemember.cpp index 9d24254637b..edf5c831fa2 100644 --- a/security/manager/ssl/src/nsClientAuthRemember.cpp +++ b/security/manager/ssl/src/nsClientAuthRemember.cpp @@ -27,9 +27,9 @@ using namespace mozilla; using namespace mozilla::psm; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsClientAuthRememberService, - nsIObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS2(nsClientAuthRememberService, + nsIObserver, + nsISupportsWeakReference) nsClientAuthRememberService::nsClientAuthRememberService() : monitor("nsClientAuthRememberService.monitor") diff --git a/security/manager/ssl/src/nsClientAuthRemember.h b/security/manager/ssl/src/nsClientAuthRemember.h index 161303f0757..5d8fe226596 100644 --- a/security/manager/ssl/src/nsClientAuthRemember.h +++ b/security/manager/ssl/src/nsClientAuthRemember.h @@ -110,7 +110,7 @@ class nsClientAuthRememberService MOZ_FINAL : public nsIObserver, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER nsClientAuthRememberService(); diff --git a/security/manager/ssl/src/nsKeyModule.cpp b/security/manager/ssl/src/nsKeyModule.cpp index 1998b3c0042..48c350e3514 100644 --- a/security/manager/ssl/src/nsKeyModule.cpp +++ b/security/manager/ssl/src/nsKeyModule.cpp @@ -124,7 +124,7 @@ nsKeyObject::GetType(int16_t *_retval) ////////////////////////////////////////////////////////////////////////////// // nsIKeyObjectFactory -NS_IMPL_THREADSAFE_ISUPPORTS1(nsKeyObjectFactory, nsIKeyObjectFactory) +NS_IMPL_ISUPPORTS1(nsKeyObjectFactory, nsIKeyObjectFactory) nsKeyObjectFactory::nsKeyObjectFactory() { diff --git a/security/manager/ssl/src/nsKeyModule.h b/security/manager/ssl/src/nsKeyModule.h index d301382b781..d990da57995 100644 --- a/security/manager/ssl/src/nsKeyModule.h +++ b/security/manager/ssl/src/nsKeyModule.h @@ -52,7 +52,7 @@ class nsKeyObjectFactory MOZ_FINAL : public nsIKeyObjectFactory public: nsKeyObjectFactory(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIKEYOBJECTFACTORY private: diff --git a/security/manager/ssl/src/nsKeygenHandler.cpp b/security/manager/ssl/src/nsKeygenHandler.cpp index bea17f63be3..7ee34761896 100644 --- a/security/manager/ssl/src/nsKeygenHandler.cpp +++ b/security/manager/ssl/src/nsKeygenHandler.cpp @@ -258,7 +258,7 @@ decode_ec_params(const char *curve) return ecparams; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsKeygenFormProcessor, nsIFormProcessor) +NS_IMPL_ISUPPORTS1(nsKeygenFormProcessor, nsIFormProcessor) nsKeygenFormProcessor::nsKeygenFormProcessor() { diff --git a/security/manager/ssl/src/nsKeygenHandler.h b/security/manager/ssl/src/nsKeygenHandler.h index 28acc599c6c..2ac4bf3d744 100644 --- a/security/manager/ssl/src/nsKeygenHandler.h +++ b/security/manager/ssl/src/nsKeygenHandler.h @@ -33,7 +33,7 @@ public: NS_IMETHOD ProvideContent(const nsAString& aFormType, nsTArray& aContent, nsAString& aAttribute); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS static nsresult Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult); diff --git a/security/manager/ssl/src/nsKeygenThread.cpp b/security/manager/ssl/src/nsKeygenThread.cpp index 9c60fa7a975..effeabc4116 100644 --- a/security/manager/ssl/src/nsKeygenThread.cpp +++ b/security/manager/ssl/src/nsKeygenThread.cpp @@ -16,7 +16,7 @@ using namespace mozilla; using namespace mozilla::psm; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsKeygenThread, nsIKeygenThread) +NS_IMPL_ISUPPORTS1(nsKeygenThread, nsIKeygenThread) nsKeygenThread::nsKeygenThread() diff --git a/security/manager/ssl/src/nsKeygenThread.h b/security/manager/ssl/src/nsKeygenThread.h index 938aa8a8459..f4e05bfdee9 100644 --- a/security/manager/ssl/src/nsKeygenThread.h +++ b/security/manager/ssl/src/nsKeygenThread.h @@ -46,7 +46,7 @@ public: virtual ~nsKeygenThread(); NS_DECL_NSIKEYGENTHREAD - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS void SetParams( PK11SlotInfo *a_slot, diff --git a/security/manager/ssl/src/nsNSSASN1Object.cpp b/security/manager/ssl/src/nsNSSASN1Object.cpp index 4ce72d7b503..7ab68e4897f 100644 --- a/security/manager/ssl/src/nsNSSASN1Object.cpp +++ b/security/manager/ssl/src/nsNSSASN1Object.cpp @@ -9,10 +9,8 @@ #include "nsArrayUtils.h" #include "nsXPCOMCID.h" -NS_IMPL_THREADSAFE_ISUPPORTS2(nsNSSASN1Sequence, nsIASN1Sequence, - nsIASN1Object) -NS_IMPL_THREADSAFE_ISUPPORTS2(nsNSSASN1PrintableItem, nsIASN1PrintableItem, - nsIASN1Object) +NS_IMPL_ISUPPORTS2(nsNSSASN1Sequence, nsIASN1Sequence, nsIASN1Object) +NS_IMPL_ISUPPORTS2(nsNSSASN1PrintableItem, nsIASN1PrintableItem, nsIASN1Object) // This function is used to interpret an integer that // was encoded in a DER buffer. This function is used diff --git a/security/manager/ssl/src/nsNSSASN1Object.h b/security/manager/ssl/src/nsNSSASN1Object.h index 812703a3b5a..24901b1e5fe 100644 --- a/security/manager/ssl/src/nsNSSASN1Object.h +++ b/security/manager/ssl/src/nsNSSASN1Object.h @@ -20,7 +20,7 @@ class nsNSSASN1Sequence : public nsIASN1Sequence { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIASN1SEQUENCE NS_DECL_NSIASN1OBJECT @@ -40,7 +40,7 @@ private: class nsNSSASN1PrintableItem : public nsIASN1PrintableItem { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIASN1PRINTABLEITEM NS_DECL_NSIASN1OBJECT diff --git a/security/manager/ssl/src/nsNSSCallbacks.cpp b/security/manager/ssl/src/nsNSSCallbacks.cpp index 5e61a5ca0f9..633719c9ff3 100644 --- a/security/manager/ssl/src/nsNSSCallbacks.cpp +++ b/security/manager/ssl/src/nsNSSCallbacks.cpp @@ -298,13 +298,13 @@ SECStatus nsNSSHttpRequestSession::trySendAndReceiveFcn(PRPollDesc **pPollDesc, void nsNSSHttpRequestSession::AddRef() { - NS_AtomicIncrementRefcnt(mRefCount); + ++mRefCount; } void nsNSSHttpRequestSession::Release() { - int32_t newRefCount = NS_AtomicDecrementRefcnt(mRefCount); + int32_t newRefCount = --mRefCount; if (!newRefCount) { delete this; } @@ -569,7 +569,7 @@ nsHTTPListener::~nsHTTPListener() } } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsHTTPListener, nsIStreamLoaderObserver) +NS_IMPL_ISUPPORTS1(nsHTTPListener, nsIStreamLoaderObserver) void nsHTTPListener::FreeLoadGroup(bool aCancelLoad) diff --git a/security/manager/ssl/src/nsNSSCallbacks.h b/security/manager/ssl/src/nsNSSCallbacks.h index 39924a7edfd..0df1e87255e 100644 --- a/security/manager/ssl/src/nsNSSCallbacks.h +++ b/security/manager/ssl/src/nsNSSCallbacks.h @@ -37,7 +37,7 @@ private: public: nsHTTPListener(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTREAMLOADEROBSERVER nsCOMPtr mLoader; @@ -81,7 +81,7 @@ public: class nsNSSHttpRequestSession { protected: - int32_t mRefCount; + mozilla::ThreadSafeAutoRefCnt mRefCount; public: static SECStatus createFcn(SEC_HTTP_SERVER_SESSION session, diff --git a/security/manager/ssl/src/nsNSSCertCache.cpp b/security/manager/ssl/src/nsNSSCertCache.cpp index 5810ba52d9f..de9f053711d 100644 --- a/security/manager/ssl/src/nsNSSCertCache.cpp +++ b/security/manager/ssl/src/nsNSSCertCache.cpp @@ -11,7 +11,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsNSSCertCache, nsINSSCertCache) +NS_IMPL_ISUPPORTS1(nsNSSCertCache, nsINSSCertCache) nsNSSCertCache::nsNSSCertCache() :mutex("nsNSSCertCache.mutex"), mCertList(nullptr) diff --git a/security/manager/ssl/src/nsNSSCertCache.h b/security/manager/ssl/src/nsNSSCertCache.h index 58c39655d2c..eeef6ebc39c 100644 --- a/security/manager/ssl/src/nsNSSCertCache.h +++ b/security/manager/ssl/src/nsNSSCertCache.h @@ -16,7 +16,7 @@ class nsNSSCertCache : public nsINSSCertCache, public nsNSSShutDownObject { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSINSSCERTCACHE nsNSSCertCache(); diff --git a/security/manager/ssl/src/nsNSSCertValidity.cpp b/security/manager/ssl/src/nsNSSCertValidity.cpp index cc90398326f..459565852ab 100644 --- a/security/manager/ssl/src/nsNSSCertValidity.cpp +++ b/security/manager/ssl/src/nsNSSCertValidity.cpp @@ -12,7 +12,7 @@ #include "cert.h" /* Implementation file */ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsX509CertValidity, nsIX509CertValidity) +NS_IMPL_ISUPPORTS1(nsX509CertValidity, nsIX509CertValidity) nsX509CertValidity::nsX509CertValidity() : mTimesInitialized(false) { diff --git a/security/manager/ssl/src/nsNSSCertValidity.h b/security/manager/ssl/src/nsNSSCertValidity.h index 519eff87ecf..61560396348 100644 --- a/security/manager/ssl/src/nsNSSCertValidity.h +++ b/security/manager/ssl/src/nsNSSCertValidity.h @@ -12,7 +12,7 @@ class nsX509CertValidity : public nsIX509CertValidity { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIX509CERTVALIDITY nsX509CertValidity(); diff --git a/security/manager/ssl/src/nsNSSCertificate.cpp b/security/manager/ssl/src/nsNSSCertificate.cpp index 9b3a79392ce..ea1636357f6 100644 --- a/security/manager/ssl/src/nsNSSCertificate.cpp +++ b/security/manager/ssl/src/nsNSSCertificate.cpp @@ -68,13 +68,14 @@ NSSCleanupAutoPtrClass_WithParam(PLArenaPool, PORT_FreeArena, FalseParam, false) /* nsNSSCertificate */ -NS_IMPL_THREADSAFE_ISUPPORTS7(nsNSSCertificate, nsIX509Cert, - nsIX509Cert2, - nsIX509Cert3, - nsIIdentityInfo, - nsISMimeCert, - nsISerializable, - nsIClassInfo) +NS_IMPL_ISUPPORTS7(nsNSSCertificate, + nsIX509Cert, + nsIX509Cert2, + nsIX509Cert3, + nsIIdentityInfo, + nsISMimeCert, + nsISerializable, + nsIClassInfo) /* static */ nsNSSCertificate* @@ -1476,7 +1477,7 @@ char* nsNSSCertificate::defaultServerNickname(CERTCertificate* cert) return nickname; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsNSSCertList, nsIX509CertList) +NS_IMPL_ISUPPORTS1(nsNSSCertList, nsIX509CertList) nsNSSCertList::nsNSSCertList(CERTCertList *certList, bool adopt) { @@ -1582,8 +1583,7 @@ nsNSSCertList::GetEnumerator(nsISimpleEnumerator **_retval) return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsNSSCertListEnumerator, - nsISimpleEnumerator) +NS_IMPL_ISUPPORTS1(nsNSSCertListEnumerator, nsISimpleEnumerator) nsNSSCertListEnumerator::nsNSSCertListEnumerator(CERTCertList *certList) { diff --git a/security/manager/ssl/src/nsNSSCertificate.h b/security/manager/ssl/src/nsNSSCertificate.h index 8e3a7059a77..cdf52850adf 100644 --- a/security/manager/ssl/src/nsNSSCertificate.h +++ b/security/manager/ssl/src/nsNSSCertificate.h @@ -35,7 +35,7 @@ class nsNSSCertificate : public nsIX509Cert3, public nsNSSShutDownObject { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIX509CERT NS_DECL_NSIX509CERT2 NS_DECL_NSIX509CERT3 @@ -80,7 +80,7 @@ private: class nsNSSCertList: public nsIX509CertList { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIX509CERTLIST nsNSSCertList(CERTCertList *certList = nullptr, bool adopt = false); @@ -98,7 +98,7 @@ private: class nsNSSCertListEnumerator: public nsISimpleEnumerator { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISIMPLEENUMERATOR nsNSSCertListEnumerator(CERTCertList *certList); diff --git a/security/manager/ssl/src/nsNSSCertificateDB.cpp b/security/manager/ssl/src/nsNSSCertificateDB.cpp index 9423d8aadcd..9960bc0c271 100644 --- a/security/manager/ssl/src/nsNSSCertificateDB.cpp +++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp @@ -58,7 +58,7 @@ extern PRLogModuleInfo* gPIPNSSLog; static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID); -NS_IMPL_THREADSAFE_ISUPPORTS2(nsNSSCertificateDB, nsIX509CertDB, nsIX509CertDB2) +NS_IMPL_ISUPPORTS2(nsNSSCertificateDB, nsIX509CertDB, nsIX509CertDB2) nsNSSCertificateDB::nsNSSCertificateDB() : mBadCertsLock("nsNSSCertificateDB::mBadCertsLock") diff --git a/security/manager/ssl/src/nsNSSCertificateDB.h b/security/manager/ssl/src/nsNSSCertificateDB.h index 5ef5015598d..663db5c02ee 100644 --- a/security/manager/ssl/src/nsNSSCertificateDB.h +++ b/security/manager/ssl/src/nsNSSCertificateDB.h @@ -18,7 +18,7 @@ class nsRecentBadCerts; class nsNSSCertificateDB : public nsIX509CertDB, public nsIX509CertDB2 { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIX509CERTDB NS_DECL_NSIX509CERTDB2 diff --git a/security/manager/ssl/src/nsNSSCertificateFakeTransport.cpp b/security/manager/ssl/src/nsNSSCertificateFakeTransport.cpp index b4979d52212..49fe6fa628c 100644 --- a/security/manager/ssl/src/nsNSSCertificateFakeTransport.cpp +++ b/security/manager/ssl/src/nsNSSCertificateFakeTransport.cpp @@ -20,9 +20,10 @@ extern PRLogModuleInfo* gPIPNSSLog; /* nsNSSCertificateFakeTransport */ -NS_IMPL_THREADSAFE_ISUPPORTS3(nsNSSCertificateFakeTransport, nsIX509Cert, - nsISerializable, - nsIClassInfo) +NS_IMPL_ISUPPORTS3(nsNSSCertificateFakeTransport, + nsIX509Cert, + nsISerializable, + nsIClassInfo) nsNSSCertificateFakeTransport::nsNSSCertificateFakeTransport() : mCertSerialization(nullptr) diff --git a/security/manager/ssl/src/nsNSSCertificateFakeTransport.h b/security/manager/ssl/src/nsNSSCertificateFakeTransport.h index ca16406848f..a9e98b1bad5 100644 --- a/security/manager/ssl/src/nsNSSCertificateFakeTransport.h +++ b/security/manager/ssl/src/nsNSSCertificateFakeTransport.h @@ -17,7 +17,7 @@ class nsNSSCertificateFakeTransport : public nsIX509Cert, public nsIClassInfo { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIX509CERT NS_DECL_NSISERIALIZABLE NS_DECL_NSICLASSINFO diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp index c97ddd5910e..3a40060cc6b 100644 --- a/security/manager/ssl/src/nsNSSComponent.cpp +++ b/security/manager/ssl/src/nsNSSComponent.cpp @@ -95,14 +95,14 @@ public: virtual ~nsTokenEventRunnable(); NS_IMETHOD Run (); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS private: nsString mType; nsString mTokenName; }; // ISuuports implementation for nsTokenEventRunnable -NS_IMPL_THREADSAFE_ISUPPORTS1(nsTokenEventRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsTokenEventRunnable, nsIRunnable) nsTokenEventRunnable::nsTokenEventRunnable(const nsAString &aType, const nsAString &aTokenName): mType(aType), mTokenName(aTokenName) { } @@ -1411,12 +1411,12 @@ nsNSSComponent::Init() } /* nsISupports Implementation for the class */ -NS_IMPL_THREADSAFE_ISUPPORTS5(nsNSSComponent, - nsISignatureVerifier, - nsIEntropyCollector, - nsINSSComponent, - nsIObserver, - nsISupportsWeakReference) +NS_IMPL_ISUPPORTS5(nsNSSComponent, + nsISignatureVerifier, + nsIEntropyCollector, + nsINSSComponent, + nsIObserver, + nsISupportsWeakReference) /* Callback functions for decoder. For now, use empty/default functions. */ @@ -1886,7 +1886,7 @@ nsNSSComponent::GetDefaultCertVerifier(RefPtr &out) return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(PipUIContext, nsIInterfaceRequestor) +NS_IMPL_ISUPPORTS1(PipUIContext, nsIInterfaceRequestor) PipUIContext::PipUIContext() { diff --git a/security/manager/ssl/src/nsNSSComponent.h b/security/manager/ssl/src/nsNSSComponent.h index 1c45bc0f334..ed5cab9abdc 100644 --- a/security/manager/ssl/src/nsNSSComponent.h +++ b/security/manager/ssl/src/nsNSSComponent.h @@ -133,7 +133,7 @@ public: nsNSSComponent(); virtual ~nsNSSComponent(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISIGNATUREVERIFIER NS_DECL_NSIENTROPYCOLLECTOR NS_DECL_NSIOBSERVER diff --git a/security/manager/ssl/src/nsNSSHelper.h b/security/manager/ssl/src/nsNSSHelper.h index 9c9ce70bb44..34a5af22069 100644 --- a/security/manager/ssl/src/nsNSSHelper.h +++ b/security/manager/ssl/src/nsNSSHelper.h @@ -18,7 +18,7 @@ class PipUIContext : public nsIInterfaceRequestor { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR PipUIContext(); diff --git a/security/manager/ssl/src/nsNSSIOLayer.cpp b/security/manager/ssl/src/nsNSSIOLayer.cpp index cd079797d4f..6c42053ac1a 100644 --- a/security/manager/ssl/src/nsNSSIOLayer.cpp +++ b/security/manager/ssl/src/nsNSSIOLayer.cpp @@ -1321,7 +1321,7 @@ static int64_t PSMAvailable64(void) namespace { class PrefObserver : public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER PrefObserver(nsSSLIOLayerHelpers* aOwner) : mOwner(aOwner) {} virtual ~PrefObserver() {} @@ -1330,7 +1330,7 @@ private: }; } // namespace anonymous -NS_IMPL_THREADSAFE_ISUPPORTS1(PrefObserver, nsIObserver) +NS_IMPL_ISUPPORTS1(PrefObserver, nsIObserver) NS_IMETHODIMP PrefObserver::Observe(nsISupports *aSubject, const char *aTopic, diff --git a/security/manager/ssl/src/nsProtectedAuthThread.cpp b/security/manager/ssl/src/nsProtectedAuthThread.cpp index b5f4c45793f..55a4e87c83f 100644 --- a/security/manager/ssl/src/nsProtectedAuthThread.cpp +++ b/security/manager/ssl/src/nsProtectedAuthThread.cpp @@ -15,7 +15,7 @@ using namespace mozilla; using namespace mozilla::psm; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsProtectedAuthThread, nsIProtectedAuthThread) +NS_IMPL_ISUPPORTS1(nsProtectedAuthThread, nsIProtectedAuthThread) static void nsProtectedAuthThreadRunner(void *arg) { diff --git a/security/manager/ssl/src/nsProtectedAuthThread.h b/security/manager/ssl/src/nsProtectedAuthThread.h index 4959be8dbab..eae24f9d5bf 100644 --- a/security/manager/ssl/src/nsProtectedAuthThread.h +++ b/security/manager/ssl/src/nsProtectedAuthThread.h @@ -37,7 +37,7 @@ public: nsProtectedAuthThread(); virtual ~nsProtectedAuthThread(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTECTEDAUTHTHREAD // Sets parameters for the thread diff --git a/security/manager/ssl/src/nsRandomGenerator.cpp b/security/manager/ssl/src/nsRandomGenerator.cpp index 6c043c9dcd8..9af20a80c5e 100644 --- a/security/manager/ssl/src/nsRandomGenerator.cpp +++ b/security/manager/ssl/src/nsRandomGenerator.cpp @@ -11,7 +11,7 @@ //////////////////////////////////////////////////////////////////////////////// //// nsRandomGenerator -NS_IMPL_THREADSAFE_ISUPPORTS1(nsRandomGenerator, nsIRandomGenerator) +NS_IMPL_ISUPPORTS1(nsRandomGenerator, nsIRandomGenerator) //////////////////////////////////////////////////////////////////////////////// //// nsIRandomGenerator diff --git a/security/manager/ssl/src/nsRandomGenerator.h b/security/manager/ssl/src/nsRandomGenerator.h index 864ef7229c7..efbaa844a55 100644 --- a/security/manager/ssl/src/nsRandomGenerator.h +++ b/security/manager/ssl/src/nsRandomGenerator.h @@ -17,7 +17,7 @@ class nsRandomGenerator MOZ_FINAL : public nsIRandomGenerator { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRANDOMGENERATOR }; diff --git a/security/manager/ssl/src/nsRecentBadCerts.cpp b/security/manager/ssl/src/nsRecentBadCerts.cpp index 1b121cc767d..e53706c83be 100644 --- a/security/manager/ssl/src/nsRecentBadCerts.cpp +++ b/security/manager/ssl/src/nsRecentBadCerts.cpp @@ -22,8 +22,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsRecentBadCerts, - nsIRecentBadCerts) +NS_IMPL_ISUPPORTS1(nsRecentBadCerts, nsIRecentBadCerts) nsRecentBadCerts::nsRecentBadCerts() :monitor("nsRecentBadCerts.monitor") diff --git a/security/manager/ssl/src/nsRecentBadCerts.h b/security/manager/ssl/src/nsRecentBadCerts.h index 064cb46cd1e..a9c5435099c 100644 --- a/security/manager/ssl/src/nsRecentBadCerts.h +++ b/security/manager/ssl/src/nsRecentBadCerts.h @@ -57,7 +57,7 @@ private: class nsRecentBadCerts MOZ_FINAL : public nsIRecentBadCerts { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRECENTBADCERTS nsRecentBadCerts(); diff --git a/security/manager/ssl/src/nsSSLSocketProvider.cpp b/security/manager/ssl/src/nsSSLSocketProvider.cpp index ce040272869..de9d8edc8eb 100644 --- a/security/manager/ssl/src/nsSSLSocketProvider.cpp +++ b/security/manager/ssl/src/nsSSLSocketProvider.cpp @@ -16,7 +16,7 @@ nsSSLSocketProvider::~nsSSLSocketProvider() { } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsSSLSocketProvider, nsISocketProvider) +NS_IMPL_ISUPPORTS1(nsSSLSocketProvider, nsISocketProvider) NS_IMETHODIMP nsSSLSocketProvider::NewSocket(int32_t family, diff --git a/security/manager/ssl/src/nsSSLSocketProvider.h b/security/manager/ssl/src/nsSSLSocketProvider.h index 63ee8140c40..966e931b16a 100644 --- a/security/manager/ssl/src/nsSSLSocketProvider.h +++ b/security/manager/ssl/src/nsSSLSocketProvider.h @@ -17,7 +17,7 @@ class nsSSLSocketProvider : public nsISocketProvider { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISOCKETPROVIDER // nsSSLSocketProvider methods: diff --git a/security/manager/ssl/src/nsSSLStatus.cpp b/security/manager/ssl/src/nsSSLStatus.cpp index ad162b56bd6..b133b7f7348 100644 --- a/security/manager/ssl/src/nsSSLStatus.cpp +++ b/security/manager/ssl/src/nsSSLStatus.cpp @@ -223,7 +223,7 @@ nsSSLStatus::nsSSLStatus() mCipherName = ""; } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsSSLStatus, nsISSLStatus, nsISerializable, nsIClassInfo) +NS_IMPL_ISUPPORTS3(nsSSLStatus, nsISSLStatus, nsISerializable, nsIClassInfo) nsSSLStatus::~nsSSLStatus() { diff --git a/security/manager/ssl/src/nsSSLStatus.h b/security/manager/ssl/src/nsSSLStatus.h index 61599779a7e..5d8c81e5710 100644 --- a/security/manager/ssl/src/nsSSLStatus.h +++ b/security/manager/ssl/src/nsSSLStatus.h @@ -20,7 +20,7 @@ class nsSSLStatus , public nsIClassInfo { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISSLSTATUS NS_DECL_NSISERIALIZABLE NS_DECL_NSICLASSINFO diff --git a/security/manager/ssl/src/nsTLSSocketProvider.cpp b/security/manager/ssl/src/nsTLSSocketProvider.cpp index 99634801992..822051664e4 100644 --- a/security/manager/ssl/src/nsTLSSocketProvider.cpp +++ b/security/manager/ssl/src/nsTLSSocketProvider.cpp @@ -16,7 +16,7 @@ nsTLSSocketProvider::~nsTLSSocketProvider() { } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsTLSSocketProvider, nsISocketProvider) +NS_IMPL_ISUPPORTS1(nsTLSSocketProvider, nsISocketProvider) NS_IMETHODIMP nsTLSSocketProvider::NewSocket(int32_t family, diff --git a/security/manager/ssl/src/nsTLSSocketProvider.h b/security/manager/ssl/src/nsTLSSocketProvider.h index 69bc83728d4..434110788b7 100644 --- a/security/manager/ssl/src/nsTLSSocketProvider.h +++ b/security/manager/ssl/src/nsTLSSocketProvider.h @@ -21,7 +21,7 @@ class nsTLSSocketProvider : public nsISocketProvider { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISOCKETPROVIDER // nsTLSSocketProvider methods: diff --git a/security/manager/ssl/src/nsVerificationJob.h b/security/manager/ssl/src/nsVerificationJob.h index 6efe77babab..db1bfb0b802 100644 --- a/security/manager/ssl/src/nsVerificationJob.h +++ b/security/manager/ssl/src/nsVerificationJob.h @@ -37,7 +37,7 @@ public: nsCertVerificationResult(); virtual ~nsCertVerificationResult(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICERTVERIFICATIONRESULT private: From a454803aeec5af74d80bdf6d6d5d4b0edf99b9b3 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:14 -0500 Subject: [PATCH 42/69] Bug 884061 - Part 3t: Use NS_DECL_THREADSAFE_ISUPPORTS in startupcache/, r=mwu --HG-- extra : rebase_source : 8a990b22d5b98b2b25f26530fe1f88ac388ae788 --- startupcache/StartupCache.cpp | 4 ++-- startupcache/StartupCache.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index 5e8b9c2f210..da91e74b2e4 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -560,7 +560,7 @@ StartupCache::WriteTimeout(nsITimer *aTimer, void *aClosure) // We don't want to refcount StartupCache, so we'll just // hold a ref to this and pass it to observerService instead. -NS_IMPL_THREADSAFE_ISUPPORTS1(StartupCacheListener, nsIObserver) +NS_IMPL_ISUPPORTS1(StartupCacheListener, nsIObserver) nsresult StartupCacheListener::Observe(nsISupports *subject, const char* topic, const PRUnichar* data) @@ -715,7 +715,7 @@ StartupCacheDebugOutputStream::PutBuffer(char* aBuffer, uint32_t aLength) StartupCacheWrapper* StartupCacheWrapper::gStartupCacheWrapper = nullptr; -NS_IMPL_THREADSAFE_ISUPPORTS1(StartupCacheWrapper, nsIStartupCache) +NS_IMPL_ISUPPORTS1(StartupCacheWrapper, nsIStartupCache) StartupCacheWrapper* StartupCacheWrapper::GetSingleton() { diff --git a/startupcache/StartupCache.h b/startupcache/StartupCache.h index e2f7a03b999..b96540360c7 100644 --- a/startupcache/StartupCache.h +++ b/startupcache/StartupCache.h @@ -92,7 +92,7 @@ struct CacheEntry // refcount its listeners, so we'll let it refcount this instead. class StartupCacheListener MOZ_FINAL : public nsIObserver { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER }; @@ -214,7 +214,7 @@ class StartupCacheDebugOutputStream MOZ_FINAL class StartupCacheWrapper MOZ_FINAL : public nsIStartupCache { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTARTUPCACHE static StartupCacheWrapper* GetSingleton(); From d94a47f56922aec1a4c34a074b7eb2a1b1029109 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:15 -0500 Subject: [PATCH 43/69] Bug 884061 - Part 3u: Use NS_DECL_THREADSAFE_ISUPPORTS in storage/, r=mak --HG-- extra : rebase_source : fdc61fe0dad1e88c33325e32c755ed8f2c389af2 --- storage/src/Variant.h | 2 +- storage/src/Variant_inl.h | 6 +++--- storage/src/mozStorageAsyncStatement.cpp | 4 ++-- storage/src/mozStorageAsyncStatement.h | 2 +- storage/src/mozStorageAsyncStatementExecution.cpp | 2 +- storage/src/mozStorageAsyncStatementExecution.h | 2 +- storage/src/mozStorageBindingParams.cpp | 2 +- storage/src/mozStorageBindingParams.h | 2 +- storage/src/mozStorageBindingParamsArray.cpp | 2 +- storage/src/mozStorageBindingParamsArray.h | 2 +- storage/src/mozStorageConnection.cpp | 6 +++--- storage/src/mozStorageConnection.h | 2 +- storage/src/mozStorageError.cpp | 2 +- storage/src/mozStorageError.h | 2 +- storage/src/mozStorageResultSet.cpp | 2 +- storage/src/mozStorageResultSet.h | 2 +- storage/src/mozStorageRow.cpp | 2 +- storage/src/mozStorageRow.h | 2 +- storage/src/mozStorageService.cpp | 6 +++--- storage/src/mozStorageService.h | 2 +- storage/src/mozStorageStatement.cpp | 4 ++-- storage/src/mozStorageStatement.h | 2 +- storage/style.txt | 2 +- 23 files changed, 31 insertions(+), 31 deletions(-) diff --git a/storage/src/Variant.h b/storage/src/Variant.h index 8b9a59f89be..c9f85abf53e 100644 --- a/storage/src/Variant.h +++ b/storage/src/Variant.h @@ -34,7 +34,7 @@ namespace storage { class Variant_base : public nsIVariant { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIVARIANT protected: diff --git a/storage/src/Variant_inl.h b/storage/src/Variant_inl.h index 5f19ac4fb89..57a5af55dd5 100644 --- a/storage/src/Variant_inl.h +++ b/storage/src/Variant_inl.h @@ -18,9 +18,9 @@ namespace storage { //////////////////////////////////////////////////////////////////////////////// //// Variant_base -inline NS_IMPL_THREADSAFE_ADDREF(Variant_base) -inline NS_IMPL_THREADSAFE_RELEASE(Variant_base) -inline NS_IMPL_THREADSAFE_QUERY_INTERFACE1( +inline NS_IMPL_ADDREF(Variant_base) +inline NS_IMPL_RELEASE(Variant_base) +inline NS_IMPL_QUERY_INTERFACE1( Variant_base, nsIVariant ) diff --git a/storage/src/mozStorageAsyncStatement.cpp b/storage/src/mozStorageAsyncStatement.cpp index 3c1f47b2fee..7ffb3ee7802 100644 --- a/storage/src/mozStorageAsyncStatement.cpp +++ b/storage/src/mozStorageAsyncStatement.cpp @@ -262,8 +262,8 @@ AsyncStatement::cleanupJSHelpers() //////////////////////////////////////////////////////////////////////////////// //// nsISupports -NS_IMPL_THREADSAFE_ADDREF(AsyncStatement) -NS_IMPL_THREADSAFE_RELEASE(AsyncStatement) +NS_IMPL_ADDREF(AsyncStatement) +NS_IMPL_RELEASE(AsyncStatement) NS_INTERFACE_MAP_BEGIN(AsyncStatement) NS_INTERFACE_MAP_ENTRY(mozIStorageAsyncStatement) diff --git a/storage/src/mozStorageAsyncStatement.h b/storage/src/mozStorageAsyncStatement.h index 25b291d28ef..46224daeb35 100644 --- a/storage/src/mozStorageAsyncStatement.h +++ b/storage/src/mozStorageAsyncStatement.h @@ -31,7 +31,7 @@ class AsyncStatement MOZ_FINAL : public mozIStorageAsyncStatement , public StorageBaseStatementInternal { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEASYNCSTATEMENT NS_DECL_MOZISTORAGEBASESTATEMENT NS_DECL_MOZISTORAGEBINDINGPARAMS diff --git a/storage/src/mozStorageAsyncStatementExecution.cpp b/storage/src/mozStorageAsyncStatementExecution.cpp index ef1a0fac603..70cbe755ccb 100644 --- a/storage/src/mozStorageAsyncStatementExecution.cpp +++ b/storage/src/mozStorageAsyncStatementExecution.cpp @@ -514,7 +514,7 @@ AsyncExecuteStatements::notifyResults() return rv; } -NS_IMPL_THREADSAFE_ISUPPORTS2( +NS_IMPL_ISUPPORTS2( AsyncExecuteStatements, nsIRunnable, mozIStoragePendingStatement diff --git a/storage/src/mozStorageAsyncStatementExecution.h b/storage/src/mozStorageAsyncStatementExecution.h index 28dcf29e46d..4553339826a 100644 --- a/storage/src/mozStorageAsyncStatementExecution.h +++ b/storage/src/mozStorageAsyncStatementExecution.h @@ -41,7 +41,7 @@ class AsyncExecuteStatements MOZ_FINAL : public nsIRunnable , public mozIStoragePendingStatement { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_MOZISTORAGEPENDINGSTATEMENT diff --git a/storage/src/mozStorageBindingParams.cpp b/storage/src/mozStorageBindingParams.cpp index 75e821164bc..5f0deebfc43 100644 --- a/storage/src/mozStorageBindingParams.cpp +++ b/storage/src/mozStorageBindingParams.cpp @@ -202,7 +202,7 @@ AsyncBindingParams::iterateOverNamedParameters(const nsACString &aName, //////////////////////////////////////////////////////////////////////////////// //// nsISupports -NS_IMPL_THREADSAFE_ISUPPORTS2( +NS_IMPL_ISUPPORTS2( BindingParams , mozIStorageBindingParams , IStorageBindingParamsInternal diff --git a/storage/src/mozStorageBindingParams.h b/storage/src/mozStorageBindingParams.h index 0426dea7922..53db96bc855 100644 --- a/storage/src/mozStorageBindingParams.h +++ b/storage/src/mozStorageBindingParams.h @@ -25,7 +25,7 @@ class BindingParams : public mozIStorageBindingParams , public IStorageBindingParamsInternal { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEBINDINGPARAMS NS_DECL_ISTORAGEBINDINGPARAMSINTERNAL diff --git a/storage/src/mozStorageBindingParamsArray.cpp b/storage/src/mozStorageBindingParamsArray.cpp index 554cb86c720..a543a754f30 100644 --- a/storage/src/mozStorageBindingParamsArray.cpp +++ b/storage/src/mozStorageBindingParamsArray.cpp @@ -39,7 +39,7 @@ BindingParamsArray::getOwner() const return mOwningStatement; } -NS_IMPL_THREADSAFE_ISUPPORTS1( +NS_IMPL_ISUPPORTS1( BindingParamsArray, mozIStorageBindingParamsArray ) diff --git a/storage/src/mozStorageBindingParamsArray.h b/storage/src/mozStorageBindingParamsArray.h index bee4556d49a..37a41849d73 100644 --- a/storage/src/mozStorageBindingParamsArray.h +++ b/storage/src/mozStorageBindingParamsArray.h @@ -23,7 +23,7 @@ class BindingParamsArray MOZ_FINAL : public mozIStorageBindingParamsArray typedef nsTArray< nsCOMPtr > array_type; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEBINDINGPARAMSARRAY BindingParamsArray(StorageBaseStatementInternal *aOwningStatement); diff --git a/storage/src/mozStorageConnection.cpp b/storage/src/mozStorageConnection.cpp index 3911483782a..431539827d2 100644 --- a/storage/src/mozStorageConnection.cpp +++ b/storage/src/mozStorageConnection.cpp @@ -497,7 +497,7 @@ Connection::~Connection() "AsyncClose has not been invoked on this connection!"); } -NS_IMPL_THREADSAFE_ADDREF(Connection) +NS_IMPL_ADDREF(Connection) NS_INTERFACE_MAP_BEGIN(Connection) NS_INTERFACE_MAP_ENTRY(mozIStorageAsyncConnection) @@ -506,12 +506,12 @@ NS_INTERFACE_MAP_BEGIN(Connection) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, mozIStorageConnection) NS_INTERFACE_MAP_END -// This is identical to what NS_IMPL_THREADSAFE_RELEASE provides, but with the +// This is identical to what NS_IMPL_RELEASE provides, but with the // extra |1 == count| case. NS_IMETHODIMP_(nsrefcnt) Connection::Release(void) { NS_PRECONDITION(0 != mRefCnt, "dup release"); - nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); + nsrefcnt count = --mRefCnt; NS_LOG_RELEASE(this, count, "Connection"); if (1 == count) { // If the refcount is 1, the single reference must be from diff --git a/storage/src/mozStorageConnection.h b/storage/src/mozStorageConnection.h index 2ea569e6eb5..a291e2541a7 100644 --- a/storage/src/mozStorageConnection.h +++ b/storage/src/mozStorageConnection.h @@ -40,7 +40,7 @@ class Connection MOZ_FINAL : public mozIStorageConnection , public nsIInterfaceRequestor { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEASYNCCONNECTION NS_DECL_MOZISTORAGECONNECTION NS_DECL_NSIINTERFACEREQUESTOR diff --git a/storage/src/mozStorageError.cpp b/storage/src/mozStorageError.cpp index 5f7194fb2f4..d8088851b87 100644 --- a/storage/src/mozStorageError.cpp +++ b/storage/src/mozStorageError.cpp @@ -23,7 +23,7 @@ Error::Error(int aResult, * Note: This object is only ever accessed on one thread at a time. It it not * threadsafe, but it does need threadsafe AddRef and Release. */ -NS_IMPL_THREADSAFE_ISUPPORTS1( +NS_IMPL_ISUPPORTS1( Error, mozIStorageError ) diff --git a/storage/src/mozStorageError.h b/storage/src/mozStorageError.h index 7126e5893a7..1d5a0f4ca55 100644 --- a/storage/src/mozStorageError.h +++ b/storage/src/mozStorageError.h @@ -17,7 +17,7 @@ namespace storage { class Error MOZ_FINAL : public mozIStorageError { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEERROR Error(int aResult, const char *aMessage); diff --git a/storage/src/mozStorageResultSet.cpp b/storage/src/mozStorageResultSet.cpp index 71ed5bde1cd..67449519935 100644 --- a/storage/src/mozStorageResultSet.cpp +++ b/storage/src/mozStorageResultSet.cpp @@ -33,7 +33,7 @@ ResultSet::add(mozIStorageRow *aRow) * Note: This object is only ever accessed on one thread at a time. It it not * threadsafe, but it does need threadsafe AddRef and Release. */ -NS_IMPL_THREADSAFE_ISUPPORTS1( +NS_IMPL_ISUPPORTS1( ResultSet, mozIStorageResultSet ) diff --git a/storage/src/mozStorageResultSet.h b/storage/src/mozStorageResultSet.h index ea5007d3333..98fc5ab0ad4 100644 --- a/storage/src/mozStorageResultSet.h +++ b/storage/src/mozStorageResultSet.h @@ -18,7 +18,7 @@ namespace storage { class ResultSet MOZ_FINAL : public mozIStorageResultSet { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGERESULTSET ResultSet(); diff --git a/storage/src/mozStorageRow.cpp b/storage/src/mozStorageRow.cpp index c7d748b7383..912904287fe 100644 --- a/storage/src/mozStorageRow.cpp +++ b/storage/src/mozStorageRow.cpp @@ -78,7 +78,7 @@ Row::initialize(sqlite3_stmt *aStatement) * Note: This object is only ever accessed on one thread at a time. It it not * threadsafe, but it does need threadsafe AddRef and Release. */ -NS_IMPL_THREADSAFE_ISUPPORTS2( +NS_IMPL_ISUPPORTS2( Row, mozIStorageRow, mozIStorageValueArray diff --git a/storage/src/mozStorageRow.h b/storage/src/mozStorageRow.h index 99b16f79f98..10968b1d66b 100644 --- a/storage/src/mozStorageRow.h +++ b/storage/src/mozStorageRow.h @@ -20,7 +20,7 @@ namespace storage { class Row MOZ_FINAL : public mozIStorageRow { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEROW NS_DECL_MOZISTORAGEVALUEARRAY diff --git a/storage/src/mozStorageService.cpp b/storage/src/mozStorageService.cpp index 44481b3982b..45c35a05f49 100644 --- a/storage/src/mozStorageService.cpp +++ b/storage/src/mozStorageService.cpp @@ -79,7 +79,7 @@ private: nsCString mSchemaDesc; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS StorageSQLiteMultiReporter(Service *aService) : mService(aService) @@ -216,7 +216,7 @@ private: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1( +NS_IMPL_ISUPPORTS1( StorageSQLiteMultiReporter, nsIMemoryMultiReporter ) @@ -224,7 +224,7 @@ NS_IMPL_THREADSAFE_ISUPPORTS1( //////////////////////////////////////////////////////////////////////////////// //// Service -NS_IMPL_THREADSAFE_ISUPPORTS2( +NS_IMPL_ISUPPORTS2( Service, mozIStorageService, nsIObserver diff --git a/storage/src/mozStorageService.h b/storage/src/mozStorageService.h index b024bd9901a..18a70a22079 100644 --- a/storage/src/mozStorageService.h +++ b/storage/src/mozStorageService.h @@ -53,7 +53,7 @@ public: static Service *getSingleton(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGESERVICE NS_DECL_NSIOBSERVER diff --git a/storage/src/mozStorageStatement.cpp b/storage/src/mozStorageStatement.cpp index d42a458cd44..9d0f74f6323 100644 --- a/storage/src/mozStorageStatement.cpp +++ b/storage/src/mozStorageStatement.cpp @@ -250,8 +250,8 @@ Statement::~Statement() //////////////////////////////////////////////////////////////////////////////// //// nsISupports -NS_IMPL_THREADSAFE_ADDREF(Statement) -NS_IMPL_THREADSAFE_RELEASE(Statement) +NS_IMPL_ADDREF(Statement) +NS_IMPL_RELEASE(Statement) NS_INTERFACE_MAP_BEGIN(Statement) NS_INTERFACE_MAP_ENTRY(mozIStorageStatement) diff --git a/storage/src/mozStorageStatement.h b/storage/src/mozStorageStatement.h index 71ab3f4ac1b..7ef5b3e0892 100644 --- a/storage/src/mozStorageStatement.h +++ b/storage/src/mozStorageStatement.h @@ -32,7 +32,7 @@ class Statement MOZ_FINAL : public mozIStorageStatement , public StorageBaseStatementInternal { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGESTATEMENT NS_DECL_MOZISTORAGEBASESTATEMENT NS_DECL_MOZISTORAGEBINDINGPARAMS diff --git a/storage/style.txt b/storage/style.txt index b7f701ba655..6b89c9a9324 100644 --- a/storage/style.txt +++ b/storage/style.txt @@ -108,7 +108,7 @@ 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/. */ -NS_IMPL_THREADSAFE_ISUPPORTS2( +NS_IMPL_ISUPPORTS2( Foo , IBar , IBaz From 48e91a819cfdb9b5dbe3886127062bd4e9b56886 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:15 -0500 Subject: [PATCH 44/69] Bug 884061 - Part 3v: Use NS_DECL_THREADSAFE_ISUPPORTS in toolkit/, r=Mossop --HG-- extra : rebase_source : ad2b2f20219b42b192c313b6fa9da3383f904805 --- toolkit/components/alerts/nsAlertsService.cpp | 2 +- toolkit/components/alerts/nsAlertsService.h | 2 +- toolkit/components/downloads/SQLFunctions.cpp | 2 +- toolkit/components/downloads/SQLFunctions.h | 2 +- toolkit/components/places/Database.cpp | 6 +++--- toolkit/components/places/Database.h | 2 +- toolkit/components/places/Helpers.cpp | 2 +- toolkit/components/places/Helpers.h | 2 +- toolkit/components/places/History.cpp | 2 +- toolkit/components/places/History.h | 2 +- toolkit/components/places/SQLFunctions.cpp | 10 +++++----- toolkit/components/places/SQLFunctions.h | 10 +++++----- toolkit/components/places/nsNavHistory.cpp | 4 ++-- toolkit/components/places/nsNavHistory.h | 2 +- toolkit/components/startup/nsAppStartup.cpp | 2 +- toolkit/components/startup/nsAppStartup.h | 2 +- toolkit/components/telemetry/Telemetry.cpp | 4 ++-- .../url-classifier/nsUrlClassifierDBService.cpp | 14 +++++++------- .../url-classifier/nsUrlClassifierDBService.h | 2 +- .../url-classifier/nsUrlClassifierPrefixSet.cpp | 4 ++-- .../url-classifier/nsUrlClassifierProxies.cpp | 8 ++++---- .../url-classifier/nsUrlClassifierProxies.h | 8 ++++---- .../nsUrlClassifierStreamUpdater.cpp | 2 +- .../url-classifier/nsUrlClassifierStreamUpdater.h | 2 +- toolkit/identity/IdentityCryptoService.cpp | 8 ++++---- .../androidproxy/nsAndroidSystemProxySettings.cpp | 4 ++-- .../system/osxproxy/nsOSXSystemProxySettings.mm | 4 ++-- toolkit/system/unixproxy/nsLibProxySettings.cpp | 4 ++-- .../windowsproxy/nsWindowsSystemProxySettings.cpp | 4 ++-- toolkit/xre/nsUpdateDriver.cpp | 2 +- toolkit/xre/nsUpdateDriver.h | 2 +- 31 files changed, 63 insertions(+), 63 deletions(-) diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp index be3a92861e7..f1e0781541f 100644 --- a/toolkit/components/alerts/nsAlertsService.cpp +++ b/toolkit/components/alerts/nsAlertsService.cpp @@ -24,7 +24,7 @@ using namespace mozilla; using mozilla::dom::ContentChild; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsAlertsService, nsIAlertsService, nsIAlertsProgressListener) +NS_IMPL_ISUPPORTS2(nsAlertsService, nsIAlertsService, nsIAlertsProgressListener) nsAlertsService::nsAlertsService() { diff --git a/toolkit/components/alerts/nsAlertsService.h b/toolkit/components/alerts/nsAlertsService.h index c0f228417e5..e825a5acf89 100644 --- a/toolkit/components/alerts/nsAlertsService.h +++ b/toolkit/components/alerts/nsAlertsService.h @@ -33,7 +33,7 @@ class nsAlertsService : public nsIAlertsService, public: NS_DECL_NSIALERTSPROGRESSLISTENER NS_DECL_NSIALERTSSERVICE - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsAlertsService(); virtual ~nsAlertsService(); diff --git a/toolkit/components/downloads/SQLFunctions.cpp b/toolkit/components/downloads/SQLFunctions.cpp index 3a52ea3af9f..8cf6f97a502 100644 --- a/toolkit/components/downloads/SQLFunctions.cpp +++ b/toolkit/components/downloads/SQLFunctions.cpp @@ -52,7 +52,7 @@ GenerateGUIDFunction::create(mozIStorageConnection *aDBConn) return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1( +NS_IMPL_ISUPPORTS1( GenerateGUIDFunction, mozIStorageFunction ) diff --git a/toolkit/components/downloads/SQLFunctions.h b/toolkit/components/downloads/SQLFunctions.h index 9de582d39f6..5264cc20e42 100644 --- a/toolkit/components/downloads/SQLFunctions.h +++ b/toolkit/components/downloads/SQLFunctions.h @@ -25,7 +25,7 @@ namespace downloads { class GenerateGUIDFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION /** diff --git a/toolkit/components/places/Database.cpp b/toolkit/components/places/Database.cpp index 19c8565e462..afdbdad53f4 100644 --- a/toolkit/components/places/Database.cpp +++ b/toolkit/components/places/Database.cpp @@ -215,7 +215,7 @@ class BlockingConnectionCloseCallback MOZ_FINAL : public mozIStorageCompletionCa bool mDone; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGECOMPLETIONCALLBACK BlockingConnectionCloseCallback(); void Spin(); @@ -249,7 +249,7 @@ void BlockingConnectionCloseCallback::Spin() { } } -NS_IMPL_THREADSAFE_ISUPPORTS1( +NS_IMPL_ISUPPORTS1( BlockingConnectionCloseCallback , mozIStorageCompletionCallback ) @@ -332,7 +332,7 @@ CreateRoot(nsCOMPtr& aDBConn, PLACES_FACTORY_SINGLETON_IMPLEMENTATION(Database, gDatabase) -NS_IMPL_THREADSAFE_ISUPPORTS2(Database +NS_IMPL_ISUPPORTS2(Database , nsIObserver , nsISupportsWeakReference ) diff --git a/toolkit/components/places/Database.h b/toolkit/components/places/Database.h index 84134289394..79cbcc89994 100644 --- a/toolkit/components/places/Database.h +++ b/toolkit/components/places/Database.h @@ -66,7 +66,7 @@ class Database MOZ_FINAL : public nsIObserver typedef mozilla::storage::StatementCache AsyncStatementCache; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER Database(); diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index e798b40cc3a..5f6bf7b114a 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -378,7 +378,7 @@ PlacesEvent::Notify() } } -NS_IMPL_THREADSAFE_ISUPPORTS1( +NS_IMPL_ISUPPORTS1( PlacesEvent , nsIRunnable ) diff --git a/toolkit/components/places/Helpers.h b/toolkit/components/places/Helpers.h index 65be98f6b89..893e5f9b10c 100644 --- a/toolkit/components/places/Helpers.h +++ b/toolkit/components/places/Helpers.h @@ -217,7 +217,7 @@ bool GetHiddenState(bool aIsRedirect, class PlacesEvent : public nsRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE PlacesEvent(const char* aTopic); diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 117e523ca0f..07744a875e0 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -2930,7 +2930,7 @@ History::Observe(nsISupports* aSubject, const char* aTopic, //////////////////////////////////////////////////////////////////////////////// //// nsISupports -NS_IMPL_THREADSAFE_ISUPPORTS4( +NS_IMPL_ISUPPORTS4( History , IHistory , nsIDownloadHistory diff --git a/toolkit/components/places/History.h b/toolkit/components/places/History.h index 5b96d1fe633..a776dae0e8a 100644 --- a/toolkit/components/places/History.h +++ b/toolkit/components/places/History.h @@ -40,7 +40,7 @@ class History : public IHistory , public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_IHISTORY NS_DECL_NSIDOWNLOADHISTORY NS_DECL_MOZIASYNCHISTORY diff --git a/toolkit/components/places/SQLFunctions.cpp b/toolkit/components/places/SQLFunctions.cpp index 71ab153df45..b19a1fa30f9 100644 --- a/toolkit/components/places/SQLFunctions.cpp +++ b/toolkit/components/places/SQLFunctions.cpp @@ -318,7 +318,7 @@ namespace places { }; } - NS_IMPL_THREADSAFE_ISUPPORTS1( + NS_IMPL_ISUPPORTS1( MatchAutoCompleteFunction, mozIStorageFunction ) @@ -434,7 +434,7 @@ namespace places { return NS_OK; } - NS_IMPL_THREADSAFE_ISUPPORTS1( + NS_IMPL_ISUPPORTS1( CalculateFrecencyFunction, mozIStorageFunction ) @@ -636,7 +636,7 @@ namespace places { return NS_OK; } - NS_IMPL_THREADSAFE_ISUPPORTS1( + NS_IMPL_ISUPPORTS1( GenerateGUIDFunction, mozIStorageFunction ) @@ -675,7 +675,7 @@ namespace places { return NS_OK; } - NS_IMPL_THREADSAFE_ISUPPORTS1( + NS_IMPL_ISUPPORTS1( GetUnreversedHostFunction, mozIStorageFunction ) @@ -729,7 +729,7 @@ namespace places { return NS_OK; } - NS_IMPL_THREADSAFE_ISUPPORTS1( + NS_IMPL_ISUPPORTS1( FixupURLFunction, mozIStorageFunction ) diff --git a/toolkit/components/places/SQLFunctions.h b/toolkit/components/places/SQLFunctions.h index 414928202ad..79f6218b1f2 100644 --- a/toolkit/components/places/SQLFunctions.h +++ b/toolkit/components/places/SQLFunctions.h @@ -59,7 +59,7 @@ namespace places { class MatchAutoCompleteFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION /** @@ -196,7 +196,7 @@ private: class CalculateFrecencyFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION /** @@ -217,7 +217,7 @@ public: class GenerateGUIDFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION /** @@ -240,7 +240,7 @@ public: class GetUnreversedHostFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION /** @@ -268,7 +268,7 @@ public: class FixupURLFunction MOZ_FINAL : public mozIStorageFunction { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_MOZISTORAGEFUNCTION /** diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp index bacb1553838..21c4f424176 100644 --- a/toolkit/components/places/nsNavHistory.cpp +++ b/toolkit/components/places/nsNavHistory.cpp @@ -159,8 +159,8 @@ static const char* kObservedPrefs[] = { , nullptr }; -NS_IMPL_THREADSAFE_ADDREF(nsNavHistory) -NS_IMPL_THREADSAFE_RELEASE(nsNavHistory) +NS_IMPL_ADDREF(nsNavHistory) +NS_IMPL_RELEASE(nsNavHistory) NS_IMPL_CLASSINFO(nsNavHistory, NULL, nsIClassInfo::SINGLETON, NS_NAVHISTORYSERVICE_CID) diff --git a/toolkit/components/places/nsNavHistory.h b/toolkit/components/places/nsNavHistory.h index d18c2322000..6c77e230321 100644 --- a/toolkit/components/places/nsNavHistory.h +++ b/toolkit/components/places/nsNavHistory.h @@ -76,7 +76,7 @@ class nsNavHistory MOZ_FINAL : public nsSupportsWeakReference public: nsNavHistory(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSINAVHISTORYSERVICE NS_DECL_NSIBROWSERHISTORY NS_DECL_NSIOBSERVER diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index e74f7ec420b..04278c5c14a 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -216,7 +216,7 @@ nsAppStartup::Init() // nsAppStartup->nsISupports // -NS_IMPL_THREADSAFE_ISUPPORTS5(nsAppStartup, +NS_IMPL_ISUPPORTS5(nsAppStartup, nsIAppStartup, nsIWindowCreator, nsIWindowCreator2, diff --git a/toolkit/components/startup/nsAppStartup.h b/toolkit/components/startup/nsAppStartup.h index 7f9910bd0f5..8a966dc1b17 100644 --- a/toolkit/components/startup/nsAppStartup.h +++ b/toolkit/components/startup/nsAppStartup.h @@ -35,7 +35,7 @@ class nsAppStartup MOZ_FINAL : public nsIAppStartup, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIAPPSTARTUP NS_DECL_NSIWINDOWCREATOR NS_DECL_NSIWINDOWCREATOR2 diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 1e53e3ffbac..72e16e5035f 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -234,7 +234,7 @@ HangReports::GetDuration(unsigned aIndex) const { class TelemetryImpl MOZ_FINAL : public nsITelemetry { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITELEMETRY public: @@ -2061,7 +2061,7 @@ TelemetryImpl::RecordChromeHang(uint32_t duration, } #endif -NS_IMPL_THREADSAFE_ISUPPORTS1(TelemetryImpl, nsITelemetry) +NS_IMPL_ISUPPORTS1(TelemetryImpl, nsITelemetry) NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelemetry, TelemetryImpl::CreateTelemetryInstance) #define NS_TELEMETRY_CID \ diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 0329c78e0f9..c52fea85f32 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -111,7 +111,7 @@ class nsUrlClassifierDBServiceWorker MOZ_FINAL : public: nsUrlClassifierDBServiceWorker(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERDBSERVICE NS_DECL_NSIURLCLASSIFIERDBSERVICEWORKER @@ -196,7 +196,7 @@ private: nsTArray mPendingLookups; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsUrlClassifierDBServiceWorker, +NS_IMPL_ISUPPORTS2(nsUrlClassifierDBServiceWorker, nsIUrlClassifierDBServiceWorker, nsIUrlClassifierDBService) @@ -788,7 +788,7 @@ class nsUrlClassifierLookupCallback MOZ_FINAL : public nsIUrlClassifierLookupCal , public nsIUrlClassifierHashCompleterCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERLOOKUPCALLBACK NS_DECL_NSIURLCLASSIFIERHASHCOMPLETERCALLBACK @@ -815,7 +815,7 @@ private: nsCOMPtr mCallback; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsUrlClassifierLookupCallback, +NS_IMPL_ISUPPORTS2(nsUrlClassifierLookupCallback, nsIUrlClassifierLookupCallback, nsIUrlClassifierHashCompleterCallback) @@ -1005,7 +1005,7 @@ nsUrlClassifierLookupCallback::HandleResults() class nsUrlClassifierClassifyCallback MOZ_FINAL : public nsIUrlClassifierCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERCALLBACK nsUrlClassifierClassifyCallback(nsIURIClassifierCallback *c, @@ -1022,7 +1022,7 @@ private: bool mCheckPhishing; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUrlClassifierClassifyCallback, +NS_IMPL_ISUPPORTS1(nsUrlClassifierClassifyCallback, nsIUrlClassifierCallback) NS_IMETHODIMP @@ -1059,7 +1059,7 @@ nsUrlClassifierClassifyCallback::HandleEvent(const nsACString& tables) // ------------------------------------------------------------------------- // Proxy class implementation -NS_IMPL_THREADSAFE_ISUPPORTS3(nsUrlClassifierDBService, +NS_IMPL_ISUPPORTS3(nsUrlClassifierDBService, nsIUrlClassifierDBService, nsIURIClassifier, nsIObserver) diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.h b/toolkit/components/url-classifier/nsUrlClassifierDBService.h index 7517e8c6f06..bd4be97bdeb 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.h +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.h @@ -51,7 +51,7 @@ public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_URLCLASSIFIERDBSERVICE_CID) - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERDBSERVICE NS_DECL_NSIURICLASSIFIER NS_DECL_NSIOBSERVER diff --git a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp index 624905028ac..97f51374153 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp @@ -40,7 +40,7 @@ public: nsPrefixSetReporter(nsUrlClassifierPrefixSet* aParent, const nsACString& aName); virtual ~nsPrefixSetReporter() {} - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIMEMORYREPORTER private: @@ -48,7 +48,7 @@ private: nsUrlClassifierPrefixSet* mParent; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsPrefixSetReporter, nsIMemoryReporter) +NS_IMPL_ISUPPORTS1(nsPrefixSetReporter, nsIMemoryReporter) NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(StoragePrefixSetMallocSizeOf) diff --git a/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp b/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp index 89bde0cd9c0..3b349724338 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.cpp @@ -18,7 +18,7 @@ DispatchToWorkerThread(nsIRunnable* r) return t->Dispatch(r, NS_DISPATCH_NORMAL); } -NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierDBServiceWorkerProxy, +NS_IMPL_ISUPPORTS1(UrlClassifierDBServiceWorkerProxy, nsIUrlClassifierDBServiceWorker) NS_IMETHODIMP @@ -181,7 +181,7 @@ UrlClassifierDBServiceWorkerProxy::CacheMissesRunnable::Run() } -NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierLookupCallbackProxy, +NS_IMPL_ISUPPORTS1(UrlClassifierLookupCallbackProxy, nsIUrlClassifierLookupCallback) NS_IMETHODIMP @@ -199,7 +199,7 @@ UrlClassifierLookupCallbackProxy::LookupCompleteRunnable::Run() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierCallbackProxy, +NS_IMPL_ISUPPORTS1(UrlClassifierCallbackProxy, nsIUrlClassifierCallback) NS_IMETHODIMP @@ -216,7 +216,7 @@ UrlClassifierCallbackProxy::HandleEventRunnable::Run() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS1(UrlClassifierUpdateObserverProxy, +NS_IMPL_ISUPPORTS1(UrlClassifierUpdateObserverProxy, nsIUrlClassifierUpdateObserver) NS_IMETHODIMP diff --git a/toolkit/components/url-classifier/nsUrlClassifierProxies.h b/toolkit/components/url-classifier/nsUrlClassifierProxies.h index edcaca5d025..72727e08b89 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierProxies.h +++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.h @@ -25,7 +25,7 @@ public: : mTarget(aTarget) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERDBSERVICE NS_DECL_NSIURLCLASSIFIERDBSERVICEWORKER @@ -165,7 +165,7 @@ public: : mTarget(new nsMainThreadPtrHolder(aTarget)) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERLOOKUPCALLBACK class LookupCompleteRunnable : public nsRunnable @@ -195,7 +195,7 @@ public: : mTarget(new nsMainThreadPtrHolder(aTarget)) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERCALLBACK class HandleEventRunnable : public nsRunnable @@ -226,7 +226,7 @@ public: : mTarget(new nsMainThreadPtrHolder(aTarget)) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERUPDATEOBSERVER class UpdateUrlRequestedRunnable : public nsRunnable diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp index f9ea89ada43..9711caa236f 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp @@ -42,7 +42,7 @@ nsUrlClassifierStreamUpdater::nsUrlClassifierStreamUpdater() } -NS_IMPL_THREADSAFE_ISUPPORTS7(nsUrlClassifierStreamUpdater, +NS_IMPL_ISUPPORTS7(nsUrlClassifierStreamUpdater, nsIUrlClassifierStreamUpdater, nsIUrlClassifierUpdateObserver, nsIRequestObserver, diff --git a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h index 4c23d8aa7f3..18e1c188ff5 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h +++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.h @@ -30,7 +30,7 @@ class nsUrlClassifierStreamUpdater MOZ_FINAL : public nsIUrlClassifierStreamUpda public: nsUrlClassifierStreamUpdater(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURLCLASSIFIERSTREAMUPDATER NS_DECL_NSIURLCLASSIFIERUPDATEOBSERVER NS_DECL_NSIINTERFACEREQUESTOR diff --git a/toolkit/identity/IdentityCryptoService.cpp b/toolkit/identity/IdentityCryptoService.cpp index 08eea80fef5..00ae51f3cfb 100644 --- a/toolkit/identity/IdentityCryptoService.cpp +++ b/toolkit/identity/IdentityCryptoService.cpp @@ -93,7 +93,7 @@ Base64UrlDecodeImpl(const nsACString & base64Input, nsACString & result) class KeyPair : public nsIIdentityKeyPair, public nsNSSShutDownObject { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIIDENTITYKEYPAIR KeyPair(SECKEYPrivateKey* aPrivateKey, SECKEYPublicKey* aPublicKey); @@ -129,7 +129,7 @@ private: void operator=(const KeyPair &) MOZ_DELETE; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(KeyPair, nsIIdentityKeyPair) +NS_IMPL_ISUPPORTS1(KeyPair, nsIIdentityKeyPair) class KeyGenRunnable : public nsRunnable, public nsNSSShutDownObject { @@ -212,7 +212,7 @@ private: class IdentityCryptoService MOZ_FINAL : public nsIIdentityCryptoService { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIIDENTITYCRYPTOSERVICE IdentityCryptoService() { } @@ -231,7 +231,7 @@ private: void operator=(const IdentityCryptoService &) MOZ_DELETE; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(IdentityCryptoService, nsIIdentityCryptoService) +NS_IMPL_ISUPPORTS1(IdentityCryptoService, nsIIdentityCryptoService) NS_IMETHODIMP IdentityCryptoService::GenerateKeyPair( diff --git a/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp b/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp index d97bac4c4b8..20cf901f9d0 100644 --- a/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp +++ b/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp @@ -20,7 +20,7 @@ class nsAndroidSystemProxySettings : public nsISystemProxySettings { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISYSTEMPROXYSETTINGS nsAndroidSystemProxySettings() {}; @@ -30,7 +30,7 @@ private: ~nsAndroidSystemProxySettings() {}; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsAndroidSystemProxySettings, nsISystemProxySettings) +NS_IMPL_ISUPPORTS1(nsAndroidSystemProxySettings, nsISystemProxySettings) NS_IMETHODIMP nsAndroidSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) diff --git a/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm b/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm index 75f6e3efc2a..7ac114190a4 100644 --- a/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm +++ b/toolkit/system/osxproxy/nsOSXSystemProxySettings.mm @@ -19,7 +19,7 @@ class nsOSXSystemProxySettings MOZ_FINAL : public nsISystemProxySettings { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISYSTEMPROXYSETTINGS nsOSXSystemProxySettings(); @@ -58,7 +58,7 @@ private: static const SchemeMapping gSchemeMappingList[]; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsOSXSystemProxySettings, nsISystemProxySettings) +NS_IMPL_ISUPPORTS1(nsOSXSystemProxySettings, nsISystemProxySettings) NS_IMETHODIMP nsOSXSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) diff --git a/toolkit/system/unixproxy/nsLibProxySettings.cpp b/toolkit/system/unixproxy/nsLibProxySettings.cpp index 76137b818fb..75c21076045 100644 --- a/toolkit/system/unixproxy/nsLibProxySettings.cpp +++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp @@ -18,7 +18,7 @@ extern "C" { class nsUnixSystemProxySettings : public nsISystemProxySettings { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISYSTEMPROXYSETTINGS nsUnixSystemProxySettings() { mProxyFactory = nullptr; } @@ -33,7 +33,7 @@ private: pxProxyFactory *mProxyFactory; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) +NS_IMPL_ISUPPORTS1(nsUnixSystemProxySettings, nsISystemProxySettings) NS_IMETHODIMP nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) diff --git a/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp b/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp index 8c6bffbe283..39b889abbc6 100644 --- a/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp +++ b/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp @@ -20,7 +20,7 @@ class nsWindowsSystemProxySettings MOZ_FINAL : public nsISystemProxySettings { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISYSTEMPROXYSETTINGS nsWindowsSystemProxySettings() {}; @@ -33,7 +33,7 @@ private: bool PatternMatch(const nsACString& aHost, const nsACString& aOverride); }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsWindowsSystemProxySettings, nsISystemProxySettings) +NS_IMPL_ISUPPORTS1(nsWindowsSystemProxySettings, nsISystemProxySettings) NS_IMETHODIMP nsWindowsSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 5223e8cc884..20935c07c24 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -1019,7 +1019,7 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir, -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUpdateProcessor, nsIUpdateProcessor) +NS_IMPL_ISUPPORTS1(nsUpdateProcessor, nsIUpdateProcessor) nsUpdateProcessor::nsUpdateProcessor() : mUpdaterPID(0) diff --git a/toolkit/xre/nsUpdateDriver.h b/toolkit/xre/nsUpdateDriver.h index ee34b630b81..a79f2fc5f0e 100644 --- a/toolkit/xre/nsUpdateDriver.h +++ b/toolkit/xre/nsUpdateDriver.h @@ -67,7 +67,7 @@ class nsUpdateProcessor MOZ_FINAL : public nsIUpdateProcessor public: nsUpdateProcessor(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIUPDATEPROCESSOR private: From 97cdff02d65bb3490c7aa3bf25987e6a0d40b632 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:15 -0500 Subject: [PATCH 45/69] Bug 884061 - Part 3w: Use NS_DECL_THREADSAFE_ISUPPORTS in uriloader/, r=bz --HG-- extra : rebase_source : cad6dd305dc36ca1b4fab141625b1c466980d5f4 --- uriloader/base/nsURILoader.cpp | 6 +++--- uriloader/exthandler/mac/nsDecodeAppleFile.cpp | 4 ++-- uriloader/exthandler/mac/nsDecodeAppleFile.h | 2 +- uriloader/exthandler/nsExternalHelperAppService.cpp | 4 ++-- uriloader/exthandler/nsExternalHelperAppService.h | 2 +- uriloader/exthandler/nsExternalProtocolHandler.cpp | 10 +++++----- uriloader/exthandler/nsExternalProtocolHandler.h | 2 +- uriloader/exthandler/nsMIMEInfoImpl.cpp | 4 ++-- uriloader/exthandler/nsMIMEInfoImpl.h | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index 40156547aba..db211c02cea 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -77,7 +77,7 @@ public: uint32_t aFlags, nsURILoader* aURILoader); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS /** * Prepares this object for receiving data. The stream @@ -157,8 +157,8 @@ protected: nsRefPtr mURILoader; }; -NS_IMPL_THREADSAFE_ADDREF(nsDocumentOpenInfo) -NS_IMPL_THREADSAFE_RELEASE(nsDocumentOpenInfo) +NS_IMPL_ADDREF(nsDocumentOpenInfo) +NS_IMPL_RELEASE(nsDocumentOpenInfo) NS_INTERFACE_MAP_BEGIN(nsDocumentOpenInfo) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRequestObserver) diff --git a/uriloader/exthandler/mac/nsDecodeAppleFile.cpp b/uriloader/exthandler/mac/nsDecodeAppleFile.cpp index 9f95f3d0bfd..1a428a62db3 100644 --- a/uriloader/exthandler/mac/nsDecodeAppleFile.cpp +++ b/uriloader/exthandler/mac/nsDecodeAppleFile.cpp @@ -8,8 +8,8 @@ #include "nsCRT.h" -NS_IMPL_THREADSAFE_ADDREF(nsDecodeAppleFile) -NS_IMPL_THREADSAFE_RELEASE(nsDecodeAppleFile) +NS_IMPL_ADDREF(nsDecodeAppleFile) +NS_IMPL_RELEASE(nsDecodeAppleFile) NS_INTERFACE_MAP_BEGIN(nsDecodeAppleFile) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIOutputStream) diff --git a/uriloader/exthandler/mac/nsDecodeAppleFile.h b/uriloader/exthandler/mac/nsDecodeAppleFile.h index 4761abced55..d59716d8613 100644 --- a/uriloader/exthandler/mac/nsDecodeAppleFile.h +++ b/uriloader/exthandler/mac/nsDecodeAppleFile.h @@ -77,7 +77,7 @@ enum { class nsDecodeAppleFile : public nsIOutputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOUTPUTSTREAM nsDecodeAppleFile(); diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index fe41a8dd696..3fc65452746 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -1084,8 +1084,8 @@ nsExternalHelperAppService::Observe(nsISupports *aSubject, const char *aTopic, c // begin external app handler implementation ////////////////////////////////////////////////////////////////////////////////////////////////////// -NS_IMPL_THREADSAFE_ADDREF(nsExternalAppHandler) -NS_IMPL_THREADSAFE_RELEASE(nsExternalAppHandler) +NS_IMPL_ADDREF(nsExternalAppHandler) +NS_IMPL_RELEASE(nsExternalAppHandler) NS_INTERFACE_MAP_BEGIN(nsExternalAppHandler) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStreamListener) diff --git a/uriloader/exthandler/nsExternalHelperAppService.h b/uriloader/exthandler/nsExternalHelperAppService.h index 3bb1ae8eb39..0793655df02 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.h +++ b/uriloader/exthandler/nsExternalHelperAppService.h @@ -208,7 +208,7 @@ class nsExternalAppHandler MOZ_FINAL : public nsIStreamListener, public nsIBackgroundFileSaverObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTREAMLISTENER NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSIHELPERAPPLAUNCHER diff --git a/uriloader/exthandler/nsExternalProtocolHandler.cpp b/uriloader/exthandler/nsExternalProtocolHandler.cpp index ff03b3aaeee..a1818f98bd6 100644 --- a/uriloader/exthandler/nsExternalProtocolHandler.cpp +++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp @@ -33,7 +33,7 @@ class nsExtProtocolChannel : public nsIChannel { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICHANNEL NS_DECL_NSIREQUEST @@ -56,8 +56,8 @@ private: nsCOMPtr mLoadGroup; }; -NS_IMPL_THREADSAFE_ADDREF(nsExtProtocolChannel) -NS_IMPL_THREADSAFE_RELEASE(nsExtProtocolChannel) +NS_IMPL_ADDREF(nsExtProtocolChannel) +NS_IMPL_RELEASE(nsExtProtocolChannel) NS_INTERFACE_MAP_BEGIN(nsExtProtocolChannel) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIChannel) @@ -315,8 +315,8 @@ nsExternalProtocolHandler::nsExternalProtocolHandler() nsExternalProtocolHandler::~nsExternalProtocolHandler() {} -NS_IMPL_THREADSAFE_ADDREF(nsExternalProtocolHandler) -NS_IMPL_THREADSAFE_RELEASE(nsExternalProtocolHandler) +NS_IMPL_ADDREF(nsExternalProtocolHandler) +NS_IMPL_RELEASE(nsExternalProtocolHandler) NS_INTERFACE_MAP_BEGIN(nsExternalProtocolHandler) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIProtocolHandler) diff --git a/uriloader/exthandler/nsExternalProtocolHandler.h b/uriloader/exthandler/nsExternalProtocolHandler.h index 353bece7a00..805d0a4ded9 100644 --- a/uriloader/exthandler/nsExternalProtocolHandler.h +++ b/uriloader/exthandler/nsExternalProtocolHandler.h @@ -20,7 +20,7 @@ class nsIURI; class nsExternalProtocolHandler MOZ_FINAL : public nsIExternalProtocolHandler, public nsSupportsWeakReference { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROTOCOLHANDLER NS_DECL_NSIEXTERNALPROTOCOLHANDLER diff --git a/uriloader/exthandler/nsMIMEInfoImpl.cpp b/uriloader/exthandler/nsMIMEInfoImpl.cpp index 21ac228397b..451f4f0ca7c 100644 --- a/uriloader/exthandler/nsMIMEInfoImpl.cpp +++ b/uriloader/exthandler/nsMIMEInfoImpl.cpp @@ -16,8 +16,8 @@ #include "nsCURILoader.h" // nsISupports methods -NS_IMPL_THREADSAFE_ADDREF(nsMIMEInfoBase) -NS_IMPL_THREADSAFE_RELEASE(nsMIMEInfoBase) +NS_IMPL_ADDREF(nsMIMEInfoBase) +NS_IMPL_RELEASE(nsMIMEInfoBase) NS_INTERFACE_MAP_BEGIN(nsMIMEInfoBase) NS_INTERFACE_MAP_ENTRY(nsIHandlerInfo) diff --git a/uriloader/exthandler/nsMIMEInfoImpl.h b/uriloader/exthandler/nsMIMEInfoImpl.h index 0a8e152b76d..af4c1fca9cd 100644 --- a/uriloader/exthandler/nsMIMEInfoImpl.h +++ b/uriloader/exthandler/nsMIMEInfoImpl.h @@ -34,7 +34,7 @@ */ class nsMIMEInfoBase : public nsIMIMEInfo { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // I'd use NS_DECL_NSIMIMEINFO, but I don't want GetHasDefaultHandler NS_IMETHOD GetFileExtensions(nsIUTF8StringEnumerator **_retval); From 4c0a3ad9a6a8a5945a14e3d10c00f3fbdeafb72d Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:24:15 -0500 Subject: [PATCH 46/69] Bug 884061 - Part 3x: Use NS_DECL_THREADSAFE_ISUPPORTS in widget/, r=jimm --HG-- extra : rebase_source : 9e6f7d33802b3f8698616fa6f68c8500f275ae9c --- widget/android/AndroidBridge.cpp | 2 +- widget/android/AndroidBridge.h | 2 +- widget/gonk/GonkMemoryPressureMonitoring.cpp | 4 ++-- widget/windows/AudioSession.cpp | 6 +++--- widget/windows/LSPAnnotator.cpp | 4 ++-- widget/windows/WinTaskbar.cpp | 2 +- widget/windows/WinTaskbar.h | 2 +- widget/windows/WinUtils.cpp | 6 +++--- widget/windows/WinUtils.h | 6 +++--- widget/xpwidgets/GfxInfoBase.cpp | 2 +- widget/xpwidgets/GfxInfoBase.h | 2 +- widget/xpwidgets/nsBaseAppShell.cpp | 3 +-- widget/xpwidgets/nsBaseAppShell.h | 2 +- 13 files changed, 21 insertions(+), 22 deletions(-) diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index 5c234a379c9..2daa520f6f3 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -44,7 +44,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS0(nsFilePickerCallback) +NS_IMPL_ISUPPORTS0(nsFilePickerCallback) nsRefPtr AndroidBridge::sBridge = nullptr; static unsigned sJavaEnvThreadIndex = 0; diff --git a/widget/android/AndroidBridge.h b/widget/android/AndroidBridge.h index aafee41d81e..b200cd04d63 100644 --- a/widget/android/AndroidBridge.h +++ b/widget/android/AndroidBridge.h @@ -87,7 +87,7 @@ typedef struct AndroidSystemColors { class nsFilePickerCallback : nsISupports { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS virtual void handleResult(nsAString& filePath) = 0; nsFilePickerCallback() {} protected: diff --git a/widget/gonk/GonkMemoryPressureMonitoring.cpp b/widget/gonk/GonkMemoryPressureMonitoring.cpp index 4119033c9f1..af066802d8f 100644 --- a/widget/gonk/GonkMemoryPressureMonitoring.cpp +++ b/widget/gonk/GonkMemoryPressureMonitoring.cpp @@ -65,7 +65,7 @@ public: { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsresult Init() { @@ -240,7 +240,7 @@ private: ScopedClose mShutdownPipeWrite; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(MemoryPressureWatcher, nsIRunnable, nsIObserver); +NS_IMPL_ISUPPORTS2(MemoryPressureWatcher, nsIRunnable, nsIObserver); } // anonymous namespace diff --git a/widget/windows/AudioSession.cpp b/widget/windows/AudioSession.cpp index 8f7a5ae7978..049f425af10 100644 --- a/widget/windows/AudioSession.cpp +++ b/widget/windows/AudioSession.cpp @@ -87,7 +87,7 @@ protected: nsID mSessionGroupingParameter; SessionState mState; - nsAutoRefCnt mRefCnt; + ThreadSafeAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD static AudioSession* sService; @@ -151,8 +151,8 @@ AudioSession::GetSingleton() } // It appears Windows will use us on a background thread ... -NS_IMPL_THREADSAFE_ADDREF(AudioSession) -NS_IMPL_THREADSAFE_RELEASE(AudioSession) +NS_IMPL_ADDREF(AudioSession) +NS_IMPL_RELEASE(AudioSession) STDMETHODIMP AudioSession::QueryInterface(REFIID iid, void **ppv) diff --git a/widget/windows/LSPAnnotator.cpp b/widget/windows/LSPAnnotator.cpp index e6b300e8723..0233bfc7da5 100644 --- a/widget/windows/LSPAnnotator.cpp +++ b/widget/windows/LSPAnnotator.cpp @@ -24,7 +24,7 @@ namespace crashreporter { class LSPAnnotationGatherer : public nsRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE void Annotate(); @@ -32,7 +32,7 @@ public: nsCOMPtr mThread; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(LSPAnnotationGatherer, nsIRunnable) +NS_IMPL_ISUPPORTS1(LSPAnnotationGatherer, nsIRunnable) void LSPAnnotationGatherer::Annotate() diff --git a/widget/windows/WinTaskbar.cpp b/widget/windows/WinTaskbar.cpp index 21cd9d1757d..680355e5e1f 100644 --- a/widget/windows/WinTaskbar.cpp +++ b/widget/windows/WinTaskbar.cpp @@ -201,7 +201,7 @@ namespace widget { /////////////////////////////////////////////////////////////////////////////// // nsIWinTaskbar -NS_IMPL_THREADSAFE_ISUPPORTS1(WinTaskbar, nsIWinTaskbar) +NS_IMPL_ISUPPORTS1(WinTaskbar, nsIWinTaskbar) bool WinTaskbar::Initialize() { diff --git a/widget/windows/WinTaskbar.h b/widget/windows/WinTaskbar.h index 9c67e69c4a2..c0925247f54 100644 --- a/widget/windows/WinTaskbar.h +++ b/widget/windows/WinTaskbar.h @@ -22,7 +22,7 @@ public: WinTaskbar(); ~WinTaskbar(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIWINTASKBAR // Registers the global app user model id for the instance. diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index e20de9be21d..d639b3e80b6 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -40,9 +40,9 @@ namespace widget { #ifdef MOZ_PLACES NS_IMPL_ISUPPORTS1(AsyncFaviconDataReady, nsIFaviconDataCallback) #endif - NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncEncodeAndWriteIcon, nsIRunnable) - NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncDeleteIconFromDisk, nsIRunnable) - NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncDeleteAllFaviconsFromDisk, nsIRunnable) + NS_IMPL_ISUPPORTS1(AsyncEncodeAndWriteIcon, nsIRunnable) + NS_IMPL_ISUPPORTS1(AsyncDeleteIconFromDisk, nsIRunnable) + NS_IMPL_ISUPPORTS1(AsyncDeleteAllFaviconsFromDisk, nsIRunnable) const char FaviconHelper::kJumpListCacheDir[] = "jumpListCache"; diff --git a/widget/windows/WinUtils.h b/widget/windows/WinUtils.h index 5817232fc25..3550cbef5e3 100644 --- a/widget/windows/WinUtils.h +++ b/widget/windows/WinUtils.h @@ -296,7 +296,7 @@ class AsyncEncodeAndWriteIcon : public nsIRunnable { public: const bool mURLShortcut; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE // Warning: AsyncEncodeAndWriteIcon assumes ownership of the aData buffer passed in @@ -320,7 +320,7 @@ private: class AsyncDeleteIconFromDisk : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE AsyncDeleteIconFromDisk(const nsAString &aIconPath); @@ -333,7 +333,7 @@ private: class AsyncDeleteAllFaviconsFromDisk : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE AsyncDeleteAllFaviconsFromDisk(); diff --git a/widget/xpwidgets/GfxInfoBase.cpp b/widget/xpwidgets/GfxInfoBase.cpp index 11090cd6baf..dd1227cd79b 100644 --- a/widget/xpwidgets/GfxInfoBase.cpp +++ b/widget/xpwidgets/GfxInfoBase.cpp @@ -87,7 +87,7 @@ void InitGfxDriverInfoShutdownObserver() using namespace mozilla::widget; using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS3(GfxInfoBase, nsIGfxInfo, nsIObserver, nsISupportsWeakReference) +NS_IMPL_ISUPPORTS3(GfxInfoBase, nsIGfxInfo, nsIObserver, nsISupportsWeakReference) #define BLACKLIST_PREF_BRANCH "gfx.blacklist." #define SUGGESTED_VERSION_PREF BLACKLIST_PREF_BRANCH "suggested-driver-version" diff --git a/widget/xpwidgets/GfxInfoBase.h b/widget/xpwidgets/GfxInfoBase.h index bb86f74cadb..28704a5ff21 100644 --- a/widget/xpwidgets/GfxInfoBase.h +++ b/widget/xpwidgets/GfxInfoBase.h @@ -33,7 +33,7 @@ public: GfxInfoBase(); virtual ~GfxInfoBase(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVER // We only declare a subset of the nsIGfxInfo interface. It's up to derived diff --git a/widget/xpwidgets/nsBaseAppShell.cpp b/widget/xpwidgets/nsBaseAppShell.cpp index e25dc96eeba..488720e88b5 100644 --- a/widget/xpwidgets/nsBaseAppShell.cpp +++ b/widget/xpwidgets/nsBaseAppShell.cpp @@ -16,8 +16,7 @@ // next thread event for at most this many ticks: #define THREAD_EVENT_STARVATION_LIMIT PR_MillisecondsToInterval(20) -NS_IMPL_THREADSAFE_ISUPPORTS3(nsBaseAppShell, nsIAppShell, nsIThreadObserver, - nsIObserver) +NS_IMPL_ISUPPORTS3(nsBaseAppShell, nsIAppShell, nsIThreadObserver, nsIObserver) nsBaseAppShell::nsBaseAppShell() : mSuspendNativeCount(0) diff --git a/widget/xpwidgets/nsBaseAppShell.h b/widget/xpwidgets/nsBaseAppShell.h index 2f758478e62..fab8ab58169 100644 --- a/widget/xpwidgets/nsBaseAppShell.h +++ b/widget/xpwidgets/nsBaseAppShell.h @@ -22,7 +22,7 @@ class nsBaseAppShell : public nsIAppShell, public nsIThreadObserver, public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIAPPSHELL NS_DECL_NSITHREADOBSERVER NS_DECL_NSIOBSERVER From 03b669f70927b0eced99e52d1764047a2d6d707b Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:31:26 -0500 Subject: [PATCH 47/69] Bug 884061 - Part 3y: Use NS_DECL_THREADSAFE_ISUPPORTS in xpcom/, r=bsmedberg --HG-- extra : rebase_source : d54f6973e3ff859207115013e8361781769ffc76 --- xpcom/base/MapsMemoryReporter.cpp | 4 ++-- xpcom/base/nsConsoleMessage.cpp | 2 +- xpcom/base/nsConsoleMessage.h | 2 +- xpcom/base/nsConsoleService.cpp | 4 ++-- xpcom/base/nsConsoleService.h | 2 +- xpcom/base/nsExceptionService.cpp | 12 +++++----- xpcom/base/nsExceptionService.h | 2 +- xpcom/base/nsIMemoryReporter.idl | 10 ++++----- xpcom/base/nsInterfaceRequestorAgg.cpp | 6 ++--- xpcom/base/nsMemoryInfoDumper.cpp | 4 ++-- xpcom/base/nsMemoryReporterManager.cpp | 4 ++-- xpcom/base/nsMemoryReporterManager.h | 2 +- xpcom/base/nsUUIDGenerator.cpp | 2 +- xpcom/base/nsUUIDGenerator.h | 2 +- xpcom/components/ModuleUtils.h | 2 +- xpcom/components/nsComponentManager.cpp | 12 +++++----- xpcom/components/nsComponentManager.h | 2 +- xpcom/ds/nsAtomService.cpp | 2 +- xpcom/ds/nsAtomService.h | 2 +- xpcom/ds/nsHashPropertyBag.cpp | 4 ++-- xpcom/ds/nsHashPropertyBag.h | 2 +- xpcom/ds/nsObserverService.cpp | 2 +- xpcom/ds/nsObserverService.h | 2 +- xpcom/ds/nsPersistentProperties.cpp | 2 +- xpcom/ds/nsPersistentProperties.h | 2 +- xpcom/ds/nsSupportsArray.cpp | 2 +- xpcom/ds/nsSupportsArray.h | 2 +- xpcom/ds/nsSupportsPrimitives.cpp | 14 ++++++------ xpcom/ds/nsSupportsPrimitives.h | 6 ++--- xpcom/glue/GenericFactory.cpp | 2 +- xpcom/glue/GenericFactory.h | 2 +- xpcom/glue/GenericModule.cpp | 2 +- xpcom/glue/nsProxyRelease.h | 11 +--------- xpcom/glue/nsThreadUtils.cpp | 8 +++---- xpcom/glue/nsThreadUtils.h | 4 ++-- xpcom/io/nsAppFileLocationProvider.cpp | 2 +- xpcom/io/nsAppFileLocationProvider.h | 2 +- xpcom/io/nsDirectoryService.cpp | 2 +- xpcom/io/nsDirectoryService.h | 2 +- xpcom/io/nsIOUtil.cpp | 2 +- xpcom/io/nsIOUtil.h | 2 +- xpcom/io/nsInputStreamTee.cpp | 8 +++---- xpcom/io/nsLocalFileOS2.cpp | 10 ++++----- xpcom/io/nsLocalFileOS2.h | 2 +- xpcom/io/nsLocalFileUnix.cpp | 18 +++++++-------- xpcom/io/nsLocalFileUnix.h | 2 +- xpcom/io/nsLocalFileWin.cpp | 10 ++++----- xpcom/io/nsLocalFileWin.h | 2 +- xpcom/io/nsMultiplexInputStream.cpp | 6 ++--- xpcom/io/nsPipe3.cpp | 16 +++++++------- xpcom/io/nsStorageStream.cpp | 14 ++++++------ xpcom/io/nsStorageStream.h | 2 +- xpcom/io/nsStreamUtils.cpp | 22 +++++++++---------- xpcom/io/nsStringStream.cpp | 6 ++--- .../xptinfo/public/XPTInterfaceInfoManager.h | 2 +- .../reflect/xptinfo/src/xptiInterfaceInfo.cpp | 4 ++-- .../xptinfo/src/xptiInterfaceInfoManager.cpp | 4 ++-- xpcom/reflect/xptinfo/src/xptiprivate.h | 2 +- xpcom/tests/TestPipes.cpp | 13 +++++------ xpcom/tests/TestRacingServiceManager.cpp | 16 +++++++------- xpcom/tests/TestThreadPool.cpp | 4 ++-- xpcom/tests/TestThreadPoolListener.cpp | 4 ++-- xpcom/tests/TestThreads.cpp | 8 +++---- xpcom/tests/TestTimers.cpp | 4 ++-- xpcom/threads/LazyIdleThread.cpp | 14 ++++++------ xpcom/threads/LazyIdleThread.h | 2 +- xpcom/threads/TimerThread.cpp | 2 +- xpcom/threads/TimerThread.h | 2 +- xpcom/threads/nsEnvironment.cpp | 2 +- xpcom/threads/nsEnvironment.h | 2 +- xpcom/threads/nsProcess.h | 2 +- xpcom/threads/nsProcessCommon.cpp | 4 ++-- xpcom/threads/nsThread.cpp | 4 ++-- xpcom/threads/nsThread.h | 2 +- xpcom/threads/nsThreadPool.cpp | 4 ++-- xpcom/threads/nsThreadPool.h | 2 +- xpcom/threads/nsTimerImpl.cpp | 6 ++--- xpcom/threads/nsTimerImpl.h | 2 +- 78 files changed, 188 insertions(+), 198 deletions(-) diff --git a/xpcom/base/MapsMemoryReporter.cpp b/xpcom/base/MapsMemoryReporter.cpp index e95ddf112e4..a76732ed6bf 100644 --- a/xpcom/base/MapsMemoryReporter.cpp +++ b/xpcom/base/MapsMemoryReporter.cpp @@ -116,7 +116,7 @@ class MapsReporter MOZ_FINAL : public nsIMemoryMultiReporter public: MapsReporter(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD GetName(nsACString &aName) { @@ -158,7 +158,7 @@ private: nsTHashtable mMozillaLibraries; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(MapsReporter, nsIMemoryMultiReporter) +NS_IMPL_ISUPPORTS1(MapsReporter, nsIMemoryMultiReporter) MapsReporter::MapsReporter() : mSearchedForLibxul(false) diff --git a/xpcom/base/nsConsoleMessage.cpp b/xpcom/base/nsConsoleMessage.cpp index df0c2b3de70..1af435eb4ea 100644 --- a/xpcom/base/nsConsoleMessage.cpp +++ b/xpcom/base/nsConsoleMessage.cpp @@ -11,7 +11,7 @@ #include "nsReadableUtils.h" #include "jsapi.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsConsoleMessage, nsIConsoleMessage) +NS_IMPL_ISUPPORTS1(nsConsoleMessage, nsIConsoleMessage) nsConsoleMessage::nsConsoleMessage() : mTimeStamp(0), diff --git a/xpcom/base/nsConsoleMessage.h b/xpcom/base/nsConsoleMessage.h index 95fbd3864de..706f7fd7b5d 100644 --- a/xpcom/base/nsConsoleMessage.h +++ b/xpcom/base/nsConsoleMessage.h @@ -16,7 +16,7 @@ public: nsConsoleMessage(); nsConsoleMessage(const PRUnichar *message); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICONSOLEMESSAGE private: diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index f6438a90ae9..b072c124789 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -31,8 +31,8 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ADDREF(nsConsoleService) -NS_IMPL_THREADSAFE_RELEASE(nsConsoleService) +NS_IMPL_ADDREF(nsConsoleService) +NS_IMPL_RELEASE(nsConsoleService) NS_IMPL_CLASSINFO(nsConsoleService, NULL, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID) NS_IMPL_QUERY_INTERFACE1_CI(nsConsoleService, nsIConsoleService) NS_IMPL_CI_INTERFACE_GETTER1(nsConsoleService, nsIConsoleService) diff --git a/xpcom/base/nsConsoleService.h b/xpcom/base/nsConsoleService.h index e69d5a02299..4862bdc4101 100644 --- a/xpcom/base/nsConsoleService.h +++ b/xpcom/base/nsConsoleService.h @@ -25,7 +25,7 @@ public: nsConsoleService(); nsresult Init(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSICONSOLESERVICE void SetIsDelivering() { diff --git a/xpcom/base/nsExceptionService.cpp b/xpcom/base/nsExceptionService.cpp index d6654e29d0d..7c4cf4e2dd9 100644 --- a/xpcom/base/nsExceptionService.cpp +++ b/xpcom/base/nsExceptionService.cpp @@ -42,7 +42,7 @@ public: class nsExceptionManager MOZ_FINAL : public nsIExceptionManager { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEXCEPTIONMANAGER nsExceptionManager(nsExceptionService *svc); @@ -67,7 +67,7 @@ int32_t nsExceptionManager::totalInstances = 0; // one per thread. // An exception if the destructor, which may be called on // the thread shutting down xpcom -NS_IMPL_THREADSAFE_ISUPPORTS1(nsExceptionManager, nsIExceptionManager) +NS_IMPL_ISUPPORTS1(nsExceptionManager, nsIExceptionManager) nsExceptionManager::nsExceptionManager(nsExceptionService *svc) : mNextThread(nullptr), @@ -122,10 +122,10 @@ nsExceptionManager *nsExceptionService::firstThread = nullptr; int32_t nsExceptionService::totalInstances = 0; #endif -NS_IMPL_THREADSAFE_ISUPPORTS3(nsExceptionService, - nsIExceptionService, - nsIExceptionManager, - nsIObserver) +NS_IMPL_ISUPPORTS3(nsExceptionService, + nsIExceptionService, + nsIExceptionManager, + nsIObserver) nsExceptionService::nsExceptionService() : mProviders(4, true) /* small, thread-safe hashtable */ diff --git a/xpcom/base/nsExceptionService.h b/xpcom/base/nsExceptionService.h index 3e8c11ba485..ee86f9a4285 100644 --- a/xpcom/base/nsExceptionService.h +++ b/xpcom/base/nsExceptionService.h @@ -21,7 +21,7 @@ class nsExceptionManager; class nsExceptionService MOZ_FINAL : public nsIExceptionService, public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEXCEPTIONSERVICE NS_DECL_NSIEXCEPTIONMANAGER NS_DECL_NSIOBSERVER diff --git a/xpcom/base/nsIMemoryReporter.idl b/xpcom/base/nsIMemoryReporter.idl index 6e77741d0f1..b398bc4e3a4 100644 --- a/xpcom/base/nsIMemoryReporter.idl +++ b/xpcom/base/nsIMemoryReporter.idl @@ -310,7 +310,7 @@ interface nsIMemoryReporterManager : nsISupports #define NS_MEMORY_REPORTER_IMPLEMENT_HELPER(_classname, _path, _kind, _units, _amountFunction, _desc, _ts) \ class MemoryReporter_##_classname MOZ_FINAL : public nsIMemoryReporter { \ public: \ - NS_DECL_ISUPPORTS \ + NS_DECL##_ts##ISUPPORTS \ NS_IMETHOD GetProcess(nsACString &process) { process.Truncate(); return NS_OK; } \ NS_IMETHOD GetPath(nsACString &memoryPath) { memoryPath.AssignLiteral(_path); return NS_OK; } \ NS_IMETHOD GetKind(int *kind) { *kind = _kind; return NS_OK; } \ @@ -318,14 +318,14 @@ interface nsIMemoryReporterManager : nsISupports NS_IMETHOD GetAmount(int64_t *amount) { *amount = _amountFunction(); return NS_OK; } \ NS_IMETHOD GetDescription(nsACString &desc) { desc.AssignLiteral(_desc); return NS_OK; } \ }; \ - NS_IMPL##_ts##ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter) + NS_IMPL_ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter) // The only difference between this and NS_MEMORY_REPORTER_IMPLEMENT_HELPER // is that the function used to implement GetAmount is fallible. #define NS_FALLIBLE_MEMORY_REPORTER_IMPLEMENT_HELPER(_classname, _path, _kind, _units, _amountFunction, _desc, _ts) \ class MemoryReporter_##_classname MOZ_FINAL : public nsIMemoryReporter { \ public: \ - NS_DECL_ISUPPORTS \ + NS_DECL##_ts##ISUPPORTS \ NS_IMETHOD GetProcess(nsACString &process) { process.Truncate(); return NS_OK; } \ NS_IMETHOD GetPath(nsACString &memoryPath) { memoryPath.AssignLiteral(_path); return NS_OK; } \ NS_IMETHOD GetKind(int32_t *kind) { *kind = _kind; return NS_OK; } \ @@ -333,7 +333,7 @@ interface nsIMemoryReporterManager : nsISupports NS_IMETHOD GetAmount(int64_t *amount) { return _amountFunction(amount); } \ NS_IMETHOD GetDescription(nsACString &desc) { desc.AssignLiteral(_desc); return NS_OK; }\ }; \ - NS_IMPL##_ts##ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter) + NS_IMPL_ISUPPORTS1(MemoryReporter_##_classname, nsIMemoryReporter) #define NS_MEMORY_REPORTER_IMPLEMENT(_c, _p, _k, _u, _a, _d) \ NS_MEMORY_REPORTER_IMPLEMENT_HELPER(_c, _p, _k, _u, _a, _d, _) @@ -448,7 +448,7 @@ public: virtual ~MemoryReporterBase() {} - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD GetProcess(nsACString& aProcess) { diff --git a/xpcom/base/nsInterfaceRequestorAgg.cpp b/xpcom/base/nsInterfaceRequestorAgg.cpp index a9fe0177384..4408d565901 100644 --- a/xpcom/base/nsInterfaceRequestorAgg.cpp +++ b/xpcom/base/nsInterfaceRequestorAgg.cpp @@ -11,7 +11,8 @@ class nsInterfaceRequestorAgg MOZ_FINAL : public nsIInterfaceRequestor { public: - NS_DECL_ISUPPORTS + // XXX This needs to support threadsafe refcounting until we fix bug 243591. + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR nsInterfaceRequestorAgg(nsIInterfaceRequestor *aFirst, @@ -32,8 +33,7 @@ private: nsCOMPtr mConsumerTarget; }; -// XXX This needs to support threadsafe refcounting until we fix bug 243591. -NS_IMPL_THREADSAFE_ISUPPORTS1(nsInterfaceRequestorAgg, nsIInterfaceRequestor) +NS_IMPL_ISUPPORTS1(nsInterfaceRequestorAgg, nsIInterfaceRequestor) NS_IMETHODIMP nsInterfaceRequestorAgg::GetInterface(const nsIID &aIID, void **aResult) diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 658a1d96301..7c2a6be0ca6 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -191,7 +191,7 @@ public: virtual void OnFileCanReadWithoutBlocking(int aFd) = 0; virtual void OnFileCanWriteWithoutBlocking(int aFd) {}; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS /** * Initialize this object. This should be called right after the object is @@ -258,7 +258,7 @@ public: } }; -NS_IMPL_THREADSAFE_ISUPPORTS1(FdWatcher, nsIObserver); +NS_IMPL_ISUPPORTS1(FdWatcher, nsIObserver); class SignalPipeWatcher : public FdWatcher { diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index b498c4b28f8..0d4b1f0152b 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -682,7 +682,7 @@ NS_IMPL_ISUPPORTS1(DMDMultiReporter, nsIMemoryMultiReporter) ** nsMemoryReporterManager implementation **/ -NS_IMPL_THREADSAFE_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager) +NS_IMPL_ISUPPORTS1(nsMemoryReporterManager, nsIMemoryReporterManager) NS_IMETHODIMP nsMemoryReporterManager::Init() @@ -1199,7 +1199,7 @@ nsMemoryReporterManager::MinimizeMemoryUsage(nsIRunnable* aCallback, // Most memory reporters don't need thread safety, but some do. Make them all // thread-safe just to be safe. Memory reporters are created and destroyed // infrequently enough that the performance cost should be negligible. -NS_IMPL_THREADSAFE_ISUPPORTS1(MemoryReporterBase, nsIMemoryReporter) +NS_IMPL_ISUPPORTS1(MemoryReporterBase, nsIMemoryReporter) nsresult NS_RegisterMemoryReporter (nsIMemoryReporter *reporter) diff --git a/xpcom/base/nsMemoryReporterManager.h b/xpcom/base/nsMemoryReporterManager.h index a581b1ab835..3b22ce011b6 100644 --- a/xpcom/base/nsMemoryReporterManager.h +++ b/xpcom/base/nsMemoryReporterManager.h @@ -16,7 +16,7 @@ using mozilla::Mutex; class nsMemoryReporterManager : public nsIMemoryReporterManager { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIMEMORYREPORTERMANAGER nsMemoryReporterManager(); diff --git a/xpcom/base/nsUUIDGenerator.cpp b/xpcom/base/nsUUIDGenerator.cpp index 872037285c8..3ca3d328090 100644 --- a/xpcom/base/nsUUIDGenerator.cpp +++ b/xpcom/base/nsUUIDGenerator.cpp @@ -19,7 +19,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsUUIDGenerator, nsIUUIDGenerator) +NS_IMPL_ISUPPORTS1(nsUUIDGenerator, nsIUUIDGenerator) nsUUIDGenerator::nsUUIDGenerator() : mLock("nsUUIDGenerator.mLock") diff --git a/xpcom/base/nsUUIDGenerator.h b/xpcom/base/nsUUIDGenerator.h index b7df6e50c54..62d059325a5 100644 --- a/xpcom/base/nsUUIDGenerator.h +++ b/xpcom/base/nsUUIDGenerator.h @@ -15,7 +15,7 @@ class nsUUIDGenerator MOZ_FINAL : public nsIUUIDGenerator { public: nsUUIDGenerator(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIUUIDGENERATOR diff --git a/xpcom/components/ModuleUtils.h b/xpcom/components/ModuleUtils.h index 5cb99e66a07..4cc56a5f2b7 100644 --- a/xpcom/components/ModuleUtils.h +++ b/xpcom/components/ModuleUtils.h @@ -110,7 +110,7 @@ public: { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIMODULE private: diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index fd86a5b7443..3ed89ff3559 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -834,12 +834,12 @@ nsComponentManagerImpl::~nsComponentManagerImpl() PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, ("nsComponentManager: Destroyed.")); } -NS_IMPL_THREADSAFE_ISUPPORTS5(nsComponentManagerImpl, - nsIComponentManager, - nsIServiceManager, - nsIComponentRegistrar, - nsISupportsWeakReference, - nsIInterfaceRequestor) +NS_IMPL_ISUPPORTS5(nsComponentManagerImpl, + nsIComponentManager, + nsIServiceManager, + nsIComponentRegistrar, + nsISupportsWeakReference, + nsIInterfaceRequestor) nsresult diff --git a/xpcom/components/nsComponentManager.h b/xpcom/components/nsComponentManager.h index be605ac721e..f3c27d1c43d 100644 --- a/xpcom/components/nsComponentManager.h +++ b/xpcom/components/nsComponentManager.h @@ -126,7 +126,7 @@ class nsComponentManagerImpl MOZ_FINAL , public nsIInterfaceRequestor { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSICOMPONENTMANAGER NS_DECL_NSICOMPONENTREGISTRAR diff --git a/xpcom/ds/nsAtomService.cpp b/xpcom/ds/nsAtomService.cpp index 4c7d26162a7..1ecbac3e69e 100644 --- a/xpcom/ds/nsAtomService.cpp +++ b/xpcom/ds/nsAtomService.cpp @@ -5,7 +5,7 @@ #include "nsAtomService.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsAtomService, nsIAtomService) +NS_IMPL_ISUPPORTS1(nsAtomService, nsIAtomService) nsAtomService::nsAtomService() { diff --git a/xpcom/ds/nsAtomService.h b/xpcom/ds/nsAtomService.h index 0b4ad483402..816409004c8 100644 --- a/xpcom/ds/nsAtomService.h +++ b/xpcom/ds/nsAtomService.h @@ -13,7 +13,7 @@ class nsAtomService MOZ_FINAL : public nsIAtomService { public: nsAtomService(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIATOMSERVICE diff --git a/xpcom/ds/nsHashPropertyBag.cpp b/xpcom/ds/nsHashPropertyBag.cpp index ee0c06b340b..5ce8471bfaa 100644 --- a/xpcom/ds/nsHashPropertyBag.cpp +++ b/xpcom/ds/nsHashPropertyBag.cpp @@ -36,8 +36,8 @@ NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval) * nsHashPropertyBag impl */ -NS_IMPL_THREADSAFE_ADDREF(nsHashPropertyBag) -NS_IMPL_THREADSAFE_RELEASE(nsHashPropertyBag) +NS_IMPL_ADDREF(nsHashPropertyBag) +NS_IMPL_RELEASE(nsHashPropertyBag) NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag) NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag) diff --git a/xpcom/ds/nsHashPropertyBag.h b/xpcom/ds/nsHashPropertyBag.h index e91820e44ba..ef072b9033b 100644 --- a/xpcom/ds/nsHashPropertyBag.h +++ b/xpcom/ds/nsHashPropertyBag.h @@ -23,7 +23,7 @@ public: nsresult Init(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROPERTYBAG diff --git a/xpcom/ds/nsObserverService.cpp b/xpcom/ds/nsObserverService.cpp index 572b65228de..cb9cb4d1e31 100644 --- a/xpcom/ds/nsObserverService.cpp +++ b/xpcom/ds/nsObserverService.cpp @@ -48,7 +48,7 @@ GetObserverServiceLog() // nsObserverService Implementation -NS_IMPL_THREADSAFE_ISUPPORTS2(nsObserverService, nsIObserverService, nsObserverService) +NS_IMPL_ISUPPORTS2(nsObserverService, nsIObserverService, nsObserverService) nsObserverService::nsObserverService() : mShuttingDown(false) diff --git a/xpcom/ds/nsObserverService.h b/xpcom/ds/nsObserverService.h index 53e27f2a8ad..31d8b152226 100644 --- a/xpcom/ds/nsObserverService.h +++ b/xpcom/ds/nsObserverService.h @@ -21,7 +21,7 @@ public: nsObserverService(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIOBSERVERSERVICE void Shutdown(); diff --git a/xpcom/ds/nsPersistentProperties.cpp b/xpcom/ds/nsPersistentProperties.cpp index 094bd144f90..db5e6dcbe43 100644 --- a/xpcom/ds/nsPersistentProperties.cpp +++ b/xpcom/ds/nsPersistentProperties.cpp @@ -494,7 +494,7 @@ nsPersistentProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResul return rv; } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties) +NS_IMPL_ISUPPORTS2(nsPersistentProperties, nsIPersistentProperties, nsIProperties) NS_IMETHODIMP nsPersistentProperties::Load(nsIInputStream *aIn) diff --git a/xpcom/ds/nsPersistentProperties.h b/xpcom/ds/nsPersistentProperties.h index 83360e967a8..668d653ed31 100644 --- a/xpcom/ds/nsPersistentProperties.h +++ b/xpcom/ds/nsPersistentProperties.h @@ -22,7 +22,7 @@ public: nsPersistentProperties(); nsresult Init(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROPERTIES NS_DECL_NSIPERSISTENTPROPERTIES diff --git a/xpcom/ds/nsSupportsArray.cpp b/xpcom/ds/nsSupportsArray.cpp index 950f95272f7..3a174d417e5 100644 --- a/xpcom/ds/nsSupportsArray.cpp +++ b/xpcom/ds/nsSupportsArray.cpp @@ -174,7 +174,7 @@ nsSupportsArray::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) return it->QueryInterface(aIID, aResult); } -NS_IMPL_THREADSAFE_ISUPPORTS3(nsSupportsArray, nsISupportsArray, nsICollection, nsISerializable) +NS_IMPL_ISUPPORTS3(nsSupportsArray, nsISupportsArray, nsICollection, nsISerializable) NS_IMETHODIMP nsSupportsArray::Read(nsIObjectInputStream *aStream) diff --git a/xpcom/ds/nsSupportsArray.h b/xpcom/ds/nsSupportsArray.h index d3856944117..6346513604b 100644 --- a/xpcom/ds/nsSupportsArray.h +++ b/xpcom/ds/nsSupportsArray.h @@ -21,7 +21,7 @@ public: static nsresult Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISERIALIZABLE diff --git a/xpcom/ds/nsSupportsPrimitives.cpp b/xpcom/ds/nsSupportsPrimitives.cpp index 024bef731db..eca65e9ffcd 100644 --- a/xpcom/ds/nsSupportsPrimitives.cpp +++ b/xpcom/ds/nsSupportsPrimitives.cpp @@ -146,8 +146,8 @@ NS_IMETHODIMP nsSupportsStringImpl::SetData(const nsAString& aData) /***************************************************************************/ -NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsPRBoolImpl, nsISupportsPRBool, - nsISupportsPrimitive) +NS_IMPL_ISUPPORTS2(nsSupportsPRBoolImpl, nsISupportsPRBool, + nsISupportsPrimitive) nsSupportsPRBoolImpl::nsSupportsPRBoolImpl() : mData(false) @@ -683,8 +683,8 @@ NS_IMETHODIMP nsSupportsDoubleImpl::ToString(char **_retval) /***************************************************************************/ -NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsVoidImpl, nsISupportsVoid, - nsISupportsPrimitive) +NS_IMPL_ISUPPORTS2(nsSupportsVoidImpl, nsISupportsVoid, + nsISupportsPrimitive) nsSupportsVoidImpl::nsSupportsVoidImpl() : mData(nullptr) @@ -725,9 +725,9 @@ NS_IMETHODIMP nsSupportsVoidImpl::ToString(char **_retval) /***************************************************************************/ -NS_IMPL_THREADSAFE_ISUPPORTS2(nsSupportsInterfacePointerImpl, - nsISupportsInterfacePointer, - nsISupportsPrimitive) +NS_IMPL_ISUPPORTS2(nsSupportsInterfacePointerImpl, + nsISupportsInterfacePointer, + nsISupportsPrimitive) nsSupportsInterfacePointerImpl::nsSupportsInterfacePointerImpl() : mIID(nullptr) diff --git a/xpcom/ds/nsSupportsPrimitives.h b/xpcom/ds/nsSupportsPrimitives.h index b1fbebba7c9..e9f16769242 100644 --- a/xpcom/ds/nsSupportsPrimitives.h +++ b/xpcom/ds/nsSupportsPrimitives.h @@ -67,7 +67,7 @@ private: class nsSupportsPRBoolImpl MOZ_FINAL : public nsISupportsPRBool { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISUPPORTSPRIMITIVE NS_DECL_NSISUPPORTSPRBOOL @@ -271,7 +271,7 @@ private: class nsSupportsVoidImpl MOZ_FINAL : public nsISupportsVoid { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISUPPORTSPRIMITIVE NS_DECL_NSISUPPORTSVOID @@ -288,7 +288,7 @@ private: class nsSupportsInterfacePointerImpl MOZ_FINAL : public nsISupportsInterfacePointer { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISUPPORTSPRIMITIVE NS_DECL_NSISUPPORTSINTERFACEPOINTER diff --git a/xpcom/glue/GenericFactory.cpp b/xpcom/glue/GenericFactory.cpp index 56db63c4154..5e11218761f 100644 --- a/xpcom/glue/GenericFactory.cpp +++ b/xpcom/glue/GenericFactory.cpp @@ -7,7 +7,7 @@ namespace mozilla { -NS_IMPL_THREADSAFE_ISUPPORTS1(GenericFactory, nsIFactory) +NS_IMPL_ISUPPORTS1(GenericFactory, nsIFactory) NS_IMETHODIMP GenericFactory::CreateInstance(nsISupports* aOuter, REFNSIID aIID, diff --git a/xpcom/glue/GenericFactory.h b/xpcom/glue/GenericFactory.h index be022659399..7c4962c6765 100644 --- a/xpcom/glue/GenericFactory.h +++ b/xpcom/glue/GenericFactory.h @@ -22,7 +22,7 @@ class GenericFactory MOZ_FINAL : public nsIFactory public: typedef Module::ConstructorProcPtr ConstructorProcPtr; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIFACTORY GenericFactory(ConstructorProcPtr ctor) diff --git a/xpcom/glue/GenericModule.cpp b/xpcom/glue/GenericModule.cpp index 8fa07dce51f..60fb6419ccb 100644 --- a/xpcom/glue/GenericModule.cpp +++ b/xpcom/glue/GenericModule.cpp @@ -15,7 +15,7 @@ namespace mozilla { -NS_IMPL_THREADSAFE_ISUPPORTS1(GenericModule, nsIModule) +NS_IMPL_ISUPPORTS1(GenericModule, nsIModule) NS_IMETHODIMP GenericModule::GetClassObject(nsIComponentManager* aCompMgr, diff --git a/xpcom/glue/nsProxyRelease.h b/xpcom/glue/nsProxyRelease.h index 87723761b5f..e6dae7eb5de 100644 --- a/xpcom/glue/nsProxyRelease.h +++ b/xpcom/glue/nsProxyRelease.h @@ -142,13 +142,9 @@ public: bool operator==(const nsMainThreadPtrHolder& aOther) const { return mRawPtr == aOther.mRawPtr; } - NS_IMETHOD_(nsrefcnt) Release(); - NS_IMETHOD_(nsrefcnt) AddRef(); + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(nsMainThreadPtrHolder) private: - // This class is threadsafe and reference-counted. - nsAutoRefCnt mRefCnt; - // Our wrapped pointer. T* mRawPtr; @@ -161,11 +157,6 @@ private: nsMainThreadPtrHolder(const nsMainThreadPtrHolder& other); }; -template -NS_IMPL_THREADSAFE_ADDREF(nsMainThreadPtrHolder) -template -NS_IMPL_THREADSAFE_RELEASE(nsMainThreadPtrHolder) - template class nsMainThreadPtrHandle { diff --git a/xpcom/glue/nsThreadUtils.cpp b/xpcom/glue/nsThreadUtils.cpp index 437e45fec4c..f2deb747d72 100644 --- a/xpcom/glue/nsThreadUtils.cpp +++ b/xpcom/glue/nsThreadUtils.cpp @@ -28,7 +28,7 @@ #ifndef XPCOM_GLUE_AVOID_NSPR -NS_IMPL_THREADSAFE_ISUPPORTS1(nsRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsRunnable, nsIRunnable) NS_IMETHODIMP nsRunnable::Run() @@ -37,7 +37,7 @@ nsRunnable::Run() return NS_OK; } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsCancelableRunnable, nsICancelableRunnable, +NS_IMPL_ISUPPORTS2(nsCancelableRunnable, nsICancelableRunnable, nsIRunnable) NS_IMETHODIMP @@ -247,14 +247,14 @@ class nsNameThreadRunnable MOZ_FINAL : public nsIRunnable public: nsNameThreadRunnable(const nsACString &name) : mName(name) { } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE protected: const nsCString mName; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsNameThreadRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsNameThreadRunnable, nsIRunnable) NS_IMETHODIMP nsNameThreadRunnable::Run() diff --git a/xpcom/glue/nsThreadUtils.h b/xpcom/glue/nsThreadUtils.h index f1b9b91cdb0..ba837cde239 100644 --- a/xpcom/glue/nsThreadUtils.h +++ b/xpcom/glue/nsThreadUtils.h @@ -236,7 +236,7 @@ extern NS_COM_GLUE nsIThread *NS_GetCurrentThread(); class NS_COM_GLUE nsRunnable : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE nsRunnable() { @@ -251,7 +251,7 @@ protected: class NS_COM_GLUE nsCancelableRunnable : public nsICancelableRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSICANCELABLERUNNABLE diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp index ba497572a94..b0243c514e7 100644 --- a/xpcom/io/nsAppFileLocationProvider.cpp +++ b/xpcom/io/nsAppFileLocationProvider.cpp @@ -78,7 +78,7 @@ nsAppFileLocationProvider::nsAppFileLocationProvider() // nsAppFileLocationProvider::nsISupports //***************************************************************************** -NS_IMPL_THREADSAFE_ISUPPORTS2(nsAppFileLocationProvider, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2) +NS_IMPL_ISUPPORTS2(nsAppFileLocationProvider, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2) //***************************************************************************** // nsAppFileLocationProvider::nsIDirectoryServiceProvider diff --git a/xpcom/io/nsAppFileLocationProvider.h b/xpcom/io/nsAppFileLocationProvider.h index 8ecf78d53ed..7fb7e313088 100644 --- a/xpcom/io/nsAppFileLocationProvider.h +++ b/xpcom/io/nsAppFileLocationProvider.h @@ -18,7 +18,7 @@ class nsAppFileLocationProvider MOZ_FINAL : public nsIDirectoryServiceProvider2 public: nsAppFileLocationProvider(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIDIRECTORYSERVICEPROVIDER NS_DECL_NSIDIRECTORYSERVICEPROVIDER2 diff --git a/xpcom/io/nsDirectoryService.cpp b/xpcom/io/nsDirectoryService.cpp index f013a4f11c6..6f8fc9c6af6 100644 --- a/xpcom/io/nsDirectoryService.cpp +++ b/xpcom/io/nsDirectoryService.cpp @@ -288,7 +288,7 @@ nsDirectoryService::~nsDirectoryService() { } -NS_IMPL_THREADSAFE_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectoryService, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2) +NS_IMPL_ISUPPORTS4(nsDirectoryService, nsIProperties, nsIDirectoryService, nsIDirectoryServiceProvider, nsIDirectoryServiceProvider2) NS_IMETHODIMP diff --git a/xpcom/io/nsDirectoryService.h b/xpcom/io/nsDirectoryService.h index ed9408b82c8..d02abfe1dcc 100644 --- a/xpcom/io/nsDirectoryService.h +++ b/xpcom/io/nsDirectoryService.h @@ -24,7 +24,7 @@ class nsDirectoryService MOZ_FINAL : public nsIDirectoryService, public: // nsISupports interface - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROPERTIES diff --git a/xpcom/io/nsIOUtil.cpp b/xpcom/io/nsIOUtil.cpp index 30bd4fe94e3..4363355de1a 100644 --- a/xpcom/io/nsIOUtil.cpp +++ b/xpcom/io/nsIOUtil.cpp @@ -8,7 +8,7 @@ #include "nsIOutputStream.h" #include "nsStreamUtils.h" -NS_IMPL_THREADSAFE_ISUPPORTS1(nsIOUtil, nsIIOUtil) +NS_IMPL_ISUPPORTS1(nsIOUtil, nsIIOUtil) NS_IMETHODIMP nsIOUtil::InputStreamIsBuffered(nsIInputStream* aStream, bool* _retval) diff --git a/xpcom/io/nsIOUtil.h b/xpcom/io/nsIOUtil.h index 3e06ddb8890..16d65f15ac9 100644 --- a/xpcom/io/nsIOUtil.h +++ b/xpcom/io/nsIOUtil.h @@ -17,7 +17,7 @@ class nsIOUtil MOZ_FINAL : public nsIIOUtil { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIIOUTIL }; diff --git a/xpcom/io/nsInputStreamTee.cpp b/xpcom/io/nsInputStreamTee.cpp index dd68fc6f23e..7ccf4cf75fd 100644 --- a/xpcom/io/nsInputStreamTee.cpp +++ b/xpcom/io/nsInputStreamTee.cpp @@ -35,7 +35,7 @@ GetTeeLog() class nsInputStreamTee MOZ_FINAL : public nsIInputStreamTee { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSIINPUTSTREAMTEE @@ -205,9 +205,9 @@ nsInputStreamTee::WriteSegmentFun(nsIInputStream *in, void *closure, const char return tee->TeeSegment(fromSegment, *writeCount); } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsInputStreamTee, - nsIInputStreamTee, - nsIInputStream) +NS_IMPL_ISUPPORTS2(nsInputStreamTee, + nsIInputStreamTee, + nsIInputStream) NS_IMETHODIMP nsInputStreamTee::Close() { diff --git a/xpcom/io/nsLocalFileOS2.cpp b/xpcom/io/nsLocalFileOS2.cpp index 2fbccccb46c..8dfa6e492dd 100644 --- a/xpcom/io/nsLocalFileOS2.cpp +++ b/xpcom/io/nsLocalFileOS2.cpp @@ -580,11 +580,11 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* // nsLocalFile::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS4(nsLocalFile, - nsILocalFile, - nsIFile, - nsILocalFileOS2, - nsIHashable) +NS_IMPL_ISUPPORTS4(nsLocalFile, + nsILocalFile, + nsIFile, + nsILocalFileOS2, + nsIHashable) //----------------------------------------------------------------------------- diff --git a/xpcom/io/nsLocalFileOS2.h b/xpcom/io/nsLocalFileOS2.h index d23fb8d9a33..e53450a7fef 100644 --- a/xpcom/io/nsLocalFileOS2.h +++ b/xpcom/io/nsLocalFileOS2.h @@ -44,7 +44,7 @@ public: static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); // nsISupports interface - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // nsIFile interface NS_DECL_NSIFILE diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index a38f7942ffd..88066ed3fa7 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -239,16 +239,16 @@ nsLocalFile::nsLocalFile(const nsLocalFile& other) } #ifdef MOZ_WIDGET_COCOA -NS_IMPL_THREADSAFE_ISUPPORTS4(nsLocalFile, - nsILocalFileMac, - nsILocalFile, - nsIFile, - nsIHashable) +NS_IMPL_ISUPPORTS4(nsLocalFile, + nsILocalFileMac, + nsILocalFile, + nsIFile, + nsIHashable) #else -NS_IMPL_THREADSAFE_ISUPPORTS3(nsLocalFile, - nsILocalFile, - nsIFile, - nsIHashable) +NS_IMPL_ISUPPORTS3(nsLocalFile, + nsILocalFile, + nsIFile, + nsIHashable) #endif nsresult diff --git a/xpcom/io/nsLocalFileUnix.h b/xpcom/io/nsLocalFileUnix.h index 7a99b8d28c7..23fff83f81a 100644 --- a/xpcom/io/nsLocalFileUnix.h +++ b/xpcom/io/nsLocalFileUnix.h @@ -91,7 +91,7 @@ public: static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIFILE NS_DECL_NSILOCALFILE #ifdef MOZ_WIDGET_COCOA diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 4601061743f..a94b0ecd9b3 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -979,11 +979,11 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* // nsLocalFile::nsISupports //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ISUPPORTS4(nsLocalFile, - nsILocalFile, - nsIFile, - nsILocalFileWin, - nsIHashable) +NS_IMPL_ISUPPORTS4(nsLocalFile, + nsILocalFile, + nsIFile, + nsILocalFileWin, + nsIHashable) //----------------------------------------------------------------------------- diff --git a/xpcom/io/nsLocalFileWin.h b/xpcom/io/nsLocalFileWin.h index e60020882f8..740836f2612 100644 --- a/xpcom/io/nsLocalFileWin.h +++ b/xpcom/io/nsLocalFileWin.h @@ -34,7 +34,7 @@ public: static nsresult nsLocalFileConstructor(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); // nsISupports interface - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // nsIFile interface NS_DECL_NSIFILE diff --git a/xpcom/io/nsMultiplexInputStream.cpp b/xpcom/io/nsMultiplexInputStream.cpp index 553e56e20cd..d7a2992c918 100644 --- a/xpcom/io/nsMultiplexInputStream.cpp +++ b/xpcom/io/nsMultiplexInputStream.cpp @@ -33,7 +33,7 @@ class nsMultiplexInputStream MOZ_FINAL : public nsIMultiplexInputStream, public: nsMultiplexInputStream(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSIMULTIPLEXINPUTSTREAM NS_DECL_NSISEEKABLESTREAM @@ -60,8 +60,8 @@ private: nsresult mStatus; }; -NS_IMPL_THREADSAFE_ADDREF(nsMultiplexInputStream) -NS_IMPL_THREADSAFE_RELEASE(nsMultiplexInputStream) +NS_IMPL_ADDREF(nsMultiplexInputStream) +NS_IMPL_RELEASE(nsMultiplexInputStream) NS_IMPL_CLASSINFO(nsMultiplexInputStream, NULL, nsIClassInfo::THREADSAFE, NS_MULTIPLEXINPUTSTREAM_CID) diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index adc225f9841..3f5da8c9887 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -128,7 +128,7 @@ private: nsPipe *mPipe; // separate refcnt so that we know when to close the consumer - nsrefcnt mReaderRefCnt; + mozilla::ThreadSafeAutoRefCnt mReaderRefCnt; int64_t mLogicalOffset; bool mBlocking; @@ -182,7 +182,7 @@ private: nsPipe *mPipe; // separate refcnt so that we know when to close the producer - nsrefcnt mWriterRefCnt; + mozilla::ThreadSafeAutoRefCnt mWriterRefCnt; int64_t mLogicalOffset; bool mBlocking; @@ -201,7 +201,7 @@ public: friend class nsPipeInputStream; friend class nsPipeOutputStream; - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPIPE // nsPipe methods: @@ -311,7 +311,7 @@ nsPipe::~nsPipe() { } -NS_IMPL_THREADSAFE_ISUPPORTS1(nsPipe, nsIPipe) +NS_IMPL_ISUPPORTS1(nsPipe, nsIPipe) NS_IMETHODIMP nsPipe::Init(bool nonBlockingIn, @@ -680,14 +680,14 @@ nsPipeInputStream::OnInputException(nsresult reason, nsPipeEvents &events) NS_IMETHODIMP_(nsrefcnt) nsPipeInputStream::AddRef(void) { - NS_AtomicIncrementRefcnt(mReaderRefCnt); + ++mReaderRefCnt; return mPipe->AddRef(); } NS_IMETHODIMP_(nsrefcnt) nsPipeInputStream::Release(void) { - if (NS_AtomicDecrementRefcnt(mReaderRefCnt) == 0) + if (--mReaderRefCnt == 0) Close(); return mPipe->Release(); } @@ -1035,14 +1035,14 @@ nsPipeOutputStream::OnOutputException(nsresult reason, nsPipeEvents &events) NS_IMETHODIMP_(nsrefcnt) nsPipeOutputStream::AddRef() { - NS_AtomicIncrementRefcnt(mWriterRefCnt); + ++mWriterRefCnt; return mPipe->AddRef(); } NS_IMETHODIMP_(nsrefcnt) nsPipeOutputStream::Release() { - if (NS_AtomicDecrementRefcnt(mWriterRefCnt) == 0) + if (--mWriterRefCnt == 0) Close(); return mPipe->Release(); } diff --git a/xpcom/io/nsStorageStream.cpp b/xpcom/io/nsStorageStream.cpp index 107e292c98e..b71279c2706 100644 --- a/xpcom/io/nsStorageStream.cpp +++ b/xpcom/io/nsStorageStream.cpp @@ -59,9 +59,9 @@ nsStorageStream::~nsStorageStream() delete mSegmentedBuffer; } -NS_IMPL_THREADSAFE_ISUPPORTS2(nsStorageStream, - nsIStorageStream, - nsIOutputStream) +NS_IMPL_ISUPPORTS2(nsStorageStream, + nsIStorageStream, + nsIOutputStream) NS_IMETHODIMP nsStorageStream::Init(uint32_t segmentSize, uint32_t maxSize, @@ -320,7 +320,7 @@ public: NS_ADDREF(mStorageStream); } - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSISEEKABLESTREAM @@ -348,9 +348,9 @@ private: uint32_t SegOffset(uint32_t aPosition) {return aPosition & (mSegmentSize - 1);} }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsStorageInputStream, - nsIInputStream, - nsISeekableStream) +NS_IMPL_ISUPPORTS2(nsStorageInputStream, + nsIInputStream, + nsISeekableStream) NS_IMETHODIMP nsStorageStream::NewInputStream(int32_t aStartingOffset, nsIInputStream* *aInputStream) diff --git a/xpcom/io/nsStorageStream.h b/xpcom/io/nsStorageStream.h index e50ce3ffc69..c7e3468ec77 100644 --- a/xpcom/io/nsStorageStream.h +++ b/xpcom/io/nsStorageStream.h @@ -37,7 +37,7 @@ class nsStorageStream MOZ_FINAL : public nsIStorageStream, public: nsStorageStream(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSISTORAGESTREAM NS_DECL_NSIOUTPUTSTREAM diff --git a/xpcom/io/nsStreamUtils.cpp b/xpcom/io/nsStreamUtils.cpp index fe79bc0c910..f5990da903e 100644 --- a/xpcom/io/nsStreamUtils.cpp +++ b/xpcom/io/nsStreamUtils.cpp @@ -22,7 +22,7 @@ class nsInputStreamReadyEvent MOZ_FINAL : public nsIRunnable , public nsIInputStreamCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsInputStreamReadyEvent(nsIInputStreamCallback *callback, nsIEventTarget *target) @@ -91,8 +91,8 @@ private: nsCOMPtr mTarget; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsInputStreamReadyEvent, nsIRunnable, - nsIInputStreamCallback) +NS_IMPL_ISUPPORTS2(nsInputStreamReadyEvent, nsIRunnable, + nsIInputStreamCallback) //----------------------------------------------------------------------------- @@ -100,7 +100,7 @@ class nsOutputStreamReadyEvent MOZ_FINAL : public nsIRunnable , public nsIOutputStreamCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsOutputStreamReadyEvent(nsIOutputStreamCallback *callback, nsIEventTarget *target) @@ -169,8 +169,8 @@ private: nsCOMPtr mTarget; }; -NS_IMPL_THREADSAFE_ISUPPORTS2(nsOutputStreamReadyEvent, nsIRunnable, - nsIOutputStreamCallback) +NS_IMPL_ISUPPORTS2(nsOutputStreamReadyEvent, nsIRunnable, + nsIOutputStreamCallback) //----------------------------------------------------------------------------- @@ -205,7 +205,7 @@ class nsAStreamCopier : public nsIInputStreamCallback , public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS nsAStreamCopier() : mLock("nsAStreamCopier.mLock") @@ -459,10 +459,10 @@ protected: nsresult mCancelStatus; }; -NS_IMPL_THREADSAFE_ISUPPORTS3(nsAStreamCopier, - nsIInputStreamCallback, - nsIOutputStreamCallback, - nsIRunnable) +NS_IMPL_ISUPPORTS3(nsAStreamCopier, + nsIInputStreamCallback, + nsIOutputStreamCallback, + nsIRunnable) class nsStreamCopierIB MOZ_FINAL : public nsAStreamCopier { diff --git a/xpcom/io/nsStringStream.cpp b/xpcom/io/nsStringStream.cpp index 591e130b394..0fa7120c825 100644 --- a/xpcom/io/nsStringStream.cpp +++ b/xpcom/io/nsStringStream.cpp @@ -35,7 +35,7 @@ class nsStringInputStream MOZ_FINAL : public nsIStringInputStream , public nsIIPCSerializableInputStream { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINPUTSTREAM NS_DECL_NSISTRINGINPUTSTREAM NS_DECL_NSISEEKABLESTREAM @@ -78,8 +78,8 @@ private: // This class needs to support threadsafe refcounting since people often // allocate a string stream, and then read it from a background thread. -NS_IMPL_THREADSAFE_ADDREF(nsStringInputStream) -NS_IMPL_THREADSAFE_RELEASE(nsStringInputStream) +NS_IMPL_ADDREF(nsStringInputStream) +NS_IMPL_RELEASE(nsStringInputStream) NS_IMPL_CLASSINFO(nsStringInputStream, NULL, nsIClassInfo::THREADSAFE, NS_STRINGINPUTSTREAM_CID) diff --git a/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h b/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h index 4876e03eab3..74f6dbf4530 100644 --- a/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h +++ b/xpcom/reflect/xptinfo/public/XPTInterfaceInfoManager.h @@ -26,7 +26,7 @@ namespace mozilla { class XPTInterfaceInfoManager MOZ_FINAL : public nsIInterfaceInfoManager { - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEINFOMANAGER public: diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp index e4c4209055c..9d9ab3a7c4c 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp @@ -595,7 +595,7 @@ xptiInterfaceInfo::~xptiInterfaceInfo() nsrefcnt xptiInterfaceInfo::AddRef(void) { - nsrefcnt cnt = NS_AtomicIncrementRefcnt(mRefCnt); + nsrefcnt cnt = ++mRefCnt; NS_LOG_ADDREF(this, cnt, "xptiInterfaceInfo", sizeof(*this)); return cnt; } @@ -604,7 +604,7 @@ nsrefcnt xptiInterfaceInfo::Release(void) { xptiInterfaceEntry* entry = mEntry; - nsrefcnt cnt = NS_AtomicDecrementRefcnt(mRefCnt); + nsrefcnt cnt = --mRefCnt; NS_LOG_RELEASE(this, cnt, "xptiInterfaceInfo"); if(!cnt) { diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp index 39c5904fc7e..7ef74dfaaf9 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp @@ -19,8 +19,8 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS1(XPTInterfaceInfoManager, - nsIInterfaceInfoManager) +NS_IMPL_ISUPPORTS1(XPTInterfaceInfoManager, + nsIInterfaceInfoManager) static XPTInterfaceInfoManager* gInterfaceInfoManager = nullptr; #ifdef DEBUG diff --git a/xpcom/reflect/xptinfo/src/xptiprivate.h b/xpcom/reflect/xptinfo/src/xptiprivate.h index ecd71afbf5f..5e718c071a9 100644 --- a/xpcom/reflect/xptinfo/src/xptiprivate.h +++ b/xpcom/reflect/xptinfo/src/xptiprivate.h @@ -291,7 +291,7 @@ private: class xptiInterfaceInfo MOZ_FINAL : public nsIInterfaceInfo { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS // Use delegation to implement (most!) of nsIInterfaceInfo. NS_IMETHOD GetName(char * *aName) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetName(aName); } diff --git a/xpcom/tests/TestPipes.cpp b/xpcom/tests/TestPipes.cpp index fe3cc89c2f3..48d832b1ecf 100644 --- a/xpcom/tests/TestPipes.cpp +++ b/xpcom/tests/TestPipes.cpp @@ -106,7 +106,7 @@ WriteAll(nsIOutputStream *os, const char *buf, uint32_t bufLen, uint32_t *lenWri class nsReceiver : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Run() { nsresult rv; @@ -146,7 +146,7 @@ protected: uint32_t mCount; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsReceiver, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsReceiver, nsIRunnable) nsresult TestPipe(nsIInputStream* in, nsIOutputStream* out) @@ -197,7 +197,7 @@ TestPipe(nsIInputStream* in, nsIOutputStream* out) class nsShortReader : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Run() { nsresult rv; @@ -261,7 +261,7 @@ protected: Monitor* mMon; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsShortReader, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsShortReader, nsIRunnable) nsresult TestShortWrites(nsIInputStream* in, nsIOutputStream* out) @@ -316,7 +316,7 @@ TestShortWrites(nsIInputStream* in, nsIOutputStream* out) class nsPump : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Run() { nsresult rv; @@ -352,8 +352,7 @@ protected: uint32_t mCount; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsPump, - nsIRunnable) +NS_IMPL_ISUPPORTS1(nsPump, nsIRunnable) nsresult TestChainedPipes() diff --git a/xpcom/tests/TestRacingServiceManager.cpp b/xpcom/tests/TestRacingServiceManager.cpp index 67562d9de07..e61eb8c6cab 100644 --- a/xpcom/tests/TestRacingServiceManager.cpp +++ b/xpcom/tests/TestRacingServiceManager.cpp @@ -87,7 +87,7 @@ private: class Factory MOZ_FINAL : public nsIFactory { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS Factory() : mFirstComponentCreated(false) { } @@ -102,12 +102,12 @@ public: bool mFirstComponentCreated; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(Factory, nsIFactory) +NS_IMPL_ISUPPORTS1(Factory, nsIFactory) class Component1 MOZ_FINAL : public nsISupports { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS Component1() { // This is the real test - make sure that only one instance is ever created. @@ -116,8 +116,8 @@ public: } }; -NS_IMPL_THREADSAFE_ADDREF(Component1) -NS_IMPL_THREADSAFE_RELEASE(Component1) +NS_IMPL_ADDREF(Component1) +NS_IMPL_RELEASE(Component1) NS_INTERFACE_MAP_BEGIN(Component1) NS_INTERFACE_MAP_ENTRY(Component1) @@ -127,7 +127,7 @@ NS_INTERFACE_MAP_END class Component2 MOZ_FINAL : public nsISupports { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS Component2() { // This is the real test - make sure that only one instance is ever created. @@ -136,8 +136,8 @@ public: } }; -NS_IMPL_THREADSAFE_ADDREF(Component2) -NS_IMPL_THREADSAFE_RELEASE(Component2) +NS_IMPL_ADDREF(Component2) +NS_IMPL_RELEASE(Component2) NS_INTERFACE_MAP_BEGIN(Component2) NS_INTERFACE_MAP_ENTRY(Component2) diff --git a/xpcom/tests/TestThreadPool.cpp b/xpcom/tests/TestThreadPool.cpp index 80dcc22efbb..f0af86df069 100644 --- a/xpcom/tests/TestThreadPool.cpp +++ b/xpcom/tests/TestThreadPool.cpp @@ -16,7 +16,7 @@ class Task : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS Task(int i) : mIndex(i) {} @@ -32,7 +32,7 @@ public: private: int mIndex; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(Task, nsIRunnable) +NS_IMPL_ISUPPORTS1(Task, nsIRunnable) static nsresult RunTests() diff --git a/xpcom/tests/TestThreadPoolListener.cpp b/xpcom/tests/TestThreadPoolListener.cpp index 45e561a8733..6e914c824d3 100644 --- a/xpcom/tests/TestThreadPoolListener.cpp +++ b/xpcom/tests/TestThreadPoolListener.cpp @@ -48,11 +48,11 @@ static bool gAllThreadsShutDown = false; class Listener MOZ_FINAL : public nsIThreadPoolListener { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITHREADPOOLLISTENER }; -NS_IMPL_THREADSAFE_ISUPPORTS1(Listener, nsIThreadPoolListener) +NS_IMPL_ISUPPORTS1(Listener, nsIThreadPoolListener) NS_IMETHODIMP Listener::OnThreadCreated() diff --git a/xpcom/tests/TestThreads.cpp b/xpcom/tests/TestThreads.cpp index 1d8bea6c430..ea806e15cac 100644 --- a/xpcom/tests/TestThreads.cpp +++ b/xpcom/tests/TestThreads.cpp @@ -13,7 +13,7 @@ class nsRunner : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Run() { nsCOMPtr thread; @@ -38,7 +38,7 @@ protected: int mNum; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsRunner, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsRunner, nsIRunnable) nsresult TestThreads() @@ -75,7 +75,7 @@ TestThreads() class nsStressRunner : public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Run() { NS_ASSERTION(!mWasRun, "run twice!"); @@ -106,7 +106,7 @@ protected: int32_t nsStressRunner::gNum = 0; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsStressRunner, nsIRunnable) +NS_IMPL_ISUPPORTS1(nsStressRunner, nsIRunnable) static int Stress(int loops, int threads) { diff --git a/xpcom/tests/TestTimers.cpp b/xpcom/tests/TestTimers.cpp index 8b4ac25ce35..b9ffd1ea79d 100644 --- a/xpcom/tests/TestTimers.cpp +++ b/xpcom/tests/TestTimers.cpp @@ -72,7 +72,7 @@ private: class TimerCallback MOZ_FINAL : public nsITimerCallback { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS TimerCallback(nsIThread** aThreadPtr, ReentrantMonitor* aReentrantMonitor) : mThreadPtr(aThreadPtr), mReentrantMonitor(aReentrantMonitor) { } @@ -94,7 +94,7 @@ private: ReentrantMonitor* mReentrantMonitor; }; -NS_IMPL_THREADSAFE_ISUPPORTS1(TimerCallback, nsITimerCallback) +NS_IMPL_ISUPPORTS1(TimerCallback, nsITimerCallback) nsresult TestTargetedTimers() diff --git a/xpcom/threads/LazyIdleThread.cpp b/xpcom/threads/LazyIdleThread.cpp index 1ac0cacd42a..0cf14ad0acd 100644 --- a/xpcom/threads/LazyIdleThread.cpp +++ b/xpcom/threads/LazyIdleThread.cpp @@ -334,12 +334,12 @@ LazyIdleThread::SelfDestruct() delete this; } -NS_IMPL_THREADSAFE_ADDREF(LazyIdleThread) +NS_IMPL_ADDREF(LazyIdleThread) NS_IMETHODIMP_(nsrefcnt) LazyIdleThread::Release() { - nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); + nsrefcnt count = --mRefCnt; NS_LOG_RELEASE(this, count, "LazyIdleThread"); if (!count) { @@ -363,11 +363,11 @@ LazyIdleThread::Release() return count; } -NS_IMPL_THREADSAFE_QUERY_INTERFACE5(LazyIdleThread, nsIThread, - nsIEventTarget, - nsITimerCallback, - nsIThreadObserver, - nsIObserver) +NS_IMPL_QUERY_INTERFACE5(LazyIdleThread, nsIThread, + nsIEventTarget, + nsITimerCallback, + nsIThreadObserver, + nsIObserver) NS_IMETHODIMP LazyIdleThread::Dispatch(nsIRunnable* aEvent, diff --git a/xpcom/threads/LazyIdleThread.h b/xpcom/threads/LazyIdleThread.h index 1c8cf0aefc1..276a50a8955 100644 --- a/xpcom/threads/LazyIdleThread.h +++ b/xpcom/threads/LazyIdleThread.h @@ -38,7 +38,7 @@ class LazyIdleThread MOZ_FINAL : public nsIThread, public nsIObserver { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEVENTTARGET NS_DECL_NSITHREAD NS_DECL_NSITIMERCALLBACK diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp index f8a7cb7f7b2..9053f8f4118 100644 --- a/xpcom/threads/TimerThread.cpp +++ b/xpcom/threads/TimerThread.cpp @@ -17,7 +17,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS2(TimerThread, nsIRunnable, nsIObserver) +NS_IMPL_ISUPPORTS2(TimerThread, nsIRunnable, nsIObserver) TimerThread::TimerThread() : mInitInProgress(0), diff --git a/xpcom/threads/TimerThread.h b/xpcom/threads/TimerThread.h index 8cebe604577..a9699c29f3c 100644 --- a/xpcom/threads/TimerThread.h +++ b/xpcom/threads/TimerThread.h @@ -30,7 +30,7 @@ public: TimerThread(); NS_HIDDEN_(nsresult) InitLocks(); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIRUNNABLE NS_DECL_NSIOBSERVER diff --git a/xpcom/threads/nsEnvironment.cpp b/xpcom/threads/nsEnvironment.cpp index 01b20a0bb47..b619d70c6a3 100644 --- a/xpcom/threads/nsEnvironment.cpp +++ b/xpcom/threads/nsEnvironment.cpp @@ -14,7 +14,7 @@ using namespace mozilla; -NS_IMPL_THREADSAFE_ISUPPORTS1(nsEnvironment, nsIEnvironment) +NS_IMPL_ISUPPORTS1(nsEnvironment, nsIEnvironment) nsresult nsEnvironment::Create(nsISupports *aOuter, REFNSIID aIID, diff --git a/xpcom/threads/nsEnvironment.h b/xpcom/threads/nsEnvironment.h index a74ecbab7dc..bcc32d11fdd 100644 --- a/xpcom/threads/nsEnvironment.h +++ b/xpcom/threads/nsEnvironment.h @@ -18,7 +18,7 @@ class nsEnvironment MOZ_FINAL : public nsIEnvironment { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIENVIRONMENT static nsresult Create(nsISupports *aOuter, REFNSIID aIID, diff --git a/xpcom/threads/nsProcess.h b/xpcom/threads/nsProcess.h index 6d02dc59186..e25bf17f20d 100644 --- a/xpcom/threads/nsProcess.h +++ b/xpcom/threads/nsProcess.h @@ -36,7 +36,7 @@ class nsProcess MOZ_FINAL : public nsIProcess, { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIPROCESS NS_DECL_NSIOBSERVER diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index 828e0b6e0e6..ed6cb5106e0 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -59,8 +59,8 @@ cpu_type_t pref_cpu_types[2] = { //-------------------------------------------------------------------// // nsIProcess implementation //-------------------------------------------------------------------// -NS_IMPL_THREADSAFE_ISUPPORTS2(nsProcess, nsIProcess, - nsIObserver) +NS_IMPL_ISUPPORTS2(nsProcess, nsIProcess, + nsIObserver) //Constructor nsProcess::nsProcess() diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 19eba00b0c8..2b1d43b180d 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -130,8 +130,8 @@ nsThreadClassInfo::GetClassIDNoAlloc(nsCID *result) //----------------------------------------------------------------------------- -NS_IMPL_THREADSAFE_ADDREF(nsThread) -NS_IMPL_THREADSAFE_RELEASE(nsThread) +NS_IMPL_ADDREF(nsThread) +NS_IMPL_RELEASE(nsThread) NS_INTERFACE_MAP_BEGIN(nsThread) NS_INTERFACE_MAP_ENTRY(nsIThread) NS_INTERFACE_MAP_ENTRY(nsIThreadInternal) diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h index 497b829b607..0181c5acade 100644 --- a/xpcom/threads/nsThread.h +++ b/xpcom/threads/nsThread.h @@ -21,7 +21,7 @@ class nsThread MOZ_FINAL : public nsIThreadInternal, public nsISupportsPriority { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEVENTTARGET NS_DECL_NSITHREAD NS_DECL_NSITHREADINTERNAL diff --git a/xpcom/threads/nsThreadPool.cpp b/xpcom/threads/nsThreadPool.cpp index ee55af47c8b..281bd83072a 100644 --- a/xpcom/threads/nsThreadPool.cpp +++ b/xpcom/threads/nsThreadPool.cpp @@ -37,8 +37,8 @@ GetThreadPoolLog() #define DEFAULT_IDLE_THREAD_LIMIT 1 #define DEFAULT_IDLE_THREAD_TIMEOUT PR_SecondsToInterval(60) -NS_IMPL_THREADSAFE_ADDREF(nsThreadPool) -NS_IMPL_THREADSAFE_RELEASE(nsThreadPool) +NS_IMPL_ADDREF(nsThreadPool) +NS_IMPL_RELEASE(nsThreadPool) NS_IMPL_CLASSINFO(nsThreadPool, NULL, nsIClassInfo::THREADSAFE, NS_THREADPOOL_CID) NS_IMPL_QUERY_INTERFACE3_CI(nsThreadPool, nsIThreadPool, nsIEventTarget, diff --git a/xpcom/threads/nsThreadPool.h b/xpcom/threads/nsThreadPool.h index 729b4769785..37f9b61b7b0 100644 --- a/xpcom/threads/nsThreadPool.h +++ b/xpcom/threads/nsThreadPool.h @@ -20,7 +20,7 @@ class nsThreadPool MOZ_FINAL : public nsIThreadPool, public nsIRunnable { public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIEVENTTARGET NS_DECL_NSITHREADPOOL NS_DECL_NSIRUNNABLE diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp index fd4b39114c2..71ed49b7162 100644 --- a/xpcom/threads/nsTimerImpl.cpp +++ b/xpcom/threads/nsTimerImpl.cpp @@ -188,15 +188,15 @@ void TimerEventAllocator::Free(void* aPtr) } // anonymous namespace -NS_IMPL_THREADSAFE_QUERY_INTERFACE1(nsTimerImpl, nsITimer) -NS_IMPL_THREADSAFE_ADDREF(nsTimerImpl) +NS_IMPL_QUERY_INTERFACE1(nsTimerImpl, nsITimer) +NS_IMPL_ADDREF(nsTimerImpl) NS_IMETHODIMP_(nsrefcnt) nsTimerImpl::Release(void) { nsrefcnt count; MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); - count = NS_AtomicDecrementRefcnt(mRefCnt); + count = --mRefCnt; NS_LOG_RELEASE(this, count, "nsTimerImpl"); if (count == 0) { mRefCnt = 1; /* stabilize */ diff --git a/xpcom/threads/nsTimerImpl.h b/xpcom/threads/nsTimerImpl.h index c318cf10620..470fd8fc535 100644 --- a/xpcom/threads/nsTimerImpl.h +++ b/xpcom/threads/nsTimerImpl.h @@ -57,7 +57,7 @@ public: nsresult PostTimerEvent(); void SetDelayInternal(uint32_t aDelay); - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSITIMER int32_t GetGeneration() { return mGeneration; } From 60759297eebf14855c207630a2b0ff5f737c7ad3 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 18 Jul 2013 21:31:36 -0500 Subject: [PATCH 48/69] Bug 884061 - Part 3z: Use NS_DECL_THREADSAFE_ISUPPORTS in xpfe/, r=Neil --HG-- extra : rebase_source : a1e6681133934750015ec03c0f6a70122ec74b19 --- xpfe/appshell/src/nsWebShellWindow.cpp | 7 ++----- xpfe/appshell/src/nsXULWindow.cpp | 4 ++-- xpfe/appshell/src/nsXULWindow.h | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/xpfe/appshell/src/nsWebShellWindow.cpp b/xpfe/appshell/src/nsWebShellWindow.cpp index 2859ad54c69..f3f325b09f5 100644 --- a/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/xpfe/appshell/src/nsWebShellWindow.cpp @@ -453,7 +453,7 @@ public: : mWindow(aWindow) {} - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_IMETHOD Notify(nsITimer* aTimer) { @@ -469,10 +469,7 @@ private: nsRefPtr mWindow; }; -NS_IMPL_THREADSAFE_ADDREF(WebShellWindowTimerCallback) -NS_IMPL_THREADSAFE_RELEASE(WebShellWindowTimerCallback) -NS_IMPL_THREADSAFE_QUERY_INTERFACE1(WebShellWindowTimerCallback, - nsITimerCallback) +NS_IMPL_ISUPPORTS1(WebShellWindowTimerCallback, nsITimerCallback) } // namespace mozilla diff --git a/xpfe/appshell/src/nsXULWindow.cpp b/xpfe/appshell/src/nsXULWindow.cpp index 77a0260ff6c..5100ec58618 100644 --- a/xpfe/appshell/src/nsXULWindow.cpp +++ b/xpfe/appshell/src/nsXULWindow.cpp @@ -116,8 +116,8 @@ nsXULWindow::~nsXULWindow() // nsXULWindow::nsISupports //***************************************************************************** -NS_IMPL_THREADSAFE_ADDREF(nsXULWindow) -NS_IMPL_THREADSAFE_RELEASE(nsXULWindow) +NS_IMPL_ADDREF(nsXULWindow) +NS_IMPL_RELEASE(nsXULWindow) NS_INTERFACE_MAP_BEGIN(nsXULWindow) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXULWindow) diff --git a/xpfe/appshell/src/nsXULWindow.h b/xpfe/appshell/src/nsXULWindow.h index 08b6e5bd168..30ba7170937 100644 --- a/xpfe/appshell/src/nsXULWindow.h +++ b/xpfe/appshell/src/nsXULWindow.h @@ -59,7 +59,7 @@ friend class nsChromeTreeOwner; friend class nsContentTreeOwner; public: - NS_DECL_ISUPPORTS + NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIXULWINDOW From 7b9a04da79626c4f184ed25814866eb3b26b47a0 Mon Sep 17 00:00:00 2001 From: Joshua Cranmer Date: Thu, 11 Jul 2013 15:21:45 -0500 Subject: [PATCH 49/69] Bug 884061 - Part 4: Remove nsAtomicRefcnt.h, r=jlebar --HG-- extra : rebase_source : ce24ab345baa48104328e3c101b7266a31e81870 --- caps/src/nsNullPrincipal.cpp | 1 + caps/src/nsPrincipal.cpp | 1 + caps/src/nsSystemPrincipal.cpp | 1 + dom/indexedDB/FileInfo.h | 1 - dom/indexedDB/IndexedDatabaseManager.cpp | 1 + dom/plugins/base/nsNPAPIPlugin.cpp | 1 + dom/quota/QuotaManager.cpp | 1 + .../printingui/src/win/nsPrintProgress.cpp | 1 - gfx/2d/QuartzSupport.h | 1 + gfx/layers/ImageContainer.h | 1 + gfx/thebes/gfxTypes.h | 2 - image/src/DiscardTracker.cpp | 1 + image/src/DiscardTracker.h | 1 + intl/uconv/src/nsScriptableUConv.cpp | 2 +- ipc/chromium/src/base/message_loop.cc | 1 + js/xpconnect/src/XPCWrappedJS.cpp | 1 - js/xpconnect/src/XPCWrappedNativeProto.cpp | 1 + netwerk/base/src/nsLoadGroup.cpp | 1 + netwerk/base/src/nsSocketTransport2.cpp | 1 - netwerk/dns/nsHostResolver.h | 1 - netwerk/protocol/http/nsHttpTransaction.cpp | 1 - .../protocol/websocket/WebSocketChannel.cpp | 1 + .../nsUrlClassifierDBService.cpp | 1 + widget/cocoa/nsAppShell.mm | 1 + widget/xpwidgets/nsBaseAppShell.cpp | 1 + xpcom/base/Makefile.in | 1 - xpcom/base/moz.build | 1 - xpcom/base/nsAtomicRefcnt.h | 67 -------- xpcom/base/nsExceptionService.cpp | 1 + xpcom/base/nsMemoryInfoDumper.cpp | 1 + xpcom/ds/nsHashtable.cpp | 1 + xpcom/glue/nsISupportsImpl.h | 150 ------------------ xpcom/io/nsPipe3.cpp | 1 - .../reflect/xptinfo/src/xptiInterfaceInfo.cpp | 1 - xpcom/tests/TestRacingServiceManager.cpp | 1 + xpcom/threads/nsThread.cpp | 1 + xpcom/threads/nsTimerImpl.cpp | 1 + 37 files changed, 24 insertions(+), 230 deletions(-) delete mode 100644 xpcom/base/nsAtomicRefcnt.h diff --git a/caps/src/nsNullPrincipal.cpp b/caps/src/nsNullPrincipal.cpp index 1f12e944cac..00bb46a45c2 100644 --- a/caps/src/nsNullPrincipal.cpp +++ b/caps/src/nsNullPrincipal.cpp @@ -22,6 +22,7 @@ #include "nsError.h" #include "nsIScriptSecurityManager.h" #include "nsScriptSecurityManager.h" +#include "pratom.h" using namespace mozilla; diff --git a/caps/src/nsPrincipal.cpp b/caps/src/nsPrincipal.cpp index fd06eaac520..be7449fff44 100644 --- a/caps/src/nsPrincipal.cpp +++ b/caps/src/nsPrincipal.cpp @@ -10,6 +10,7 @@ #include "nsString.h" #include "nsReadableUtils.h" #include "plstr.h" +#include "pratom.h" #include "nsCRT.h" #include "nsIURI.h" #include "nsIFileURL.h" diff --git a/caps/src/nsSystemPrincipal.cpp b/caps/src/nsSystemPrincipal.cpp index f757c10cc8c..c280ba7f6e7 100644 --- a/caps/src/nsSystemPrincipal.cpp +++ b/caps/src/nsSystemPrincipal.cpp @@ -17,6 +17,7 @@ #include "nsString.h" #include "nsIClassInfoImpl.h" #include "nsIScriptSecurityManager.h" +#include "pratom.h" NS_IMPL_CLASSINFO(nsSystemPrincipal, nullptr, nsIClassInfo::SINGLETON | nsIClassInfo::MAIN_THREAD_ONLY, diff --git a/dom/indexedDB/FileInfo.h b/dom/indexedDB/FileInfo.h index 120e40ec856..e79e763260a 100644 --- a/dom/indexedDB/FileInfo.h +++ b/dom/indexedDB/FileInfo.h @@ -9,7 +9,6 @@ #include "IndexedDatabase.h" -#include "nsAtomicRefcnt.h" #include "nsThreadUtils.h" #include "FileManager.h" diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index 02755fa3892..163491b7b4f 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -24,6 +24,7 @@ #include "nsContentUtils.h" #include "nsEventDispatcher.h" #include "nsThreadUtils.h" +#include "pratom.h" #include "IDBEvents.h" #include "IDBFactory.h" diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 99e8e4e9030..89b557465d4 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -8,6 +8,7 @@ /* This must occur *after* layers/PLayerTransaction.h to avoid typedefs conflicts. */ #include "mozilla/Util.h" +#include "pratom.h" #include "prmem.h" #include "prenv.h" #include "prclist.h" diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index bdc5cf32e32..cbc742e1c43 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -36,6 +36,7 @@ #include "nsScriptSecurityManager.h" #include "nsThreadUtils.h" #include "nsXULAppAPI.h" +#include "pratom.h" #include "xpcpublic.h" #include "AcquireListener.h" diff --git a/embedding/components/printingui/src/win/nsPrintProgress.cpp b/embedding/components/printingui/src/win/nsPrintProgress.cpp index 9cea6dcff65..4785861bd97 100644 --- a/embedding/components/printingui/src/win/nsPrintProgress.cpp +++ b/embedding/components/printingui/src/win/nsPrintProgress.cpp @@ -11,7 +11,6 @@ #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" -#include "nsAtomicRefcnt.h" #if 0 NS_IMPL_ADDREF(nsPrintProgress) diff --git a/gfx/2d/QuartzSupport.h b/gfx/2d/QuartzSupport.h index 167e1643a80..25ecb7027e8 100644 --- a/gfx/2d/QuartzSupport.h +++ b/gfx/2d/QuartzSupport.h @@ -13,6 +13,7 @@ #include "gfxTypes.h" #include "mozilla/RefPtr.h" #include "mozilla/gfx/MacIOSurface.h" +#include "nsError.h" // Get the system color space. CGColorSpaceRef CreateSystemColorSpace(); diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index 6702e3ebfcc..485553210bc 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -13,6 +13,7 @@ #include "mozilla/TimeStamp.h" #include "ImageTypes.h" #include "nsTArray.h" +#include "pratom.h" #ifdef XP_WIN struct ID3D10Texture2D; diff --git a/gfx/thebes/gfxTypes.h b/gfx/thebes/gfxTypes.h index bc4c8c20385..c75ee4d432c 100644 --- a/gfx/thebes/gfxTypes.h +++ b/gfx/thebes/gfxTypes.h @@ -6,8 +6,6 @@ #ifndef GFX_TYPES_H #define GFX_TYPES_H -#include "nsAtomicRefcnt.h" - /** * Currently needs to be 'double' for Cairo compatibility. Could * become 'float', perhaps, in some configurations. diff --git a/image/src/DiscardTracker.cpp b/image/src/DiscardTracker.cpp index 73674b471fe..503136d2eb4 100644 --- a/image/src/DiscardTracker.cpp +++ b/image/src/DiscardTracker.cpp @@ -8,6 +8,7 @@ #include "RasterImage.h" #include "DiscardTracker.h" #include "mozilla/Preferences.h" +#include "pratom.h" namespace mozilla { namespace image { diff --git a/image/src/DiscardTracker.h b/image/src/DiscardTracker.h index b0aa16a8730..e5092fd2e75 100644 --- a/image/src/DiscardTracker.h +++ b/image/src/DiscardTracker.h @@ -8,6 +8,7 @@ #include "mozilla/LinkedList.h" #include "mozilla/TimeStamp.h" +#include "prlock.h" class nsITimer; diff --git a/intl/uconv/src/nsScriptableUConv.cpp b/intl/uconv/src/nsScriptableUConv.cpp index 1dcc0c12878..d40cda8dda1 100644 --- a/intl/uconv/src/nsScriptableUConv.cpp +++ b/intl/uconv/src/nsScriptableUConv.cpp @@ -3,7 +3,6 @@ * 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/. */ -#include "nsAtomicRefcnt.h" #include "nsString.h" #include "nsReadableUtils.h" #include "nsIServiceManager.h" @@ -14,6 +13,7 @@ #include "nsCRT.h" #include "nsComponentManagerUtils.h" #include "nsCharsetAlias.h" +#include "pratom.h" static int32_t gInstanceCount = 0; diff --git a/ipc/chromium/src/base/message_loop.cc b/ipc/chromium/src/base/message_loop.cc index 91788671770..0c331104cfe 100644 --- a/ipc/chromium/src/base/message_loop.cc +++ b/ipc/chromium/src/base/message_loop.cc @@ -32,6 +32,7 @@ #endif #include "MessagePump.h" +#include "pratom.h" using base::Time; using base::TimeDelta; diff --git a/js/xpconnect/src/XPCWrappedJS.cpp b/js/xpconnect/src/XPCWrappedJS.cpp index 51baf3ba2db..d0156a94388 100644 --- a/js/xpconnect/src/XPCWrappedJS.cpp +++ b/js/xpconnect/src/XPCWrappedJS.cpp @@ -8,7 +8,6 @@ #include "xpcprivate.h" #include "nsCxPusher.h" -#include "nsAtomicRefcnt.h" #include "nsContentUtils.h" #include "nsProxyRelease.h" #include "nsThreadUtils.h" diff --git a/js/xpconnect/src/XPCWrappedNativeProto.cpp b/js/xpconnect/src/XPCWrappedNativeProto.cpp index ed92603f0ee..bb89b148bcc 100644 --- a/js/xpconnect/src/XPCWrappedNativeProto.cpp +++ b/js/xpconnect/src/XPCWrappedNativeProto.cpp @@ -8,6 +8,7 @@ #include "xpcprivate.h" #include "nsCxPusher.h" +#include "pratom.h" using namespace mozilla; diff --git a/netwerk/base/src/nsLoadGroup.cpp b/netwerk/base/src/nsLoadGroup.cpp index e360293089f..88566afdd79 100644 --- a/netwerk/base/src/nsLoadGroup.cpp +++ b/netwerk/base/src/nsLoadGroup.cpp @@ -14,6 +14,7 @@ #include "nsIServiceManager.h" #include "nsCOMPtr.h" #include "nsIURI.h" +#include "pratom.h" #include "prlog.h" #include "nsCRT.h" #include "netCore.h" diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp index 7ee6f2974d1..3bb93500222 100644 --- a/netwerk/base/src/nsSocketTransport2.cpp +++ b/netwerk/base/src/nsSocketTransport2.cpp @@ -10,7 +10,6 @@ #include "nsSocketTransport2.h" #include "mozilla/Attributes.h" -#include "nsAtomicRefcnt.h" #include "nsIOService.h" #include "nsStreamUtils.h" #include "nsNetSegmentUtils.h" diff --git a/netwerk/dns/nsHostResolver.h b/netwerk/dns/nsHostResolver.h index ce0b488705e..158c1e65fa2 100644 --- a/netwerk/dns/nsHostResolver.h +++ b/netwerk/dns/nsHostResolver.h @@ -7,7 +7,6 @@ #define nsHostResolver_h__ #include "nscore.h" -#include "nsAtomicRefcnt.h" #include "prclist.h" #include "prnetdb.h" #include "pldhash.h" diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index 44e880fc8f5..2f0519e9be2 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -20,7 +20,6 @@ #include "nsNetUtil.h" #include "nsProxyRelease.h" #include "nsIOService.h" -#include "nsAtomicRefcnt.h" #include "nsISeekableStream.h" #include "nsISocketTransport.h" diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index a5b6f31fafd..8f13b5972ce 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -40,6 +40,7 @@ #include "mozilla/Telemetry.h" #include "plbase64.h" +#include "pratom.h" #include "prmem.h" #include "prnetdb.h" #include "prbit.h" diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index c52fea85f32..e5786b232c9 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -34,6 +34,7 @@ #include "mozilla/Mutex.h" #include "mozilla/TimeStamp.h" #include "mozilla/Telemetry.h" +#include "pratom.h" #include "prlog.h" #include "prprf.h" #include "prnetdb.h" diff --git a/widget/cocoa/nsAppShell.mm b/widget/cocoa/nsAppShell.mm index ee745573b4c..2c5116000cf 100644 --- a/widget/cocoa/nsAppShell.mm +++ b/widget/cocoa/nsAppShell.mm @@ -33,6 +33,7 @@ #include "TextInputHandler.h" #include "mozilla/HangMonitor.h" #include "GeckoProfiler.h" +#include "pratom.h" #include "npapi.h" diff --git a/widget/xpwidgets/nsBaseAppShell.cpp b/widget/xpwidgets/nsBaseAppShell.cpp index 488720e88b5..484c2ef466d 100644 --- a/widget/xpwidgets/nsBaseAppShell.cpp +++ b/widget/xpwidgets/nsBaseAppShell.cpp @@ -9,6 +9,7 @@ #include "nsThreadUtils.h" #include "nsIObserverService.h" #include "nsServiceManagerUtils.h" +#include "pratom.h" #include "mozilla/Services.h" // When processing the next thread event, the appshell may process native diff --git a/xpcom/base/Makefile.in b/xpcom/base/Makefile.in index feb759035ca..e18cc0c03a4 100644 --- a/xpcom/base/Makefile.in +++ b/xpcom/base/Makefile.in @@ -35,7 +35,6 @@ DISABLED_SDK_HEADERS = \ ErrorListCDefines.h \ nsISupportsBase.h \ nscore.h \ - nsAtomicRefcnt.h \ nsCycleCollector.h \ nsObjCExceptions.h \ diff --git a/xpcom/base/moz.build b/xpcom/base/moz.build index 0f61a5a0c65..1c643548058 100644 --- a/xpcom/base/moz.build +++ b/xpcom/base/moz.build @@ -45,7 +45,6 @@ EXPORTS += [ 'ErrorListCDefines.h', 'ErrorListCxxDefines.h', 'nsAgg.h', - 'nsAtomicRefcnt.h', 'nsAutoPtr.h', 'nsAutoRef.h', 'nsCom.h', diff --git a/xpcom/base/nsAtomicRefcnt.h b/xpcom/base/nsAtomicRefcnt.h deleted file mode 100644 index fc3eadaae66..00000000000 --- a/xpcom/base/nsAtomicRefcnt.h +++ /dev/null @@ -1,67 +0,0 @@ -/* 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/. */ - -#ifndef nsAtomicRefcnt_h__ -#define nsAtomicRefcnt_h__ - -#include "nscore.h" -#include "pratom.h" - -class nsAutoRefCnt; - -// This header defines functions for modifying refcounts which wrap the -// PR_ATOMIC_* macros. - -#if defined(XP_WIN) - -#if PR_BYTES_PER_LONG == 4 -typedef volatile long nsAtomicRefcnt; -#else -#error "Windows should have 4 bytes per long." -#endif - -#else /* !defined(XP_WIN) */ - -typedef int32_t nsAtomicRefcnt; - -#endif - -inline int32_t -NS_AtomicIncrementRefcnt(int32_t &refcnt) -{ - return PR_ATOMIC_INCREMENT(&refcnt); -} - -inline nsrefcnt -NS_AtomicIncrementRefcnt(nsrefcnt &refcnt) -{ - return (nsrefcnt) PR_ATOMIC_INCREMENT((nsAtomicRefcnt*)&refcnt); -} - -inline nsrefcnt -NS_AtomicIncrementRefcnt(nsAutoRefCnt &refcnt) -{ - // This cast is safe since nsAtomicRefCnt contains just one member, its refcount. - return (nsrefcnt) PR_ATOMIC_INCREMENT((nsAtomicRefcnt*)&refcnt); -} - -inline nsrefcnt -NS_AtomicDecrementRefcnt(nsrefcnt &refcnt) -{ - return (nsrefcnt) PR_ATOMIC_DECREMENT((nsAtomicRefcnt*)&refcnt); -} - -inline nsrefcnt -NS_AtomicDecrementRefcnt(nsAutoRefCnt &refcnt) -{ - return (nsrefcnt) PR_ATOMIC_DECREMENT((nsAtomicRefcnt*)&refcnt); -} - -inline int32_t -NS_AtomicDecrementRefcnt(int32_t &refcnt) -{ - return PR_ATOMIC_DECREMENT(&refcnt); -} - -#endif diff --git a/xpcom/base/nsExceptionService.cpp b/xpcom/base/nsExceptionService.cpp index 7c4cf4e2dd9..ab3cf4d66b8 100644 --- a/xpcom/base/nsExceptionService.cpp +++ b/xpcom/base/nsExceptionService.cpp @@ -10,6 +10,7 @@ #include "nsExceptionService.h" #include "nsIServiceManager.h" #include "nsCOMPtr.h" +#include "pratom.h" #include "prthread.h" #include "mozilla/Services.h" diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 7c2a6be0ca6..417e28b05ab 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -19,6 +19,7 @@ #include "nsGZFileWriter.h" #include "nsJSEnvironment.h" #include "nsPrintfCString.h" +#include "pratom.h" #ifdef XP_WIN #include diff --git a/xpcom/ds/nsHashtable.cpp b/xpcom/ds/nsHashtable.cpp index 5c5accd1e95..ca1becb7dd7 100644 --- a/xpcom/ds/nsHashtable.cpp +++ b/xpcom/ds/nsHashtable.cpp @@ -15,6 +15,7 @@ */ #include +#include "pratom.h" #include "prlog.h" #include "nsHashtable.h" #include "nsReadableUtils.h" diff --git a/xpcom/glue/nsISupportsImpl.h b/xpcom/glue/nsISupportsImpl.h index baddfab7208..1a2c91807e7 100644 --- a/xpcom/glue/nsISupportsImpl.h +++ b/xpcom/glue/nsISupportsImpl.h @@ -22,7 +22,6 @@ #if !defined(XPCOM_GLUE_AVOID_NSPR) #include "prthread.h" /* needed for thread-safety checks */ -#include "nsAtomicRefcnt.h" /* for NS_Atomic{Increment,Decrement}Refcnt */ #ifdef DEBUG #include "nsCycleCollectorUtils.h" /* for NS_IsCycleCollectorThread */ #endif // DEBUG @@ -235,19 +234,6 @@ class ThreadSafeAutoRefCnt { Atomic mValue; }; } - -// Temporary declarations until NS_IMPL_THREADSAFE_ADDREF/RELEASE are deleted. -inline nsrefcnt -NS_AtomicIncrementRefcnt(mozilla::ThreadSafeAutoRefCnt &refcnt) -{ - return ++refcnt; -} - -inline nsrefcnt -NS_AtomicDecrementRefcnt(mozilla::ThreadSafeAutoRefCnt &refcnt) -{ - return --refcnt; -} #endif /////////////////////////////////////////////////////////////////////////////// @@ -979,19 +965,6 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_INTERFACE_TABLE_TAIL -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE0 NS_IMPL_QUERY_INTERFACE0 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE1 NS_IMPL_QUERY_INTERFACE1 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE2 NS_IMPL_QUERY_INTERFACE2 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE3 NS_IMPL_QUERY_INTERFACE3 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE4 NS_IMPL_QUERY_INTERFACE4 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE5 NS_IMPL_QUERY_INTERFACE5 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE6 NS_IMPL_QUERY_INTERFACE6 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE7 NS_IMPL_QUERY_INTERFACE7 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE8 NS_IMPL_QUERY_INTERFACE8 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE9 NS_IMPL_QUERY_INTERFACE9 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE10 NS_IMPL_QUERY_INTERFACE10 -#define NS_IMPL_THREADSAFE_QUERY_INTERFACE11 NS_IMPL_QUERY_INTERFACE11 - /** * Declare that you're going to inherit from something that already * implements nsISupports, but also implements an additional interface, thus @@ -1386,129 +1359,6 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ * @note These are not available when linking against the standalone glue, * because the implementation requires PR_ symbols. */ - -#if !defined(XPCOM_GLUE_AVOID_NSPR) - -/** - * Use this macro to implement the AddRef method for a given _class - * @param _class The name of the class implementing the method - */ - -#define NS_IMPL_THREADSAFE_ADDREF(_class) \ -NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ -{ \ - MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); \ - nsrefcnt count = NS_AtomicIncrementRefcnt(mRefCnt); \ - NS_LOG_ADDREF(this, count, #_class, sizeof(*this)); \ - return (nsrefcnt) count; \ -} - -/** - * Use this macro to implement the Release method for a given _class - * @param _class The name of the class implementing the method - * - * Note that we don't need to use an atomic operation to stabilize the refcnt. - * If the refcnt is released to 0, only the current thread has a reference to - * the object; we thus don't have to use an atomic set to inform other threads - * that we've changed the refcnt. - */ - -#define NS_IMPL_THREADSAFE_RELEASE(_class) \ -NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ -{ \ - MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); \ - nsrefcnt count = NS_AtomicDecrementRefcnt(mRefCnt); \ - NS_LOG_RELEASE(this, count, #_class); \ - if (0 == count) { \ - mRefCnt = 1; /* stabilize */ \ - /* enable this to find non-threadsafe destructors: */ \ - /* NS_ASSERT_OWNINGTHREAD(_class); */ \ - delete (this); \ - return 0; \ - } \ - return count; \ -} - -#else // XPCOM_GLUE_AVOID_NSPR - -#define NS_IMPL_THREADSAFE_ADDREF(_class) \ - THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE; - -#define NS_IMPL_THREADSAFE_RELEASE(_class) \ - THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE; - -#endif - -#define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE0(_class) - -#define NS_IMPL_THREADSAFE_ISUPPORTS1(_class, _interface) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE1(_class, _interface) - -#define NS_IMPL_THREADSAFE_ISUPPORTS2(_class, _i1, _i2) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE2(_class, _i1, _i2) - -#define NS_IMPL_THREADSAFE_ISUPPORTS3(_class, _i1, _i2, _i3) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE3(_class, _i1, _i2, _i3) - -#define NS_IMPL_THREADSAFE_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) - -#define NS_IMPL_THREADSAFE_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) - -#define NS_IMPL_THREADSAFE_ISUPPORTS6(_class, _i1, _i2, _i3, _i4, _i5, _i6) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE6(_class, _i1, _i2, _i3, _i4, _i5, _i6) - -#define NS_IMPL_THREADSAFE_ISUPPORTS7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE7(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7) - -#define NS_IMPL_THREADSAFE_ISUPPORTS8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE8(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8) - -#define NS_IMPL_THREADSAFE_ISUPPORTS9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8, _i9) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE9(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8, _i9) - -#define NS_IMPL_THREADSAFE_ISUPPORTS10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8, _i9, _i10) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8, _i9, _i10) - -#define NS_IMPL_THREADSAFE_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8, _i9, _i10, _i11) \ - NS_IMPL_THREADSAFE_ADDREF(_class) \ - NS_IMPL_THREADSAFE_RELEASE(_class) \ - NS_IMPL_THREADSAFE_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \ - _i7, _i8, _i9, _i10, _i11) - #define NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_QUERY_TAIL_GUTS /** diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index 3f5da8c9887..eaec4e82d7a 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -14,7 +14,6 @@ #include "nsCRT.h" #include "prlog.h" #include "nsIClassInfoImpl.h" -#include "nsAtomicRefcnt.h" #include "nsAlgorithm.h" using namespace mozilla; diff --git a/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp b/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp index 9d9ab3a7c4c..0e7842ac8d0 100644 --- a/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp +++ b/xpcom/reflect/xptinfo/src/xptiInterfaceInfo.cpp @@ -7,7 +7,6 @@ #include "xptiprivate.h" #include "mozilla/XPTInterfaceInfoManager.h" -#include "nsAtomicRefcnt.h" using namespace mozilla; diff --git a/xpcom/tests/TestRacingServiceManager.cpp b/xpcom/tests/TestRacingServiceManager.cpp index e61eb8c6cab..5c8d5720ddf 100644 --- a/xpcom/tests/TestRacingServiceManager.cpp +++ b/xpcom/tests/TestRacingServiceManager.cpp @@ -14,6 +14,7 @@ #include "nsAutoPtr.h" #include "nsThreadUtils.h" #include "nsXPCOMCIDInternal.h" +#include "pratom.h" #include "prmon.h" #include "mozilla/Attributes.h" diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 2b1d43b180d..ec905a71b89 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -12,6 +12,7 @@ #include "nsIProgrammingLanguage.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" +#include "pratom.h" #include "prlog.h" #include "nsIObserverService.h" #include "mozilla/HangMonitor.h" diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp index 71ed49b7162..634b5fc8dbd 100644 --- a/xpcom/threads/nsTimerImpl.cpp +++ b/xpcom/threads/nsTimerImpl.cpp @@ -10,6 +10,7 @@ #include "nsThreadManager.h" #include "nsThreadUtils.h" #include "plarena.h" +#include "pratom.h" #include "GeckoProfiler.h" using mozilla::TimeDuration; From c3d0e79b5c704b5bd319b8eb6b6c9ca521a08a4c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 22 Jul 2013 08:15:43 -0400 Subject: [PATCH 50/69] Bug 895009. Don't pass in NonNull/OwningNonNull arguments to WebIDL binding consumers. r=peterv --- content/canvas/src/WebGLContext.h | 11 +++++---- dom/bindings/BindingUtils.h | 31 +++++++++++++++++++++++++ dom/bindings/Codegen.py | 5 ++++ dom/bindings/test/TestBindingHeader.h | 26 +++++++++++++++++---- dom/bindings/test/TestCodeGen.webidl | 12 ---------- dom/bindings/test/TestExampleGen.webidl | 12 ---------- dom/bindings/test/TestJSImplGen.webidl | 11 --------- dom/indexedDB/IDBEvents.h | 2 +- dom/indexedDB/IDBFactory.cpp | 4 ++-- dom/indexedDB/IDBFactory.h | 8 +++---- 10 files changed, 72 insertions(+), 50 deletions(-) diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index 6b5edfd30c4..f7900d795f9 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -522,7 +522,8 @@ public: template void TexImage2D(WebGLenum target, WebGLint level, WebGLenum internalformat, WebGLenum format, WebGLenum type, - const ElementType& elt, ErrorResult& rv) { + ElementType& elt, ErrorResult& rv) + { if (!IsContextStable()) return; nsRefPtr isurf; @@ -559,7 +560,8 @@ public: template void TexSubImage2D(WebGLenum target, WebGLint level, WebGLint xoffset, WebGLint yoffset, WebGLenum format, - WebGLenum type, const ElementType& elt, ErrorResult& rv) { + WebGLenum type, ElementType& elt, ErrorResult& rv) + { if (!IsContextStable()) return; nsRefPtr isurf; @@ -976,8 +978,9 @@ protected: return nsLayoutUtils::SurfaceFromElement(aElement, flags); } template - nsLayoutUtils::SurfaceFromElementResult SurfaceFromElement(const dom::NonNull& aElement) { - return SurfaceFromElement(aElement.get()); + nsLayoutUtils::SurfaceFromElementResult SurfaceFromElement(ElementType& aElement) + { + return SurfaceFromElement(&aElement); } nsresult SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromElementResult& res, diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 98681beed0f..dcfe7a1c83f 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -2021,6 +2021,37 @@ const T& Constify(T& arg) return arg; } +// Helper for turning (Owning)NonNull into T& +template +T& NonNullHelper(T& aArg) +{ + return aArg; +} + +template +T& NonNullHelper(NonNull& aArg) +{ + return aArg; +} + +template +const T& NonNullHelper(const NonNull& aArg) +{ + return aArg; +} + +template +T& NonNullHelper(OwningNonNull& aArg) +{ + return aArg; +} + +template +const T& NonNullHelper(const OwningNonNull& aArg) +{ + return aArg; +} + // Reparent the wrapper of aObj to whatever its native now thinks its // parent should be. nsresult diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 15bd23c2d85..cb071202661 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -4426,6 +4426,11 @@ class CGCallGenerator(CGThing): return False if needsConst(a): arg = CGWrapper(arg, pre="Constify(", post=")") + # And convert NonNull to T& + if (((a.type.isInterface() or a.type.isCallback()) and + not a.type.nullable()) or + a.type.isDOMString()): + arg = CGWrapper(arg, pre="NonNullHelper(", post=")") args.append(arg) # Return values that go in outparams go here diff --git a/dom/bindings/test/TestBindingHeader.h b/dom/bindings/test/TestBindingHeader.h index 9872c62a823..8973bf41bb0 100644 --- a/dom/bindings/test/TestBindingHeader.h +++ b/dom/bindings/test/TestBindingHeader.h @@ -275,7 +275,6 @@ public: TestInterface* ReceiveWeakSelf(); TestInterface* ReceiveWeakNullableSelf(); void PassSelf(TestInterface&); - void PassSelf2(NonNull&); void PassNullableSelf(TestInterface*); already_AddRefed NonNullSelf(); void SetNonNullSelf(TestInterface&); @@ -297,7 +296,6 @@ public: IndirectlyImplementedInterface* ReceiveWeakOther(); IndirectlyImplementedInterface* ReceiveWeakNullableOther(); void PassOther(IndirectlyImplementedInterface&); - void PassOther2(NonNull&); void PassNullableOther(IndirectlyImplementedInterface*); already_AddRefed NonNullOther(); void SetNonNullOther(IndirectlyImplementedInterface&); @@ -312,7 +310,6 @@ public: TestExternalInterface* ReceiveWeakExternal(); TestExternalInterface* ReceiveWeakNullableExternal(); void PassExternal(TestExternalInterface*); - void PassExternal2(TestExternalInterface*); void PassNullableExternal(TestExternalInterface*); already_AddRefed NonNullExternal(); void SetNonNullExternal(TestExternalInterface*); @@ -327,7 +324,6 @@ public: TestCallbackInterface* ReceiveWeakCallbackInterface(); TestCallbackInterface* ReceiveWeakNullableCallbackInterface(); void PassCallbackInterface(TestCallbackInterface&); - void PassCallbackInterface2(OwningNonNull); void PassNullableCallbackInterface(TestCallbackInterface*); already_AddRefed NonNullCallbackInterface(); void SetNonNullCallbackInterface(TestCallbackInterface&); @@ -808,6 +804,28 @@ private: void PassVariadicAny(JSContext*, Sequence&) MOZ_DELETE; void PassVariadicObject(JSContext*, Sequence&) MOZ_DELETE; void PassVariadicNullableObject(JSContext*, Sequence&) MOZ_DELETE; + + // Ensure NonNull does not leak in + void PassSelf(NonNull&) MOZ_DELETE; + void PassSelf(OwningNonNull&) MOZ_DELETE; + void PassSelf(const NonNull&) MOZ_DELETE; + void PassSelf(const OwningNonNull&) MOZ_DELETE; + void PassOther(NonNull&) MOZ_DELETE; + void PassOther(const NonNull&) MOZ_DELETE; + void PassOther(OwningNonNull&) MOZ_DELETE; + void PassOther(const OwningNonNull&) MOZ_DELETE; + void PassCallbackInterface(OwningNonNull&) MOZ_DELETE; + void PassCallbackInterface(const OwningNonNull&) MOZ_DELETE; + void PassCallbackInterface(NonNull&) MOZ_DELETE; + void PassCallbackInterface(const NonNull&) MOZ_DELETE; + void PassCallback(OwningNonNull&) MOZ_DELETE; + void PassCallback(const OwningNonNull&) MOZ_DELETE; + void PassCallback(NonNull&) MOZ_DELETE; + void PassCallback(const NonNull&) MOZ_DELETE; + void PassString(const NonNull&) MOZ_DELETE; + void PassString(NonNull&) MOZ_DELETE; + void PassString(const OwningNonNull&) MOZ_DELETE; + void PassString(OwningNonNull&) MOZ_DELETE; }; class TestIndexedGetterInterface : public nsISupports, diff --git a/dom/bindings/test/TestCodeGen.webidl b/dom/bindings/test/TestCodeGen.webidl index c98a00dccb0..d56054a3597 100644 --- a/dom/bindings/test/TestCodeGen.webidl +++ b/dom/bindings/test/TestCodeGen.webidl @@ -223,10 +223,7 @@ interface TestInterface { TestInterface? receiveNullableSelf(); TestInterface receiveWeakSelf(); TestInterface? receiveWeakNullableSelf(); - // A verstion to test for casting to TestInterface& void passSelf(TestInterface arg); - // A version we can use to test for the exact type passed in - void passSelf2(TestInterface arg); void passNullableSelf(TestInterface? arg); attribute TestInterface nonNullSelf; attribute TestInterface? nullableSelf; @@ -254,10 +251,7 @@ interface TestInterface { IndirectlyImplementedInterface? receiveNullableOther(); IndirectlyImplementedInterface receiveWeakOther(); IndirectlyImplementedInterface? receiveWeakNullableOther(); - // A verstion to test for casting to IndirectlyImplementedInterface& void passOther(IndirectlyImplementedInterface arg); - // A version we can use to test for the exact type passed in - void passOther2(IndirectlyImplementedInterface arg); void passNullableOther(IndirectlyImplementedInterface? arg); attribute IndirectlyImplementedInterface nonNullOther; attribute IndirectlyImplementedInterface? nullableOther; @@ -271,10 +265,7 @@ interface TestInterface { TestExternalInterface? receiveNullableExternal(); TestExternalInterface receiveWeakExternal(); TestExternalInterface? receiveWeakNullableExternal(); - // A verstion to test for casting to TestExternalInterface& void passExternal(TestExternalInterface arg); - // A version we can use to test for the exact type passed in - void passExternal2(TestExternalInterface arg); void passNullableExternal(TestExternalInterface? arg); attribute TestExternalInterface nonNullExternal; attribute TestExternalInterface? nullableExternal; @@ -288,10 +279,7 @@ interface TestInterface { TestCallbackInterface? receiveNullableCallbackInterface(); TestCallbackInterface receiveWeakCallbackInterface(); TestCallbackInterface? receiveWeakNullableCallbackInterface(); - // A verstion to test for casting to TestCallbackInterface& void passCallbackInterface(TestCallbackInterface arg); - // A version we can use to test for the exact type passed in - void passCallbackInterface2(TestCallbackInterface arg); void passNullableCallbackInterface(TestCallbackInterface? arg); attribute TestCallbackInterface nonNullCallbackInterface; attribute TestCallbackInterface? nullableCallbackInterface; diff --git a/dom/bindings/test/TestExampleGen.webidl b/dom/bindings/test/TestExampleGen.webidl index 499ddd5ec35..0b56f34debb 100644 --- a/dom/bindings/test/TestExampleGen.webidl +++ b/dom/bindings/test/TestExampleGen.webidl @@ -119,10 +119,7 @@ interface TestExampleInterface { TestInterface? receiveNullableSelf(); TestInterface receiveWeakSelf(); TestInterface? receiveWeakNullableSelf(); - // A verstion to test for casting to TestInterface& void passSelf(TestInterface arg); - // A version we can use to test for the exact type passed in - void passSelf2(TestInterface arg); void passNullableSelf(TestInterface? arg); attribute TestInterface nonNullSelf; attribute TestInterface? nullableSelf; @@ -150,10 +147,7 @@ interface TestExampleInterface { IndirectlyImplementedInterface? receiveNullableOther(); IndirectlyImplementedInterface receiveWeakOther(); IndirectlyImplementedInterface? receiveWeakNullableOther(); - // A verstion to test for casting to IndirectlyImplementedInterface& void passOther(IndirectlyImplementedInterface arg); - // A version we can use to test for the exact type passed in - void passOther2(IndirectlyImplementedInterface arg); void passNullableOther(IndirectlyImplementedInterface? arg); attribute IndirectlyImplementedInterface nonNullOther; attribute IndirectlyImplementedInterface? nullableOther; @@ -167,10 +161,7 @@ interface TestExampleInterface { TestExternalInterface? receiveNullableExternal(); TestExternalInterface receiveWeakExternal(); TestExternalInterface? receiveWeakNullableExternal(); - // A verstion to test for casting to TestExternalInterface& void passExternal(TestExternalInterface arg); - // A version we can use to test for the exact type passed in - void passExternal2(TestExternalInterface arg); void passNullableExternal(TestExternalInterface? arg); attribute TestExternalInterface nonNullExternal; attribute TestExternalInterface? nullableExternal; @@ -184,10 +175,7 @@ interface TestExampleInterface { TestCallbackInterface? receiveNullableCallbackInterface(); TestCallbackInterface receiveWeakCallbackInterface(); TestCallbackInterface? receiveWeakNullableCallbackInterface(); - // A verstion to test for casting to TestCallbackInterface& void passCallbackInterface(TestCallbackInterface arg); - // A version we can use to test for the exact type passed in - void passCallbackInterface2(TestCallbackInterface arg); void passNullableCallbackInterface(TestCallbackInterface? arg); attribute TestCallbackInterface nonNullCallbackInterface; attribute TestCallbackInterface? nullableCallbackInterface; diff --git a/dom/bindings/test/TestJSImplGen.webidl b/dom/bindings/test/TestJSImplGen.webidl index a933af2d37f..cdf1d65bcab 100644 --- a/dom/bindings/test/TestJSImplGen.webidl +++ b/dom/bindings/test/TestJSImplGen.webidl @@ -136,8 +136,6 @@ interface TestJSImplInterface { // A version to test for casting to TestJSImplInterface& void passSelf(TestJSImplInterface arg); - // A version we can use to test for the exact type passed in - void passSelf2(TestJSImplInterface arg); void passNullableSelf(TestJSImplInterface? arg); attribute TestJSImplInterface nonNullSelf; attribute TestJSImplInterface? nullableSelf; @@ -168,10 +166,7 @@ interface TestJSImplInterface { //IndirectlyImplementedInterface receiveWeakOther(); //IndirectlyImplementedInterface? receiveWeakNullableOther(); - // A verstion to test for casting to IndirectlyImplementedInterface& void passOther(IndirectlyImplementedInterface arg); - // A version we can use to test for the exact type passed in - void passOther2(IndirectlyImplementedInterface arg); void passNullableOther(IndirectlyImplementedInterface? arg); attribute IndirectlyImplementedInterface nonNullOther; attribute IndirectlyImplementedInterface? nullableOther; @@ -186,10 +181,7 @@ interface TestJSImplInterface { // Callback interface ignores 'resultNotAddRefed'. See bug 843272. //TestExternalInterface receiveWeakExternal(); //TestExternalInterface? receiveWeakNullableExternal(); - // A verstion to test for casting to TestExternalInterface& void passExternal(TestExternalInterface arg); - // A version we can use to test for the exact type passed in - void passExternal2(TestExternalInterface arg); void passNullableExternal(TestExternalInterface? arg); attribute TestExternalInterface nonNullExternal; attribute TestExternalInterface? nullableExternal; @@ -204,10 +196,7 @@ interface TestJSImplInterface { // Callback interface ignores 'resultNotAddRefed'. See bug 843272. //TestCallbackInterface receiveWeakCallbackInterface(); //TestCallbackInterface? receiveWeakNullableCallbackInterface(); - // A verstion to test for casting to TestCallbackInterface& void passCallbackInterface(TestCallbackInterface arg); - // A version we can use to test for the exact type passed in - void passCallbackInterface2(TestCallbackInterface arg); void passNullableCallbackInterface(TestCallbackInterface? arg); attribute TestCallbackInterface nonNullCallbackInterface; attribute TestCallbackInterface? nullableCallbackInterface; diff --git a/dom/indexedDB/IDBEvents.h b/dom/indexedDB/IDBEvents.h index b6f3353a742..fe468a0b19d 100644 --- a/dom/indexedDB/IDBEvents.h +++ b/dom/indexedDB/IDBEvents.h @@ -61,7 +61,7 @@ public: static already_AddRefed Constructor(const GlobalObject& aGlobal, - const NonNull& aType, + const nsAString& aType, const IDBVersionChangeEventInit& aOptions, ErrorResult& aRv) { diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 43a6cc45214..ec37e9442b3 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -647,7 +647,7 @@ IDBFactory::Cmp(JSContext* aCx, JS::Handle aFirst, already_AddRefed IDBFactory::OpenForPrincipal(nsIPrincipal* aPrincipal, - const NonNull& aName, + const nsAString& aName, const Optional& aVersion, ErrorResult& aRv) { @@ -661,7 +661,7 @@ IDBFactory::OpenForPrincipal(nsIPrincipal* aPrincipal, already_AddRefed IDBFactory::DeleteForPrincipal(nsIPrincipal* aPrincipal, - const NonNull& aName, + const nsAString& aName, ErrorResult& aRv) { // Just to be on the extra-safe side diff --git a/dom/indexedDB/IDBFactory.h b/dom/indexedDB/IDBFactory.h index 8d8b74e8b72..23469e07a09 100644 --- a/dom/indexedDB/IDBFactory.h +++ b/dom/indexedDB/IDBFactory.h @@ -141,14 +141,14 @@ public: // WebIDL already_AddRefed - Open(const NonNull& aName, const Optional& aVersion, + Open(const nsAString& aName, const Optional& aVersion, ErrorResult& aRv) { return Open(nullptr, aName, aVersion, false, aRv); } already_AddRefed - DeleteDatabase(const NonNull& aName, ErrorResult& aRv) + DeleteDatabase(const nsAString& aName, ErrorResult& aRv) { return Open(nullptr, aName, Optional(), true, aRv); } @@ -158,11 +158,11 @@ public: JS::Handle aSecond, ErrorResult& aRv); already_AddRefed - OpenForPrincipal(nsIPrincipal* aPrincipal, const NonNull& aName, + OpenForPrincipal(nsIPrincipal* aPrincipal, const nsAString& aName, const Optional& aVersion, ErrorResult& aRv); already_AddRefed - DeleteForPrincipal(nsIPrincipal* aPrincipal, const NonNull& aName, + DeleteForPrincipal(nsIPrincipal* aPrincipal, const nsAString& aName, ErrorResult& aRv); private: From 0d417e5c5f62e9afd1a665b410804e646e25abd8 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 22 Jul 2013 08:15:43 -0400 Subject: [PATCH 51/69] Bug 895974. Implement ParentNode on document fragments and documents and move previousElementSibling and nextElementSibling to ChildNode. r=smaug --- content/base/public/Element.h | 31 --------- content/base/public/FragmentOrElement.h | 6 +- content/base/public/nsIDocument.h | 8 +++ content/base/public/nsINode.h | 7 ++ content/base/src/Element.cpp | 28 -------- content/base/src/nsDocument.cpp | 21 ++++++ content/base/src/nsINode.cpp | 56 +++++++++++++++ content/base/test/Makefile.in | 1 + content/base/test/test_bug895974.html | 69 +++++++++++++++++++ .../test/test_playback_rate_playpause.html | 3 + dom/webidl/ChildNode.webidl | 7 +- dom/webidl/Document.webidl | 1 + dom/webidl/DocumentFragment.webidl | 2 + dom/webidl/Element.webidl | 14 +--- dom/webidl/ParentNode.webidl | 24 +++++++ dom/webidl/WebIDL.mk | 1 + 16 files changed, 203 insertions(+), 76 deletions(-) create mode 100644 content/base/test/test_bug895974.html create mode 100644 dom/webidl/ParentNode.webidl diff --git a/content/base/public/Element.h b/content/base/public/Element.h index c907f63433e..dc9cc334895 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -38,7 +38,6 @@ #include "nsEvent.h" #include "nsAttrValue.h" #include "mozilla/dom/BindingDeclarations.h" -#include "nsIHTMLCollection.h" #include "Units.h" class nsIDOMEventListener; @@ -600,36 +599,6 @@ public: ErrorResult& aError); already_AddRefed GetElementsByClassName(const nsAString& aClassNames); - Element* GetFirstElementChild() const; - Element* GetLastElementChild() const; - Element* GetPreviousElementSibling() const - { - nsIContent* previousSibling = GetPreviousSibling(); - while (previousSibling) { - if (previousSibling->IsElement()) { - return previousSibling->AsElement(); - } - previousSibling = previousSibling->GetPreviousSibling(); - } - - return nullptr; - } - Element* GetNextElementSibling() const - { - nsIContent* nextSibling = GetNextSibling(); - while (nextSibling) { - if (nextSibling->IsElement()) { - return nextSibling->AsElement(); - } - nextSibling = nextSibling->GetNextSibling(); - } - - return nullptr; - } - uint32_t ChildElementCount() - { - return Children()->Length(); - } bool MozMatchesSelector(const nsAString& aSelector, ErrorResult& aError); void SetCapture(bool aRetargetToElement) diff --git a/content/base/public/FragmentOrElement.h b/content/base/public/FragmentOrElement.h index 9d5691aaa71..ce4df9199da 100644 --- a/content/base/public/FragmentOrElement.h +++ b/content/base/public/FragmentOrElement.h @@ -23,6 +23,7 @@ #include "nsINodeList.h" // base class #include "nsIWeakReference.h" // base class #include "nsNodeUtils.h" // class member nsNodeUtils::CloneNodeImpl +#include "nsIHTMLCollection.h" class ContentUnbinder; class nsContentList; @@ -32,7 +33,6 @@ class nsIControllers; class nsICSSDeclaration; class nsIDocument; class nsDOMStringMap; -class nsIHTMLCollection; class nsINodeInfo; class nsIURI; @@ -229,6 +229,10 @@ public: NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE; nsIHTMLCollection* Children(); + uint32_t ChildElementCount() + { + return Children()->Length(); + } public: /** diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 50d7ac13a5e..090f82c92d8 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -53,6 +53,7 @@ class nsIDOMElement; class nsIDOMNodeList; class nsIDOMXPathExpression; class nsIDOMXPathNSResolver; +class nsIHTMLCollection; class nsILayoutHistoryState; class nsIObjectLoadingContent; class nsIObserver; @@ -2120,6 +2121,10 @@ public: void ObsoleteSheet(const nsAString& aSheetURI, mozilla::ErrorResult& rv); + // ParentNode + nsIHTMLCollection* Children(); + uint32_t ChildElementCount(); + virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; } virtual JSObject* WrapObject(JSContext *aCx, @@ -2211,6 +2216,9 @@ protected: nsPropertyTable mPropertyTable; nsTArray > mExtraPropertyTables; + // Our cached .children collection + nsCOMPtr mChildrenCollection; + // Compatibility mode nsCompatibility mCompatMode; diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index 1fe886487c5..73f4df0235f 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -1590,11 +1590,18 @@ public: return rv.ErrorCode(); } + // ChildNode methods + mozilla::dom::Element* GetPreviousElementSibling() const; + mozilla::dom::Element* GetNextElementSibling() const; /** * Remove this node from its parent, if any. */ void Remove(); + // ParentNode methods + mozilla::dom::Element* GetFirstElementChild() const; + mozilla::dom::Element* GetLastElementChild() const; + protected: // Override this function to create a custom slots class. diff --git a/content/base/src/Element.cpp b/content/base/src/Element.cpp index 86f029d5a96..500d36d3620 100644 --- a/content/base/src/Element.cpp +++ b/content/base/src/Element.cpp @@ -416,34 +416,6 @@ Element::WrapObject(JSContext *aCx, JS::Handle aScope) return obj; } -Element* -Element::GetFirstElementChild() const -{ - uint32_t i, count = mAttrsAndChildren.ChildCount(); - for (i = 0; i < count; ++i) { - nsIContent* child = mAttrsAndChildren.ChildAt(i); - if (child->IsElement()) { - return child->AsElement(); - } - } - - return nullptr; -} - -Element* -Element::GetLastElementChild() const -{ - uint32_t i = mAttrsAndChildren.ChildCount(); - while (i > 0) { - nsIContent* child = mAttrsAndChildren.ChildAt(--i); - if (child->IsElement()) { - return child->AsElement(); - } - } - - return nullptr; -} - nsDOMTokenList* Element::GetClassList() { diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index d75693da740..89b5d714e65 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1793,6 +1793,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStateObjectCached) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mUndoManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTemplateContentsOwner) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildrenCollection) // Traverse all our nsCOMArrays. NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleSheets) @@ -1877,6 +1878,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mCachedEncoder) NS_IMPL_CYCLE_COLLECTION_UNLINK(mUndoManager) NS_IMPL_CYCLE_COLLECTION_UNLINK(mTemplateContentsOwner) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mChildrenCollection) tmp->mParentDocument = nullptr; @@ -9475,6 +9477,25 @@ nsIDocument::ObsoleteSheet(const nsAString& aSheetURI, ErrorResult& rv) } } +nsIHTMLCollection* +nsIDocument::Children() +{ + if (!mChildrenCollection) { + mChildrenCollection = new nsContentList(this, kNameSpaceID_Wildcard, + nsGkAtoms::_asterix, + nsGkAtoms::_asterix, + false); + } + + return mChildrenCollection; +} + +uint32_t +nsIDocument::ChildElementCount() +{ + return Children()->Length(); +} + namespace mozilla { // Singleton class to manage the list of fullscreen documents which are the diff --git a/content/base/src/nsINode.cpp b/content/base/src/nsINode.cpp index d691d2e1b00..c2a94947d8a 100644 --- a/content/base/src/nsINode.cpp +++ b/content/base/src/nsINode.cpp @@ -1404,6 +1404,34 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex, return NS_OK; } +Element* +nsINode::GetPreviousElementSibling() const +{ + nsIContent* previousSibling = GetPreviousSibling(); + while (previousSibling) { + if (previousSibling->IsElement()) { + return previousSibling->AsElement(); + } + previousSibling = previousSibling->GetPreviousSibling(); + } + + return nullptr; +} + +Element* +nsINode::GetNextElementSibling() const +{ + nsIContent* nextSibling = GetNextSibling(); + while (nextSibling) { + if (nextSibling->IsElement()) { + return nextSibling->AsElement(); + } + nextSibling = nextSibling->GetNextSibling(); + } + + return nullptr; +} + void nsINode::Remove() { @@ -1419,6 +1447,34 @@ nsINode::Remove() parent->RemoveChildAt(uint32_t(index), true); } +Element* +nsINode::GetFirstElementChild() const +{ + for (nsIContent* child = GetFirstChild(); + child; + child = child->GetNextSibling()) { + if (child->IsElement()) { + return child->AsElement(); + } + } + + return nullptr; +} + +Element* +nsINode::GetLastElementChild() const +{ + for (nsIContent* child = GetLastChild(); + child; + child = child->GetPreviousSibling()) { + if (child->IsElement()) { + return child->AsElement(); + } + } + + return nullptr; +} + void nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify, nsIContent* aKid, nsAttrAndChildArray& aChildArray) diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index a148bbd3818..0b5ec03fb52 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -249,6 +249,7 @@ MOCHITEST_FILES_A = \ test_bug820909.html \ test_bug704063.html \ test_bug894874.html \ + test_bug895974.html \ $(NULL) MOCHITEST_FILES_B = \ diff --git a/content/base/test/test_bug895974.html b/content/base/test/test_bug895974.html new file mode 100644 index 00000000000..25499d5a2c1 --- /dev/null +++ b/content/base/test/test_bug895974.html @@ -0,0 +1,69 @@ + + + + + + Test for Bug 895974 + + + + + +Mozilla Bug 895974 +

+ +
+
+ + diff --git a/content/media/test/test_playback_rate_playpause.html b/content/media/test/test_playback_rate_playpause.html index b868a04b905..7c58daf9094 100644 --- a/content/media/test/test_playback_rate_playpause.html +++ b/content/media/test/test_playback_rate_playpause.html @@ -14,6 +14,9 @@ if (navigator.platform.startsWith("Win")) { SimpleTest.expectAssertions(0, 1); } else if (navigator.platform.startsWith("Mac")) { SimpleTest.expectAssertions(0, 2); +} else if (navigator.platform.startsWith("Linux")) { + // Bug 897024 + SimpleTest.expectAssertions(0, 2); } let manager = new MediaTestManager; diff --git a/dom/webidl/ChildNode.webidl b/dom/webidl/ChildNode.webidl index 7032dd4160d..76d448656e1 100644 --- a/dom/webidl/ChildNode.webidl +++ b/dom/webidl/ChildNode.webidl @@ -9,9 +9,10 @@ [NoInterfaceObject] interface ChildNode { -// On Element: -// readonly attribute Element? previousElementSibling; -// readonly attribute Element? nextElementSibling; + [Pure] + readonly attribute Element? previousElementSibling; + [Pure] + readonly attribute Element? nextElementSibling; // Not implemented yet: // void before((Node or DOMString)... nodes); diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index 91bb605f3c0..81d84c799c7 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -334,3 +334,4 @@ Document implements XPathEvaluator; Document implements GlobalEventHandlers; Document implements NodeEventHandlers; Document implements TouchEventHandlers; +Document implements ParentNode; diff --git a/dom/webidl/DocumentFragment.webidl b/dom/webidl/DocumentFragment.webidl index 8034ea468d5..45efb296861 100644 --- a/dom/webidl/DocumentFragment.webidl +++ b/dom/webidl/DocumentFragment.webidl @@ -29,3 +29,5 @@ partial interface DocumentFragment { [Throws] NodeList querySelectorAll(DOMString selectors); }; + +DocumentFragment implements ParentNode; diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl index c7ea13b5032..e837e867afc 100644 --- a/dom/webidl/Element.webidl +++ b/dom/webidl/Element.webidl @@ -55,19 +55,6 @@ interface Element : Node { HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByClassName(DOMString classNames); - [Constant] - readonly attribute HTMLCollection children; - [Pure] - readonly attribute Element? firstElementChild; - [Pure] - readonly attribute Element? lastElementChild; - [Pure] - readonly attribute Element? previousElementSibling; - [Pure] - readonly attribute Element? nextElementSibling; - [Pure] - readonly attribute unsigned long childElementCount; - /** * The ratio of font-size-inflated text font size to computed font * size for this element. This will query the element for its primary frame, @@ -199,3 +186,4 @@ partial interface Element { }; Element implements ChildNode; +Element implements ParentNode; diff --git a/dom/webidl/ParentNode.webidl b/dom/webidl/ParentNode.webidl new file mode 100644 index 00000000000..da08b749756 --- /dev/null +++ b/dom/webidl/ParentNode.webidl @@ -0,0 +1,24 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. + * + * The origin of this IDL file is + * http://dom.spec.whatwg.org/#interface-parentnode + */ + +[NoInterfaceObject] +interface ParentNode { + [Constant] + readonly attribute HTMLCollection children; + [Pure] + readonly attribute Element? firstElementChild; + [Pure] + readonly attribute Element? lastElementChild; + [Pure] + readonly attribute unsigned long childElementCount; + + // Not implemented yet + // void prepend((Node or DOMString)... nodes); + // void append((Node or DOMString)... nodes); +}; diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index e98f473856a..f69eec7bc26 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -209,6 +209,7 @@ webidl_files = \ PaintRequest.webidl \ PaintRequestList.webidl \ PannerNode.webidl \ + ParentNode.webidl \ Performance.webidl \ PerformanceNavigation.webidl \ PerformanceTiming.webidl \ From b8d369a6148e09b6ed1723551b45805ccd63cebf Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 23 Jul 2013 10:09:19 -0400 Subject: [PATCH 52/69] Bug 895495. Add a faster way to create JS-implemented WebIDL objects from chrome. r=mccr8 This adds a Interface._create(targetWindow, chromeObj) static method that lets a JS-implemented WebIDL object implementing Interface be created in the window targetWindow using chromeObj as its JS implementation. --- dom/bindings/Codegen.py | 91 +++++++++++++++++++++++++++++++++-------- 1 file changed, 74 insertions(+), 17 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index cb071202661..c0cd1c17c6d 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1068,7 +1068,7 @@ class CGClassConstructor(CGAbstractStaticMethod): def generate_code(self): preamble = """ JS::CallArgs args = JS::CallArgsFromVp(argc, vp); - JS::Rooted obj(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp))); + JS::Rooted obj(cx, &args.callee()); """ name = self._ctor.identifier.name nativeName = MakeNativeName(self.descriptor.binaryNames.get(name, name)) @@ -1090,7 +1090,7 @@ class CGConstructNavigatorObjectHelper(CGAbstractStaticMethod): CGAbstractStaticMethod.__init__(self, descriptor, name, rtype, args) def definition_body(self): - return genConstructorBody(self.descriptor) + return CGIndenter(CGGeneric(genConstructorBody(self.descriptor))).define() class CGConstructNavigatorObject(CGAbstractMethod): """ @@ -1485,6 +1485,15 @@ class MethodDefiner(PropertyDefiner): self.chrome.append(toStringDesc) else: self.regular.append(toStringDesc) + elif (descriptor.interface.isJSImplemented() and + descriptor.interface.hasInterfaceObject()): + self.chrome.append({"name": '_create', + "nativeName": ("%s::_Create" % + descriptor.name), + "methodInfo": False, + "length": 2, + "flags": "0", + "condition": MemberCondition(None, None) }) if static: if not descriptor.interface.hasInterfaceObject(): @@ -8438,7 +8447,11 @@ class CGBindingRoot(CGThing): requiresContentUtils = any(d.interface.hasInterfaceObject() for d in descriptors) def descriptorHasChromeOnly(desc): return (any(isChromeOnly(a) for a in desc.interface.members) or - desc.interface.getExtendedAttribute("ChromeOnly") is not None) + desc.interface.getExtendedAttribute("ChromeOnly") is not None or + # JS-implemented interfaces with an interface object get a + # chromeonly _create method. + (desc.interface.isJSImplemented() and + desc.interface.hasInterfaceObject())) hasChromeOnly = any(descriptorHasChromeOnly(d) for d in descriptors) # XXXkhuey ugly hack but this is going away soon. isEventTarget = webIDLFile.endswith("EventTarget.webidl") @@ -9240,20 +9253,20 @@ class CGJSImplMethod(CGNativeMember): args = args[2:] constructorArgs = [arg.name for arg in args] initCall = """ - // Wrap the object before calling __Init so that __DOM_IMPL__ is available. - nsCOMPtr globalHolder = do_QueryInterface(window); - JS::Rooted scopeObj(cx, globalHolder->GetGlobalJSObject()); - JS::Rooted wrappedVal(cx); - if (!WrapNewBindingObject(cx, scopeObj, impl, &wrappedVal)) { - MOZ_ASSERT(JS_IsExceptionPending(cx)); - aRv.Throw(NS_ERROR_UNEXPECTED); - return nullptr; - } - // Initialize the object with the constructor arguments. - impl->mImpl->__Init(%s); - if (aRv.Failed()) { - return nullptr; - }""" % (", ".join(constructorArgs)) +// Wrap the object before calling __Init so that __DOM_IMPL__ is available. +nsCOMPtr globalHolder = do_QueryInterface(window); +JS::Rooted scopeObj(cx, globalHolder->GetGlobalJSObject()); +JS::Rooted wrappedVal(cx); +if (!WrapNewBindingObject(cx, scopeObj, impl, &wrappedVal)) { + MOZ_ASSERT(JS_IsExceptionPending(cx)); + aRv.Throw(NS_ERROR_UNEXPECTED); + return nullptr; +} +// Initialize the object with the constructor arguments. +impl->mImpl->__Init(%s); +if (aRv.Failed()) { + return nullptr; +}""" % (", ".join(constructorArgs)) else: initCall = "" return genConstructorBody(self.descriptor, initCall) @@ -9396,6 +9409,15 @@ class CGJSImplClass(CGBindingImplClass): baseConstructors=baseConstructors, body=constructorBody) + self.methodDecls.append( + ClassMethod("_Create", + "JSBool", + [Argument("JSContext*", "cx"), + Argument("unsigned", "argc"), + Argument("JS::Value*", "vp")], + static=True, + body=self.getCreateFromExistingBody())) + CGClass.__init__(self, descriptor.name, bases=baseClasses, constructors=[constructor], @@ -9427,6 +9449,41 @@ class CGJSImplClass(CGBindingImplClass): def getGetParentObjectBody(self): return "return mParent;" + def getCreateFromExistingBody(self): + # XXXbz we could try to get parts of this (e.g. the argument + # conversions) auto-generated by somehow creating an IDLMethod and + # adding it to our interface, but we'd still need to special-case the + # implementation slightly to have it not try to forward to the JS + # object... + return string.Template( + "JS::CallArgs args = JS::CallArgsFromVp(argc, vp);\n" + "if (args.length() < 2) {\n" + ' return ThrowErrorMessage(cx, MSG_MISSING_ARGUMENTS, "${ifaceName}._create");\n' + "}\n" + "if (!args[0].isObject()) {\n" + ' return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 1 of ${ifaceName}._create");\n' + "}\n" + "if (!args[1].isObject()) {\n" + ' return ThrowErrorMessage(cx, MSG_NOT_OBJECT, "Argument 2 of ${ifaceName}._create");\n' + "}\n" + "\n" + "// GlobalObject will go through wrappers as needed for us, and\n" + "// is simpler than the right UnwrapArg incantation.\n" + "GlobalObject global(cx, &args[0].toObject());\n" + "if (global.Failed()) {\n" + " return false;\n" + "}\n" + "nsCOMPtr window = do_QueryInterface(global.Get());\n" + "if (!window) {\n" + ' return ThrowErrorMessage(cx, MSG_DOES_NOT_IMPLEMENT_INTERFACE, "Argument 1 of ${ifaceName}._create");\n' + "}\n" + "JS::Rooted arg(cx, &args[1].toObject());\n" + "nsRefPtr<${implName}> impl = new ${implName}(arg, window);\n" + "return WrapNewBindingObject(cx, arg, impl, args.rval());").substitute({ + "ifaceName": self.descriptor.interface.identifier.name, + "implName": self.descriptor.name + }) + def isJSImplementedDescriptor(descriptorProvider): return (isinstance(descriptorProvider, Descriptor) and descriptorProvider.interface.isJSImplemented()) From 7482429c48cbc2363bb9341bfa1f35201c94a7e6 Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Mon, 22 Jul 2013 11:51:38 -0400 Subject: [PATCH 53/69] Bug 895003 - Introduce a second preference to control the chrome paint flashing - nglayout.debug.paint_flashing_chrome. r=roc The original pref still controls content and chrome when set. The preference is now live, for content and chrome, the change will be seen on the next refresh. The cached value is now in nsPresContext, rather than nsRefreshDriver. --- dom/base/nsDOMWindowUtils.cpp | 4 ++-- layout/base/FrameLayerBuilder.cpp | 2 +- layout/base/nsPresContext.cpp | 33 ++++++++++++++++++++++++++++++- layout/base/nsPresContext.h | 15 ++++++++++++++ layout/base/nsRefreshDriver.cpp | 2 -- layout/base/nsRefreshDriver.h | 12 ----------- 6 files changed, 50 insertions(+), 18 deletions(-) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 172408357c7..62d60da5d47 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -3347,7 +3347,7 @@ nsDOMWindowUtils::SetPaintFlashing(bool aPaintFlashing) { nsPresContext* presContext = GetPresContext(); if (presContext) { - presContext->RefreshDriver()->SetPaintFlashing(aPaintFlashing); + presContext->SetPaintFlashing(aPaintFlashing); // Clear paint flashing colors nsIPresShell* presShell = GetPresShell(); if (!aPaintFlashing && presShell) { @@ -3366,7 +3366,7 @@ nsDOMWindowUtils::GetPaintFlashing(bool* aRetVal) *aRetVal = false; nsPresContext* presContext = GetPresContext(); if (presContext) { - *aRetVal = presContext->RefreshDriver()->GetPaintFlashing(); + *aRetVal = presContext->GetPaintFlashing(); } return NS_OK; } diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 957b59be637..8e22a1d02db 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -3327,7 +3327,7 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, aContext->Restore(); } - if (presContext->RefreshDriver()->GetPaintFlashing()) { + if (presContext->GetPaintFlashing()) { FlashPaint(aContext); } diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 3b6aab1292a..2498f062451 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -199,7 +199,8 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType) mPageSize(-1, -1), mPPScale(1.0f), mViewportStyleOverflow(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO), mImageAnimationModePref(imgIContainer::kNormalAnimMode), - mAllInvalidated(false) + mAllInvalidated(false), + mPaintFlashing(false), mPaintFlashingInitialized(false) { // NOTE! nsPresContext::operator new() zeroes out all members, so don't // bother initializing members to 0. @@ -315,6 +316,12 @@ nsPresContext::~nsPresContext() Preferences::UnregisterCallback(nsPresContext::PrefChangedCallback, "layout.css.devPixelsPerPx", this); + Preferences::UnregisterCallback(nsPresContext::PrefChangedCallback, + "nglayout.debug.paint_flashing", + this); + Preferences::UnregisterCallback(nsPresContext::PrefChangedCallback, + "nglayout.debug.paint_flashing_chrome", + this); } NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsPresContext) @@ -879,6 +886,11 @@ nsPresContext::PreferenceChanged(const char* aPrefName) return; mPrefChangedTimer->InitWithFuncCallback(nsPresContext::PrefChangedUpdateTimerCallback, (void*)this, 0, nsITimer::TYPE_ONE_SHOT); } + if (prefName.EqualsLiteral("nglayout.debug.paint_flashing") || + prefName.EqualsLiteral("nglayout.debug.paint_flashing_chrome")) { + mPaintFlashingInitialized = false; + return; + } } void @@ -1024,6 +1036,12 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext) Preferences::RegisterCallback(nsPresContext::PrefChangedCallback, "layout.css.devPixelsPerPx", this); + Preferences::RegisterCallback(nsPresContext::PrefChangedCallback, + "nglayout.debug.paint_flashing", + this); + Preferences::RegisterCallback(nsPresContext::PrefChangedCallback, + "nglayout.debug.paint_flashing_chrome", + this); nsresult rv = mEventManager->Init(); NS_ENSURE_SUCCESS(rv, rv); @@ -2619,6 +2637,19 @@ nsPresContext::IsCrossProcessRootContentDocument() return (tabChild && tabChild->IsRootContentDocument()); } +bool nsPresContext::GetPaintFlashing() const +{ + if (!mPaintFlashingInitialized) { + bool pref = Preferences::GetBool("nglayout.debug.paint_flashing"); + if (!pref && IsChrome()) { + pref = Preferences::GetBool("nglayout.debug.paint_flashing_chrome"); + } + mPaintFlashing = pref; + mPaintFlashingInitialized = true; + } + return mPaintFlashing; +} + nsRootPresContext::nsRootPresContext(nsIDocument* aDocument, nsPresContextType aType) : nsPresContext(aDocument, aType), diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index 8486347dfca..979776472d8 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -859,6 +859,16 @@ public: return GetCachedBoolPref(kPresContext_UseDocumentColors) || IsChrome(); } + // Explicitly enable and disable paint flashing. + void SetPaintFlashing(bool aPaintFlashing) { + mPaintFlashing = aPaintFlashing; + mPaintFlashingInitialized = true; + } + + // This method should be used instead of directly accessing mPaintFlashing, + // as that value may be out of date when mPaintFlashingInitialized is false. + bool GetPaintFlashing() const; + bool SupressingResizeReflow() const { return mSupressResizeReflow; } virtual NS_HIDDEN_(gfxUserFontSet*) GetUserFontSetExternal(); @@ -1326,6 +1336,11 @@ protected: mutable unsigned mIsChromeIsCached : 1; mutable unsigned mIsChrome : 1; + // Should we paint flash in this context? Do not use this variable directly. + // Use GetPaintFlashing() method instead. + mutable unsigned mPaintFlashing : 1; + mutable unsigned mPaintFlashingInitialized : 1; + #ifdef DEBUG bool mInitialized; #endif diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 6f6f97d9c58..c61096d81d7 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -724,8 +724,6 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext) mMostRecentRefreshEpochTime = JS_Now(); mMostRecentRefresh = TimeStamp::Now(); - mPaintFlashing = Preferences::GetBool("nglayout.debug.paint_flashing"); - mRequests.Init(); mStartTable.Init(); } diff --git a/layout/base/nsRefreshDriver.h b/layout/base/nsRefreshDriver.h index d79d321ea3a..a5ee2d15d88 100644 --- a/layout/base/nsRefreshDriver.h +++ b/layout/base/nsRefreshDriver.h @@ -230,17 +230,6 @@ public: */ static int32_t DefaultInterval(); - /** - * Enable/disable paint flashing. - */ - void SetPaintFlashing(bool aPaintFlashing) { - mPaintFlashing = aPaintFlashing; - } - - bool GetPaintFlashing() { - return mPaintFlashing; - } - private: typedef nsTObserverArray ObserverArray; typedef nsTHashtable RequestTable; @@ -295,7 +284,6 @@ private: bool mTestControllingRefreshes; bool mViewManagerFlushIsPending; bool mRequestedHighPrecision; - bool mPaintFlashing; int64_t mMostRecentRefreshEpochTime; mozilla::TimeStamp mMostRecentRefresh; From 695c4ee9798b7fc1451572b3c132b0145fddfbce Mon Sep 17 00:00:00 2001 From: Max Vujovic Date: Tue, 23 Jul 2013 10:47:16 -0400 Subject: [PATCH 54/69] Bug 895182 - [CSS Filters] Implement parsing for blur, brightness, contrast, grayscale, invert, opacity, saturate, sepia. Co-authored with Dirk Schulze (krit). r=heycam --- .../en-US/chrome/layout/css.properties | 5 + layout/base/nsLayoutUtils.cpp | 16 ++ layout/base/nsLayoutUtils.h | 5 + layout/generic/nsFrame.cpp | 2 +- layout/style/nsCSSKeywordList.h | 8 + layout/style/nsCSSParser.cpp | 144 ++++++++++++++ layout/style/nsCSSPropList.h | 4 +- layout/style/nsCSSProps.h | 5 +- layout/style/nsComputedDOMStyle.cpp | 93 ++++++++- layout/style/nsComputedDOMStyle.h | 5 + layout/style/nsRuleNode.cpp | 98 +++++++++- layout/style/nsStyleStruct.cpp | 49 ++++- layout/style/nsStyleStruct.h | 39 +++- layout/style/test/property_database.js | 177 ++++++++++++++++++ layout/svg/nsSVGEffects.cpp | 6 +- layout/svg/nsSVGIntegrationUtils.cpp | 2 +- layout/svg/nsSVGUtils.cpp | 2 +- modules/libpref/src/init/all.js | 3 + 18 files changed, 632 insertions(+), 31 deletions(-) diff --git a/dom/locales/en-US/chrome/layout/css.properties b/dom/locales/en-US/chrome/layout/css.properties index 8a476f87d97..8deeea9d3e0 100644 --- a/dom/locales/en-US/chrome/layout/css.properties +++ b/dom/locales/en-US/chrome/layout/css.properties @@ -137,3 +137,8 @@ PESupportsConditionExpectedCloseParen=Expected ')' while parsing supports condit PESupportsConditionExpectedStart2=Expected 'not', '(', or function while parsing supports condition but found '%1$S'. PESupportsConditionExpectedNot=Expected 'not' while parsing supports condition but found '%1$S'. PESupportsGroupRuleStart=Expected '{' to begin @supports rule but found '%1$S'. +PEFilterEOF=filter +PEExpectedNoneOrURL=Expected 'none' or URL but found '%1$S'. +PEExpectedNoneOrURLOrFilterFunction=Expected 'none', URL, or filter function but found '%1$S'. +PEExpectedNonnegativeNP=Expected non-negative number or percentage. +PEFilterFunctionArgumentsParsingError=Error in parsing arguments for filter function. diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 7acf55bd140..dddbf7941f4 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -384,6 +384,22 @@ nsLayoutUtils::AnimatedImageLayersEnabled() return sAnimatedImageLayersEnabled; } +bool +nsLayoutUtils::CSSFiltersEnabled() +{ + static bool sCSSFiltersEnabled; + static bool sCSSFiltersPrefCached = false; + + if (!sCSSFiltersPrefCached) { + sCSSFiltersPrefCached = true; + Preferences::AddBoolVarCache(&sCSSFiltersEnabled, + "layout.css.filters.enabled", + false); + } + + return sCSSFiltersEnabled; +} + void nsLayoutUtils::UnionChildOverflow(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas) diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 0efdf5d7e0c..a6ad3441536 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1622,6 +1622,11 @@ public: */ static bool AnimatedImageLayersEnabled(); + /** + * Checks if we should enable parsing for CSS Filters. + */ + static bool CSSFiltersEnabled(); + /** * Unions the overflow areas of all non-popup children of aFrame with * aOverflowAreas. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 39d3656479b..f9a3de05c68 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4961,7 +4961,7 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, // For SVG frames, we only need to account for filters. // TODO: We could also take account of clipPath and mask to reduce the // visual overflow, but that's not essential. - if (aFrame->StyleSVGReset()->mFilter) { + if (aFrame->StyleSVGReset()->SingleFilter()) { if (aStoreRectProperties) { aFrame->Properties(). Set(nsIFrame::PreEffectsBBoxProperty(), new nsRect(r)); diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 3dab8884994..0205580ac60 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -182,6 +182,7 @@ CSS_KEY(bidi-override, bidi_override) CSS_KEY(blink, blink) CSS_KEY(block, block) CSS_KEY(block-axis, block_axis) +CSS_KEY(blur, blur) CSS_KEY(bold, bold) CSS_KEY(bolder, bolder) CSS_KEY(border-box, border_box) @@ -191,6 +192,7 @@ CSS_KEY(bottom-outside, bottom_outside) CSS_KEY(bounding-box, bounding_box) CSS_KEY(break-all, break_all) CSS_KEY(break-word, break_word) +CSS_KEY(brightness, brightness) CSS_KEY(button, button) CSS_KEY(buttonface, buttonface) CSS_KEY(buttonhighlight, buttonhighlight) @@ -220,6 +222,7 @@ CSS_KEY(contain, contain) CSS_KEY(content-box, content_box) CSS_KEY(context-menu, context_menu) CSS_KEY(continuous, continuous) +CSS_KEY(contrast, contrast) CSS_KEY(copy, copy) CSS_KEY(contextual, contextual) CSS_KEY(cover, cover) @@ -270,6 +273,7 @@ CSS_KEY(forwards, forwards) CSS_KEY(full-width, full_width) CSS_KEY(georgian, georgian) CSS_KEY(grad, grad) +CSS_KEY(grayscale, grayscale) CSS_KEY(graytext, graytext) CSS_KEY(groove, groove) CSS_KEY(hebrew, hebrew) @@ -306,6 +310,7 @@ CSS_KEY(inline-table, inline_table) CSS_KEY(inset, inset) CSS_KEY(inside, inside) CSS_KEY(interpolatematrix, interpolatematrix) +CSS_KEY(invert, invert) CSS_KEY(italic, italic) CSS_KEY(jis78, jis78) CSS_KEY(jis83, jis83) @@ -369,6 +374,7 @@ CSS_KEY(nw-resize, nw_resize) CSS_KEY(nwse-resize, nwse_resize) CSS_KEY(oblique, oblique) CSS_KEY(oldstyle-nums, oldstyle_nums) +CSS_KEY(opacity, opacity) CSS_KEY(open-quote, open_quote) CSS_KEY(ordinal, ordinal) CSS_KEY(ornaments, ornaments) @@ -418,6 +424,7 @@ CSS_KEY(ruby, ruby) CSS_KEY(running, running) CSS_KEY(s, s) CSS_KEY(s-resize, s_resize) +CSS_KEY(saturate, saturate) CSS_KEY(scale, scale) CSS_KEY(scale3d, scale3d) CSS_KEY(scalex, scalex) @@ -435,6 +442,7 @@ CSS_KEY(select-same, select_same) CSS_KEY(semi-condensed, semi_condensed) CSS_KEY(semi-expanded, semi_expanded) CSS_KEY(separate, separate) +CSS_KEY(sepia, sepia) CSS_KEY(show, show) CSS_KEY(simplified, simplified) CSS_KEY(skew, skew) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 70072b626be..069e248c41a 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -604,6 +604,10 @@ protected: /* Functions for transform-origin/perspective-origin Parsing */ bool ParseTransformOrigin(bool aPerspective); + /* Functions for filter parsing */ + bool ParseFilter(); + bool ParseSingleFilter(nsCSSValue* aValue); + /* Find and return the namespace ID associated with aPrefix. If aPrefix has not been declared in an @namespace rule, returns kNameSpaceID_Unknown. */ @@ -6470,6 +6474,8 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID) return ParseCounterData(aPropID); case eCSSProperty_cursor: return ParseCursor(); + case eCSSProperty_filter: + return ParseFilter(); case eCSSProperty_flex: return ParseFlex(); case eCSSProperty_font: @@ -10032,6 +10038,144 @@ bool CSSParserImpl::ParseTransformOrigin(bool aPerspective) return true; } +/** + * Reads a single url or filter function from the tokenizer stream, reporting an + * error if something goes wrong. + */ +bool +CSSParserImpl::ParseSingleFilter(nsCSSValue* aValue) +{ + if (ParseVariant(*aValue, VARIANT_URL, nullptr)) { + return true; + } + + if (!nsLayoutUtils::CSSFiltersEnabled()) { + // With CSS Filters disabled, we should only accept an SVG reference filter. + REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURL); + return false; + } + + if (!GetToken(true)) { + REPORT_UNEXPECTED_EOF(PEFilterEOF); + return false; + } + + if (mToken.mType != eCSSToken_Function) { + REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURLOrFilterFunction); + return false; + } + + // Set up the parsing rules based on the filter function. + int32_t variantMask = VARIANT_PN; + bool rejectNegativeArgument = true; + bool clampArgumentToOne = false; + nsCSSKeyword functionName = nsCSSKeywords::LookupKeyword(mToken.mIdent); + switch (functionName) { + case eCSSKeyword_blur: + variantMask = VARIANT_LCALC | VARIANT_NONNEGATIVE_DIMENSION; + // VARIANT_NONNEGATIVE_DIMENSION will already reject negative lengths. + rejectNegativeArgument = false; + break; + case eCSSKeyword_grayscale: + case eCSSKeyword_invert: + case eCSSKeyword_sepia: + case eCSSKeyword_opacity: + clampArgumentToOne = true; + break; + case eCSSKeyword_brightness: + case eCSSKeyword_contrast: + case eCSSKeyword_saturate: + break; + default: + // Unrecognized filter function. + REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURLOrFilterFunction); + SkipUntil(')'); + return false; + } + + // Parse the function. + uint16_t minElems = 1U; + uint16_t maxElems = 1U; + uint32_t allVariants = 0; + if (!ParseFunction(functionName, &variantMask, allVariants, + minElems, maxElems, *aValue)) { + REPORT_UNEXPECTED(PEFilterFunctionArgumentsParsingError); + return false; + } + + // Get the first and only argument to the filter function. + NS_ABORT_IF_FALSE(aValue->GetUnit() == eCSSUnit_Function, + "expected a filter function"); + NS_ABORT_IF_FALSE(aValue->UnitHasArrayValue(), + "filter function should be an array"); + NS_ABORT_IF_FALSE(aValue->GetArrayValue()->Count() == 2, + "filter function should have exactly one argument"); + nsCSSValue& arg = aValue->GetArrayValue()->Item(1); + + if (rejectNegativeArgument && + ((arg.GetUnit() == eCSSUnit_Percent && arg.GetPercentValue() < 0.0f) || + (arg.GetUnit() == eCSSUnit_Number && arg.GetFloatValue() < 0.0f))) { + REPORT_UNEXPECTED(PEExpectedNonnegativeNP); + return false; + } + + if (clampArgumentToOne) { + if (arg.GetUnit() == eCSSUnit_Number && + arg.GetFloatValue() > 1.0f) { + arg.SetFloatValue(1.0f, arg.GetUnit()); + } else if (arg.GetUnit() == eCSSUnit_Percent && + arg.GetPercentValue() > 1.0f) { + arg.SetPercentValue(1.0f); + } + } + + return true; +} + +/** + * Parses a filter property value by continuously reading in urls and/or filter + * functions and constructing a list. + * + * When CSS Filters are enabled, the filter property accepts one or more SVG + * reference filters and/or CSS filter functions. + * e.g. filter: url(#my-filter-1) blur(3px) url(#my-filter-2) grayscale(50%); + * + * When CSS Filters are disabled, the filter property only accepts one SVG + * reference filter. + * e.g. filter: url(#my-filter); + */ +bool +CSSParserImpl::ParseFilter() +{ + nsCSSValue value; + if (ParseVariant(value, VARIANT_INHERIT | VARIANT_NONE, nullptr)) { + // 'inherit', 'initial', and 'none' must be alone + if (!ExpectEndProperty()) { + return false; + } + } else { + nsCSSValueList* cur = value.SetListValue(); + while (cur) { + if (!ParseSingleFilter(&cur->mValue)) { + return false; + } + if (CheckEndProperty()) { + break; + } + if (!nsLayoutUtils::CSSFiltersEnabled()) { + // With CSS Filters disabled, we should only accept one SVG reference + // filter. + REPORT_UNEXPECTED_TOKEN(PEExpectEndValue); + return false; + } + cur->mNext = new nsCSSValueList; + cur = cur->mNext; + } + } + AppendValue(eCSSProperty_filter, value); + return true; +} + bool CSSParserImpl::ParseTransitionProperty() { diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 836f14fa5b9..6355573f143 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -3327,9 +3327,9 @@ CSS_PROP_SVGRESET( filter, filter, Filter, - CSS_PROPERTY_PARSE_VALUE, + CSS_PROPERTY_PARSE_FUNCTION, "", - VARIANT_HUO, + 0, nullptr, CSS_PROP_NO_OFFSET, eStyleAnimType_None) diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index d8418ac5355..8f0860b0c05 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -89,8 +89,9 @@ #define VARIANT_UK (VARIANT_URL | VARIANT_KEYWORD) #define VARIANT_UO (VARIANT_URL | VARIANT_NONE) #define VARIANT_ANGLE_OR_ZERO (VARIANT_ANGLE | VARIANT_ZERO_ANGLE) -#define VARIANT_LPCALC (VARIANT_LENGTH | VARIANT_CALC | VARIANT_PERCENT) -#define VARIANT_LNCALC (VARIANT_LENGTH | VARIANT_CALC | VARIANT_NUMBER) +#define VARIANT_LCALC (VARIANT_LENGTH | VARIANT_CALC) +#define VARIANT_LPCALC (VARIANT_LCALC | VARIANT_PERCENT) +#define VARIANT_LNCALC (VARIANT_LCALC | VARIANT_NUMBER) #define VARIANT_LPNCALC (VARIANT_LNCALC | VARIANT_PERCENT) #define VARIANT_IMAGE (VARIANT_URL | VARIANT_NONE | VARIANT_GRADIENT | \ VARIANT_IMAGE_RECT | VARIANT_ELEMENT) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index f466d98aeed..741853d6bff 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -4468,19 +4468,96 @@ nsComputedDOMStyle::DoGetClipPath() return val; } +void +nsComputedDOMStyle::SetCssTextToCoord(nsAString& aCssText, + const nsStyleCoord& aCoord) +{ + nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue; + bool clampNegativeCalc = true; + SetValueToCoord(value, aCoord, clampNegativeCalc); + value->GetCssText(aCssText); + delete value; +} + +static void +GetFilterFunctionName(nsAString& aString, nsStyleFilter::Type mType) +{ + switch (mType) { + case nsStyleFilter::Type::eBlur: + aString.AssignLiteral("blur("); + break; + case nsStyleFilter::Type::eBrightness: + aString.AssignLiteral("brightness("); + break; + case nsStyleFilter::Type::eContrast: + aString.AssignLiteral("contrast("); + break; + case nsStyleFilter::Type::eGrayscale: + aString.AssignLiteral("grayscale("); + break; + case nsStyleFilter::Type::eInvert: + aString.AssignLiteral("invert("); + break; + case nsStyleFilter::Type::eOpacity: + aString.AssignLiteral("opacity("); + break; + case nsStyleFilter::Type::eSaturate: + aString.AssignLiteral("saturate("); + break; + case nsStyleFilter::Type::eSepia: + aString.AssignLiteral("sepia("); + break; + default: + NS_NOTREACHED("unrecognized filter type"); + } +} + +nsROCSSPrimitiveValue* +nsComputedDOMStyle::CreatePrimitiveValueForStyleFilter( + const nsStyleFilter& aStyleFilter) +{ + nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue; + + // Handle url(). + if (nsStyleFilter::Type::eURL == aStyleFilter.mType) { + value->SetURI(aStyleFilter.mURL); + return value; + } + + // Filter function name and opening parenthesis. + nsAutoString filterFunctionString; + GetFilterFunctionName(filterFunctionString, aStyleFilter.mType); + + // Filter function argument. + nsAutoString argumentString; + SetCssTextToCoord(argumentString, aStyleFilter.mCoord); + filterFunctionString.Append(argumentString); + + // Filter function closing parenthesis. + filterFunctionString.AppendLiteral(")"); + + value->SetString(filterFunctionString); + return value; +} + CSSValue* nsComputedDOMStyle::DoGetFilter() { - nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue; + const nsTArray& filters = StyleSVGReset()->mFilters; - const nsStyleSVGReset* svg = StyleSVGReset(); + if (filters.IsEmpty()) { + nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue; + value->SetIdent(eCSSKeyword_none); + return value; + } - if (svg->mFilter) - val->SetURI(svg->mFilter); - else - val->SetIdent(eCSSKeyword_none); - - return val; + nsDOMCSSValueList* valueList = GetROCSSValueList(false); + for(uint32_t i = 0; i < filters.Length(); i++) { + nsROCSSPrimitiveValue* value = + CreatePrimitiveValueForStyleFilter(filters[i]); + valueList->AppendCSSValue(value); + } + return valueList; } CSSValue* diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 4ce1d7d0993..0b0f47ca6a4 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -491,6 +491,11 @@ private: bool GetFrameBorderRectWidth(nscoord& aWidth); bool GetFrameBorderRectHeight(nscoord& aHeight); + /* Helper functions for computing the filter property style. */ + void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord); + nsROCSSPrimitiveValue* CreatePrimitiveValueForStyleFilter( + const nsStyleFilter& aStyleFilter); + struct ComputedStyleMapEntry { // Create a pointer-to-member-function type. diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index e507ac5cd9d..8c3afba855f 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -7707,6 +7707,68 @@ nsRuleNode::ComputeSVGData(void* aStartStruct, COMPUTE_END_INHERITED(SVG, svg) } +static nsStyleFilter::Type +StyleFilterTypeForFunctionName(nsCSSKeyword functionName) +{ + switch (functionName) { + case eCSSKeyword_blur: + return nsStyleFilter::Type::eBlur; + case eCSSKeyword_brightness: + return nsStyleFilter::Type::eBrightness; + case eCSSKeyword_contrast: + return nsStyleFilter::Type::eContrast; + case eCSSKeyword_grayscale: + return nsStyleFilter::Type::eGrayscale; + case eCSSKeyword_invert: + return nsStyleFilter::Type::eInvert; + case eCSSKeyword_opacity: + return nsStyleFilter::Type::eOpacity; + case eCSSKeyword_saturate: + return nsStyleFilter::Type::eSaturate; + case eCSSKeyword_sepia: + return nsStyleFilter::Type::eSepia; + default: + NS_NOTREACHED("Unknown filter type."); + return nsStyleFilter::Type::eNull; + } +} + +static void +SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter, + const nsCSSValue& aValue, + nsStyleContext* aStyleContext, + nsPresContext* aPresContext, + bool& aCanStoreInRuleTree) +{ + nsCSSUnit unit = aValue.GetUnit(); + if (unit == eCSSUnit_URL) { + aStyleFilter->mType = nsStyleFilter::Type::eURL; + aStyleFilter->mURL = aValue.GetURLValue(); + return; + } + + NS_ABORT_IF_FALSE(unit == eCSSUnit_Function, "expected a filter function"); + + nsCSSValue::Array* filterFunction = aValue.GetArrayValue(); + nsCSSKeyword functionName = + (nsCSSKeyword)filterFunction->Item(0).GetIntValue(); + aStyleFilter->mType = StyleFilterTypeForFunctionName(functionName); + + int32_t mask = SETCOORD_PERCENT | SETCOORD_FACTOR; + if (aStyleFilter->mType == nsStyleFilter::Type::eBlur) + mask = SETCOORD_LENGTH | SETCOORD_STORE_CALC; + + NS_ABORT_IF_FALSE(filterFunction->Count() == 2, + "all filter functions except drop-shadow should have " + "exactly one argument"); + + nsCSSValue& arg = filterFunction->Item(1); + DebugOnly success = SetCoord(arg, aStyleFilter->mCoord, nsStyleCoord(), + mask, aStyleContext, aPresContext, + aCanStoreInRuleTree); + NS_ABORT_IF_FALSE(success, "unexpected unit"); +} + const void* nsRuleNode::ComputeSVGResetData(void* aStartStruct, const nsRuleData* aRuleData, @@ -7783,14 +7845,34 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct, // filter: url, none, inherit const nsCSSValue* filterValue = aRuleData->ValueForFilter(); - if (eCSSUnit_URL == filterValue->GetUnit()) { - svgReset->mFilter = filterValue->GetURLValue(); - } else if (eCSSUnit_None == filterValue->GetUnit() || - eCSSUnit_Initial == filterValue->GetUnit()) { - svgReset->mFilter = nullptr; - } else if (eCSSUnit_Inherit == filterValue->GetUnit()) { - canStoreInRuleTree = false; - svgReset->mFilter = parentSVGReset->mFilter; + switch (filterValue->GetUnit()) { + case eCSSUnit_Null: + break; + case eCSSUnit_None: + case eCSSUnit_Initial: + svgReset->mFilters.Clear(); + break; + case eCSSUnit_Inherit: + canStoreInRuleTree = false; + svgReset->mFilters = parentSVGReset->mFilters; + break; + case eCSSUnit_List: + case eCSSUnit_ListDep: { + svgReset->mFilters.Clear(); + const nsCSSValueList* cur = filterValue->GetListValue(); + while(cur) { + nsStyleFilter styleFilter; + SetStyleFilterToCSSValue(&styleFilter, cur->mValue, aContext, + mPresContext, canStoreInRuleTree); + NS_ABORT_IF_FALSE(styleFilter.mType != nsStyleFilter::Type::eNull, + "filter should be set"); + svgReset->mFilters.AppendElement(styleFilter); + cur = cur->mNext; + } + break; + } + default: + NS_NOTREACHED("unexpected unit"); } // mask: url, none, inherit diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 06f8f065b67..f09d82b1bd7 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1000,6 +1000,48 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const return hint; } +// -------------------- +// nsStyleFilter +// +nsStyleFilter::nsStyleFilter() + : mType(eNull) +{ + MOZ_COUNT_CTOR(nsStyleFilter); +} + +nsStyleFilter::nsStyleFilter(const nsStyleFilter& aSource) + : mType(aSource.mType) +{ + MOZ_COUNT_CTOR(nsStyleFilter); + + if (mType == eURL) { + mURL = aSource.mURL; + } else if (mType != eNull) { + mCoord = aSource.mCoord; + } +} + +nsStyleFilter::~nsStyleFilter() +{ + MOZ_COUNT_DTOR(nsStyleFilter); +} + +bool +nsStyleFilter::operator==(const nsStyleFilter& aOther) const +{ + if (mType != aOther.mType) { + return false; + } + + if (mType == eURL) { + return EqualURIs(mURL, aOther.mURL); + } else if (mType != eNull) { + return mCoord == aOther.mCoord; + } + + return true; +} + // -------------------- // nsStyleSVGReset // @@ -1010,7 +1052,6 @@ nsStyleSVGReset::nsStyleSVGReset() mFloodColor = NS_RGB(0,0,0); mLightingColor = NS_RGB(255,255,255); mClipPath = nullptr; - mFilter = nullptr; mMask = nullptr; mStopOpacity = 1.0f; mFloodOpacity = 1.0f; @@ -1031,7 +1072,7 @@ nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource) mFloodColor = aSource.mFloodColor; mLightingColor = aSource.mLightingColor; mClipPath = aSource.mClipPath; - mFilter = aSource.mFilter; + mFilters = aSource.mFilters; mMask = aSource.mMask; mStopOpacity = aSource.mStopOpacity; mFloodOpacity = aSource.mFloodOpacity; @@ -1045,8 +1086,8 @@ nsChangeHint nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aOther) cons nsChangeHint hint = nsChangeHint(0); if (!EqualURIs(mClipPath, aOther.mClipPath) || - !EqualURIs(mFilter, aOther.mFilter) || - !EqualURIs(mMask, aOther.mMask)) { + !EqualURIs(mMask, aOther.mMask) || + mFilters != aOther.mFilters) { NS_UpdateHint(hint, nsChangeHint_UpdateEffects); NS_UpdateHint(hint, nsChangeHint_RepaintFrame); } diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index 70c71e4b993..a8b1d76bc27 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -2268,6 +2268,34 @@ struct nsStyleSVG { } }; +struct nsStyleFilter { + nsStyleFilter(); + nsStyleFilter(const nsStyleFilter& aSource); + ~nsStyleFilter(); + + bool operator==(const nsStyleFilter& aOther) const; + + enum Type { + eNull, + eURL, + eBlur, + eBrightness, + eContrast, + eInvert, + eOpacity, + eGrayscale, + eSaturate, + eSepia, + }; + + Type mType; + union { + nsIURI* mURL; + nsStyleCoord mCoord; + // FIXME: Add a nsCSSShadowItem when we implement drop shadow. + }; +}; + struct nsStyleSVGReset { nsStyleSVGReset(); nsStyleSVGReset(const nsStyleSVGReset& aSource); @@ -2286,8 +2314,17 @@ struct nsStyleSVGReset { return NS_CombineHint(nsChangeHint_UpdateEffects, NS_STYLE_HINT_REFLOW); } + // The backend only supports one SVG reference right now. + // Eventually, it will support multiple chained SVG reference filters and CSS + // filter functions. + nsIURI* SingleFilter() const { + return (mFilters.Length() == 1 && + mFilters[0].mType == nsStyleFilter::Type::eURL) ? + mFilters[0].mURL : nullptr; + } + nsCOMPtr mClipPath; // [reset] - nsCOMPtr mFilter; // [reset] + nsTArray mFilters; // [reset] nsCOMPtr mMask; // [reset] nscolor mStopColor; // [reset] nscolor mFloodColor; // [reset] diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 56feb7058d4..062f8c14669 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -4411,3 +4411,180 @@ if (SpecialPowers.getBoolPref("svg.paint-order.enabled")) { invalid_values: [ "fill stroke markers fill", "fill normal" ] }; } + +if (SpecialPowers.getBoolPref("layout.css.filters.enabled")) { + gCSSProperties["filter"] = { + domProp: "filter", + inherited: false, + type: CSS_TYPE_LONGHAND, + initial_values: [ "none" ], + other_values: [ + // SVG reference filters + "url(#my-filter)", + "url(#my-filter-1) url(#my-filter-2)", + + // Filter functions + "opacity(50%) saturate(1.0)", + "invert(50%) sepia(0.1) brightness(90%)", + + // Mixed SVG reference filters and filter functions + "grayscale(1) url(#my-filter-1)", + "url(#my-filter-1) brightness(50%) contrast(0.9)", + + "blur(0)", + "blur(0px)", + "blur(0.5px)", + "blur(3px)", + "blur(100px)", + "blur(0.1em)", + "blur(calc(-1px))", // Parses and becomes blur(0px). + "blur(calc(0px))", + "blur(calc(5px))", + "blur(calc(2 * 5px))", + + "brightness(0)", + "brightness(50%)", + "brightness(1)", + "brightness(1.0)", + "brightness(2)", + "brightness(350%)", + "brightness(4.567)", + + "contrast(0)", + "contrast(50%)", + "contrast(1)", + "contrast(1.0)", + "contrast(2)", + "contrast(350%)", + "contrast(4.567)", + + "grayscale(0)", + "grayscale(50%)", + "grayscale(1)", + "grayscale(1.0)", + "grayscale(2)", + "grayscale(350%)", + "grayscale(4.567)", + + "invert(0)", + "invert(50%)", + "invert(1)", + "invert(1.0)", + "invert(2)", + "invert(350%)", + "invert(4.567)", + + "opacity(0)", + "opacity(50%)", + "opacity(1)", + "opacity(1.0)", + "opacity(2)", + "opacity(350%)", + "opacity(4.567)", + + "saturate(0)", + "saturate(50%)", + "saturate(1)", + "saturate(1.0)", + "saturate(2)", + "saturate(350%)", + "saturate(4.567)", + + "sepia(0)", + "sepia(50%)", + "sepia(1)", + "sepia(1.0)", + "sepia(2)", + "sepia(350%)", + "sepia(4.567)", + ], + invalid_values: [ + // none + "none none", + "url(#my-filter) none", + "none url(#my-filter)", + "blur(2px) none url(#my-filter)", + + // Nested filters + "grayscale(invert(1.0))", + + // Comma delimited filters + "url(#my-filter),", + "invert(50%), url(#my-filter), brightness(90%)", + + // Test the following situations for each filter function: + // - Invalid number of arguments + // - Comma delimited arguments + // - Wrong argument type + // - Argument value out of range + "blur()", + "blur(3px 5px)", + "blur(3px,)", + "blur(3px, 5px)", + "blur(#my-filter)", + "blur(0.5)", + "blur(50%)", + "blur(calc(0))", // Unitless zero in calc is not a valid length. + "blur(calc(0.1))", + "blur(calc(10%))", + "blur(calc(20px - 5%))", + "blur(-3px)", + + "brightness()", + "brightness(0.5 0.5)", + "brightness(0.5,)", + "brightness(0.5, 0.5)", + "brightness(#my-filter)", + "brightness(10px)", + "brightness(-1)", + + "contrast()", + "contrast(0.5 0.5)", + "contrast(0.5,)", + "contrast(0.5, 0.5)", + "contrast(#my-filter)", + "contrast(10px)", + "contrast(-1)", + + "grayscale()", + "grayscale(0.5 0.5)", + "grayscale(0.5,)", + "grayscale(0.5, 0.5)", + "grayscale(#my-filter)", + "grayscale(10px)", + "grayscale(-1)", + + "invert()", + "invert(0.5 0.5)", + "invert(0.5,)", + "invert(0.5, 0.5)", + "invert(#my-filter)", + "invert(10px)", + "invert(-1)", + + "opacity()", + "opacity(0.5 0.5)", + "opacity(0.5,)", + "opacity(0.5, 0.5)", + "opacity(#my-filter)", + "opacity(10px)", + "opacity(-1)", + + "saturate()", + "saturate(0.5 0.5)", + "saturate(0.5,)", + "saturate(0.5, 0.5)", + "saturate(#my-filter)", + "saturate(10px)", + "saturate(-1)", + + "sepia()", + "sepia(0.5 0.5)", + "sepia(0.5,)", + "sepia(0.5, 0.5)", + "sepia(#my-filter)", + "sepia(10px)", + "sepia(-1)", + ] + }; +} diff --git a/layout/svg/nsSVGEffects.cpp b/layout/svg/nsSVGEffects.cpp index a684d65ccdf..1306dd8f262 100644 --- a/layout/svg/nsSVGEffects.cpp +++ b/layout/svg/nsSVGEffects.cpp @@ -450,7 +450,7 @@ nsSVGEffects::GetEffectProperties(nsIFrame *aFrame) EffectProperties result; const nsStyleSVGReset *style = aFrame->StyleSVGReset(); result.mFilter = static_cast - (GetEffectProperty(style->mFilter, aFrame, FilterProperty(), + (GetEffectProperty(style->SingleFilter(), aFrame, FilterProperty(), CreateFilterProperty)); result.mClipPath = GetPaintingProperty(style->mClipPath, aFrame, ClipPathProperty()); @@ -526,7 +526,7 @@ nsSVGEffects::UpdateEffects(nsIFrame *aFrame) // Ensure that the filter is repainted correctly // We can't do that in DoUpdate as the referenced frame may not be valid - GetEffectProperty(aFrame->StyleSVGReset()->mFilter, + GetEffectProperty(aFrame->StyleSVGReset()->SingleFilter(), aFrame, FilterProperty(), CreateFilterProperty); if (aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame && @@ -547,7 +547,7 @@ nsSVGEffects::GetFilterProperty(nsIFrame *aFrame) { NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame should be first continuation"); - if (!aFrame->StyleSVGReset()->mFilter) + if (!aFrame->StyleSVGReset()->SingleFilter()) return nullptr; return static_cast diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index eeb454e1a8b..5a7381b5562 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -150,7 +150,7 @@ nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame) // checking the SDL prefs here, since we don't know if we're being called for // painting or hit-testing anyway. const nsStyleSVGReset *style = aFrame->StyleSVGReset(); - return (style->mFilter || style->mClipPath || style->mMask); + return (style->SingleFilter() || style->mClipPath || style->mMask); } /* static */ nsPoint diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 50fdceb7680..85cda525fbe 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1269,7 +1269,7 @@ nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame) type != nsGkAtoms::svgPathGeometryFrame) { return false; } - if (aFrame->StyleSVGReset()->mFilter) { + if (aFrame->StyleSVGReset()->SingleFilter()) { return false; } // XXX The SVG WG is intending to allow fill, stroke and markers on diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 754eb33a1fd..bbab814fa2b 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -1774,6 +1774,9 @@ pref("layout.css.masking.enabled", true); // Is support for the the @supports rule enabled? pref("layout.css.supports-rule.enabled", true); +// Is support for CSS Filters enabled? +pref("layout.css.filters.enabled", false); + // Is support for CSS Flexbox enabled? pref("layout.css.flexbox.enabled", true); From e41e09833c179799555cdcf139da1ded85bee397 Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Mon, 22 Jul 2013 17:05:21 -0400 Subject: [PATCH 55/69] Bug 896250 - Return the max number, not the flag checking if the number was set. r=joe --- layout/base/nsDisplayList.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 40751d0a5d1..c2d52beec8c 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1500,7 +1500,7 @@ nsDisplayItem::ForceActiveLayers() /* static */ int32_t nsDisplayItem::MaxActiveLayers() { - static int32_t sMaxLayers = false; + static int32_t sMaxLayers = -1; static bool sMaxLayersCached = false; if (!sMaxLayersCached) { @@ -1508,7 +1508,7 @@ nsDisplayItem::MaxActiveLayers() sMaxLayersCached = true; } - return sMaxLayersCached; + return sMaxLayers; } bool From 5b4cbd93e5487b4875cc286e3e04099e7c3af69a Mon Sep 17 00:00:00 2001 From: Catalin Iordache Date: Tue, 23 Jul 2013 10:52:01 -0400 Subject: [PATCH 56/69] Bug 888628 - Create another field for HttpRetParams structure which keeps track of half open connections. r=valentin.gosu --- dom/webidl/NetDashboard.webidl | 5 +++++ netwerk/base/src/Dashboard.cpp | 20 ++++++++++++++++++- netwerk/base/src/DashboardTypes.h | 6 ++++++ netwerk/protocol/http/nsHttpConnectionMgr.cpp | 5 +++++ netwerk/protocol/http/nsHttpConnectionMgr.h | 2 +- 5 files changed, 36 insertions(+), 2 deletions(-) diff --git a/dom/webidl/NetDashboard.webidl b/dom/webidl/NetDashboard.webidl index 45692e04c61..23f200bc7b7 100644 --- a/dom/webidl/NetDashboard.webidl +++ b/dom/webidl/NetDashboard.webidl @@ -20,11 +20,16 @@ dictionary HttpConnInfoDict { sequence protocolVersion; }; +dictionary HalfOpenInfoDict { + sequence speculative; +}; + dictionary HttpConnDict { sequence host; sequence port; sequence active; sequence idle; + sequence halfOpens; sequence spdy; sequence ssl; }; diff --git a/netwerk/base/src/Dashboard.cpp b/netwerk/base/src/Dashboard.cpp index abe1aedc164..3f650e55001 100644 --- a/netwerk/base/src/Dashboard.cpp +++ b/netwerk/base/src/Dashboard.cpp @@ -138,11 +138,14 @@ Dashboard::GetHttpConnections() dict.mPort.Construct(); dict.mSpdy.Construct(); dict.mSsl.Construct(); + dict.mHalfOpens.Construct(); using mozilla::dom::HttpConnInfoDict; + using mozilla::dom::HalfOpenInfoDict; Sequence &active = dict.mActive.Value(); Sequence &hosts = dict.mHost.Value(); Sequence &idle = dict.mIdle.Value(); + Sequence &halfOpens = dict.mHalfOpens.Value(); Sequence &ports = dict.mPort.Value(); Sequence &spdy = dict.mSpdy.Value(); Sequence &ssl = dict.mSsl.Value(); @@ -150,7 +153,8 @@ Dashboard::GetHttpConnections() uint32_t length = mHttp.data.Length(); if (!active.SetCapacity(length) || !hosts.SetCapacity(length) || !idle.SetCapacity(length) || !ports.SetCapacity(length) || - !spdy.SetCapacity(length) || !ssl.SetCapacity(length)) { + !spdy.SetCapacity(length) || !ssl.SetCapacity(length) || + !halfOpens.SetCapacity(length)) { mHttp.cb = nullptr; mHttp.data.Clear(); JS_ReportOutOfMemory(cx); @@ -203,6 +207,20 @@ Dashboard::GetHttpConnections() *idle_ttl.AppendElement() = mHttp.data[i].idle[j].ttl; *idle_protocolVersion.AppendElement() = mHttp.data[i].idle[j].protocolVersion; } + + HalfOpenInfoDict &allHalfOpens = *halfOpens.AppendElement(); + allHalfOpens.mSpeculative.Construct(); + Sequence allHalfOpens_speculative; + if(!allHalfOpens_speculative.SetCapacity(mHttp.data[i].halfOpens.Length())) { + mHttp.cb = nullptr; + mHttp.data.Clear(); + JS_ReportOutOfMemory(cx); + return NS_ERROR_OUT_OF_MEMORY; + } + allHalfOpens_speculative = allHalfOpens.mSpeculative.Value(); + for(uint32_t j = 0; j < mHttp.data[i].halfOpens.Length(); j++) { + *allHalfOpens_speculative.AppendElement() = mHttp.data[i].halfOpens[j].speculative; + } } JS::RootedValue val(cx); diff --git a/netwerk/base/src/DashboardTypes.h b/netwerk/base/src/DashboardTypes.h index 954c72462aa..5045150f6e4 100644 --- a/netwerk/base/src/DashboardTypes.h +++ b/netwerk/base/src/DashboardTypes.h @@ -22,6 +22,11 @@ struct SocketInfo bool tcp; }; +struct HalfOpenSockets +{ + bool speculative; +}; + struct DNSCacheEntries { nsCString hostname; @@ -45,6 +50,7 @@ struct HttpRetParams nsCString host; nsTArray active; nsTArray idle; + nsTArray halfOpens; uint32_t counter; uint16_t port; bool spdy; diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index d098805809a..4c966968c55 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -3349,6 +3349,11 @@ nsHttpConnectionMgr::ReadConnectionEntry(const nsACString &key, info.SetHTTP1ProtocolVersion(ent->mIdleConns[i]->GetLastHttpResponseVersion()); data.idle.AppendElement(info); } + for(uint32_t i = 0; i < ent->mHalfOpens.Length(); i++) { + HalfOpenSockets hSocket; + hSocket.speculative = ent->mHalfOpens[i]->IsSpeculative(); + data.halfOpens.AppendElement(hSocket); + } data.spdy = ent->mUsingSpdy; data.ssl = ent->mConnInfo->UsingSSL(); args->AppendElement(data); diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h index 16036dd929f..9e539286d41 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.h +++ b/netwerk/protocol/http/nsHttpConnectionMgr.h @@ -277,7 +277,7 @@ private: nsTArray mPendingQ; // pending transaction queue nsTArray mActiveConns; // active connections nsTArray mIdleConns; // idle persistent connections - nsTArray mHalfOpens; + nsTArray mHalfOpens; // half open connections // calculate the number of half open sockets that have not had at least 1 // connection complete From 34d445b4a1f4253ae7270bee49c3d29f7853e3cb Mon Sep 17 00:00:00 2001 From: Michael Harrison Date: Tue, 23 Jul 2013 10:52:20 -0400 Subject: [PATCH 57/69] Bug 890367 - Correctly handle non-ASCII text in browser.newtab.url. r=ttaubert --- browser/base/content/utilityOverlay.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index d2fe495afeb..12529482955 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -18,7 +18,8 @@ XPCOMUtils.defineLazyGetter(this, "BROWSER_NEW_TAB_URL", function () { !PrivateBrowsingUtils.permanentPrivateBrowsing) return "about:privatebrowsing"; } - return Services.prefs.getCharPref(PREF) || "about:blank"; + let url = Services.prefs.getComplexValue(PREF, Ci.nsISupportsString).data; + return url || "about:blank"; } function update() { From 742db914d3b6197dc9f0fb185b37f6c39a73fb76 Mon Sep 17 00:00:00 2001 From: Ryan VanderMeulen Date: Tue, 23 Jul 2013 11:13:50 -0400 Subject: [PATCH 58/69] Backed out changeset 83f4f6f435cf (bug 734861) for mochitest-5 timeouts. --- layout/inspector/public/inIDOMUtils.idl | 3 -- layout/inspector/src/inDOMUtils.cpp | 44 ------------------- layout/inspector/tests/Makefile.in | 1 - .../tests/test_get_all_style_sheets.html | 40 ----------------- 4 files changed, 88 deletions(-) delete mode 100644 layout/inspector/tests/test_get_all_style_sheets.html diff --git a/layout/inspector/public/inIDOMUtils.idl b/layout/inspector/public/inIDOMUtils.idl index 18a78600083..02243692197 100644 --- a/layout/inspector/public/inIDOMUtils.idl +++ b/layout/inspector/public/inIDOMUtils.idl @@ -20,9 +20,6 @@ interface nsIDOMCSSStyleSheet; interface inIDOMUtils : nsISupports { // CSS utilities - void getAllStyleSheets (in nsIDOMDocument aDoc, - [optional] out unsigned long aLength, - [array, size_is (aLength), retval] out nsISupports aSheets); nsISupportsArray getCSSStyleRules(in nsIDOMElement aElement, [optional] in DOMString aPseudo); unsigned long getRuleLine(in nsIDOMCSSStyleRule aRule); unsigned long getRuleColumn(in nsIDOMCSSStyleRule aRule); diff --git a/layout/inspector/src/inDOMUtils.cpp b/layout/inspector/src/inDOMUtils.cpp index eb166575235..6990e7a1a25 100644 --- a/layout/inspector/src/inDOMUtils.cpp +++ b/layout/inspector/src/inDOMUtils.cpp @@ -36,7 +36,6 @@ #include "mozilla/dom/InspectorUtilsBinding.h" #include "nsCSSProps.h" #include "nsColor.h" -#include "nsStyleSet.h" using namespace mozilla; using namespace mozilla::css; @@ -57,49 +56,6 @@ NS_IMPL_ISUPPORTS1(inDOMUtils, inIDOMUtils) /////////////////////////////////////////////////////////////////////////////// // inIDOMUtils -NS_IMETHODIMP -inDOMUtils::GetAllStyleSheets(nsIDOMDocument *aDocument, uint32_t *aLength, - nsISupports ***aSheets) -{ - NS_ENSURE_ARG_POINTER(aDocument); - - nsCOMArray sheets; - - nsCOMPtr document = do_QueryInterface(aDocument); - MOZ_ASSERT(document); - - // Get the agent, then user sheets in the style set. - nsIPresShell* presShell = document->GetShell(); - if (presShell) { - nsStyleSet* styleSet = presShell->StyleSet(); - nsStyleSet::sheetType sheetType = nsStyleSet::eAgentSheet; - for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) { - sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i)); - } - sheetType = nsStyleSet::eUserSheet; - for (int32_t i = 0; i < styleSet->SheetCount(sheetType); i++) { - sheets.AppendElement(styleSet->StyleSheetAt(sheetType, i)); - } - } - - // Get the document sheets. - for (int32_t i = 0; i < document->GetNumberOfStyleSheets(); i++) { - sheets.AppendElement(document->GetStyleSheetAt(i)); - } - - nsISupports** ret = static_cast(NS_Alloc(sheets.Count() * - sizeof(nsISupports*))); - - for (int32_t i = 0; i < sheets.Count(); i++) { - NS_ADDREF(ret[i] = sheets[i]); - } - - *aLength = sheets.Count(); - *aSheets = ret; - - return NS_OK; -} - NS_IMETHODIMP inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode, bool *aReturn) diff --git a/layout/inspector/tests/Makefile.in b/layout/inspector/tests/Makefile.in index 27fa9d12388..e28bc0a765f 100644 --- a/layout/inspector/tests/Makefile.in +++ b/layout/inspector/tests/Makefile.in @@ -24,7 +24,6 @@ MOCHITEST_FILES =\ bug856317.css \ test_isinheritableproperty.html \ test_bug877690.html \ - test_get_all_style_sheets.html \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/layout/inspector/tests/test_get_all_style_sheets.html b/layout/inspector/tests/test_get_all_style_sheets.html deleted file mode 100644 index a3a93572fcd..00000000000 --- a/layout/inspector/tests/test_get_all_style_sheets.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - Test for Bug 734861 - - - - - -Mozilla Bug 734861 -

- -
-
- - From daca74ad0a05cf2ee62b80b42856aa35492ad998 Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Tue, 23 Jul 2013 08:32:36 -0700 Subject: [PATCH 59/69] Bug 895340 - Fix error reporting of JS exceptions from C++ (r=bholley) --- dom/base/nsJSEnvironment.cpp | 4 +- js/xpconnect/idl/nsIXPConnect.idl | 9 ++- js/xpconnect/src/XPCWrappedJSClass.cpp | 8 ++- js/xpconnect/src/nsXPConnect.cpp | 8 +++ js/xpconnect/src/xpcprivate.h | 5 ++ js/xpconnect/tests/chrome/Makefile.in | 1 + js/xpconnect/tests/chrome/test_bug895340.xul | 63 ++++++++++++++++++++ 7 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 js/xpconnect/tests/chrome/test_bug895340.xul diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index be638a742e0..2529bb04644 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -469,11 +469,12 @@ NS_ScriptErrorReporter(JSContext *cx, // We don't want to report exceptions too eagerly, but warnings in the // absence of werror are swallowed whole, so report those now. if (!JSREPORT_IS_WARNING(report->flags)) { + nsIXPConnect* xpc = nsContentUtils::XPConnect(); if (JS_DescribeScriptedCaller(cx, nullptr, nullptr)) { + xpc->MarkErrorUnreported(cx); return; } - nsIXPConnect* xpc = nsContentUtils::XPConnect(); if (xpc) { nsAXPCNativeCallContext *cc = nullptr; xpc->GetCurrentNativeCallContext(&cc); @@ -483,6 +484,7 @@ NS_ScriptErrorReporter(JSContext *cx, uint16_t lang; if (NS_SUCCEEDED(prev->GetLanguage(&lang)) && lang == nsAXPCNativeCallContext::LANG_JS) { + xpc->MarkErrorUnreported(cx); return; } } diff --git a/js/xpconnect/idl/nsIXPConnect.idl b/js/xpconnect/idl/nsIXPConnect.idl index 9fdb99daf15..400d233f6f7 100644 --- a/js/xpconnect/idl/nsIXPConnect.idl +++ b/js/xpconnect/idl/nsIXPConnect.idl @@ -291,7 +291,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports { 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } } %} -[uuid(3bc074e6-2102-40a4-8c84-38b002c9e2f1)] +[uuid(0ebc00f0-f3ad-11e2-b778-0800200c9a66)] interface nsIXPConnect : nsISupports { %{ C++ @@ -631,4 +631,11 @@ interface nsIXPConnect : nsISupports [noscript] JSObjectPtr readFunction(in nsIObjectInputStream aStream, in JSContextPtr aJSContext); + + /** + * This function should be called in JavaScript error reporters + * to signal that they are ignoring the error. In this case, + * XPConnect can print a warning to the console. + */ + [noscript] void markErrorUnreported(in JSContextPtr aJSContext); }; diff --git a/js/xpconnect/src/XPCWrappedJSClass.cpp b/js/xpconnect/src/XPCWrappedJSClass.cpp index 6c89b17c5b1..51c4c6f2d10 100644 --- a/js/xpconnect/src/XPCWrappedJSClass.cpp +++ b/js/xpconnect/src/XPCWrappedJSClass.cpp @@ -1021,8 +1021,14 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx, // Try to use the error reporter set on the context to handle this // error if it came from a JS exception. if (reportable && is_js_exception && - JS_GetErrorReporter(cx) != xpcWrappedJSErrorReporter) { + JS_GetErrorReporter(cx) != xpcWrappedJSErrorReporter) + { + // If the error reporter ignores the error, it will call + // xpc->MarkErrorUnreported(). + xpcc->ClearUnreportedError(); reportable = !JS_ReportPendingException(cx); + if (!xpcc->WasErrorReported()) + reportable = true; } if (reportable) { diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index eb4e90759b7..147a2b52b97 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -1648,6 +1648,14 @@ nsXPConnect::ReadFunction(nsIObjectInputStream *stream, JSContext *cx, JSObject return ReadScriptOrFunction(stream, cx, nullptr, functionObjp); } +NS_IMETHODIMP +nsXPConnect::MarkErrorUnreported(JSContext *cx) +{ + XPCContext *xpcc = XPCContext::GetXPCContext(cx); + xpcc->MarkErrorUnreported(); + return NS_OK; +} + /* These are here to be callable from a debugger */ extern "C" { JS_EXPORT_API(void) DumpJSStack() diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index e3e89e8067d..2db6fa23f76 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -957,6 +957,10 @@ public: void AddScope(PRCList *scope) { PR_INSERT_AFTER(scope, &mScopes); } void RemoveScope(PRCList *scope) { PR_REMOVE_LINK(scope); } + void MarkErrorUnreported() { mErrorUnreported = true; } + void ClearUnreportedError() { mErrorUnreported = false; } + bool WasErrorReported() { return !mErrorUnreported; } + ~XPCContext(); private: @@ -972,6 +976,7 @@ private: nsresult mPendingResult; nsIException* mException; LangType mCallingLangType; + bool mErrorUnreported; // A linked list of scopes to notify when we are destroyed. PRCList mScopes; diff --git a/js/xpconnect/tests/chrome/Makefile.in b/js/xpconnect/tests/chrome/Makefile.in index 48708fcac4c..e0c035907ff 100644 --- a/js/xpconnect/tests/chrome/Makefile.in +++ b/js/xpconnect/tests/chrome/Makefile.in @@ -50,6 +50,7 @@ MOCHITEST_CHROME_FILES = \ test_bug812415.xul \ test_bug853283.xul \ test_bug853571.xul \ + test_bug895340.xul \ test_APIExposer.xul \ test_chrometoSource.xul \ outoflinexulscript.js \ diff --git a/js/xpconnect/tests/chrome/test_bug895340.xul b/js/xpconnect/tests/chrome/test_bug895340.xul new file mode 100644 index 00000000000..bda90988914 --- /dev/null +++ b/js/xpconnect/tests/chrome/test_bug895340.xul @@ -0,0 +1,63 @@ + + + + + + + + + + Mozilla Bug 895340 + + + + + From 2f25ec216642faa04da55d8d1eb01c46764d5bff Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 23 Jul 2013 17:34:57 +0200 Subject: [PATCH 60/69] Bug 892225 - backout changeset b4426d926b31. --- .../tests/collections/Array-iterator-surfaces.js | 4 ---- js/src/jsarray.cpp | 9 +-------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 js/src/jit-test/tests/collections/Array-iterator-surfaces.js diff --git a/js/src/jit-test/tests/collections/Array-iterator-surfaces.js b/js/src/jit-test/tests/collections/Array-iterator-surfaces.js deleted file mode 100644 index e4779ee581f..00000000000 --- a/js/src/jit-test/tests/collections/Array-iterator-surfaces.js +++ /dev/null @@ -1,4 +0,0 @@ -// Array.prototype.iterator is the same function object as .values. - -assertEq(Array.prototype.values, Array.prototype.iterator); -assertEq(Array.prototype.iterator.name, "values"); diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index 61d66ceb5ce..f537e301362 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -2820,6 +2820,7 @@ static const JSFunctionSpec array_methods[] = { {"find", {NULL, NULL}, 1,0, "ArrayFind"}, {"findIndex", {NULL, NULL}, 1,0, "ArrayFindIndex"}, + JS_FN("iterator", JS_ArrayIterator, 0,0), JS_FS_END }; @@ -2950,14 +2951,6 @@ js_InitArrayClass(JSContext *cx, HandleObject obj) if (!DefineConstructorAndPrototype(cx, global, JSProto_Array, ctor, arrayProto)) return NULL; - JSFunction *fun = JS_DefineFunction(cx, arrayProto, "values", JS_ArrayIterator, 0, 0); - if (!fun) - return NULL; - - RootedValue funval(cx, ObjectValue(*fun)); - if (!JS_DefineProperty(cx, arrayProto, "iterator", funval, NULL, NULL, 0)) - return NULL; - return arrayProto; } From b8d2e3631d9729db0d91153705619fad27c4a1ad Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 23 Jul 2013 16:36:45 +0100 Subject: [PATCH 61/69] Backed out changeset f24d81b85929 (bug 895182) for Windows build failures on a CLOSED TREE --- .../en-US/chrome/layout/css.properties | 5 - layout/base/nsLayoutUtils.cpp | 16 -- layout/base/nsLayoutUtils.h | 5 - layout/generic/nsFrame.cpp | 2 +- layout/style/nsCSSKeywordList.h | 8 - layout/style/nsCSSParser.cpp | 144 -------------- layout/style/nsCSSPropList.h | 4 +- layout/style/nsCSSProps.h | 5 +- layout/style/nsComputedDOMStyle.cpp | 93 +-------- layout/style/nsComputedDOMStyle.h | 5 - layout/style/nsRuleNode.cpp | 98 +--------- layout/style/nsStyleStruct.cpp | 49 +---- layout/style/nsStyleStruct.h | 39 +--- layout/style/test/property_database.js | 177 ------------------ layout/svg/nsSVGEffects.cpp | 6 +- layout/svg/nsSVGIntegrationUtils.cpp | 2 +- layout/svg/nsSVGUtils.cpp | 2 +- modules/libpref/src/init/all.js | 3 - 18 files changed, 31 insertions(+), 632 deletions(-) diff --git a/dom/locales/en-US/chrome/layout/css.properties b/dom/locales/en-US/chrome/layout/css.properties index 8deeea9d3e0..8a476f87d97 100644 --- a/dom/locales/en-US/chrome/layout/css.properties +++ b/dom/locales/en-US/chrome/layout/css.properties @@ -137,8 +137,3 @@ PESupportsConditionExpectedCloseParen=Expected ')' while parsing supports condit PESupportsConditionExpectedStart2=Expected 'not', '(', or function while parsing supports condition but found '%1$S'. PESupportsConditionExpectedNot=Expected 'not' while parsing supports condition but found '%1$S'. PESupportsGroupRuleStart=Expected '{' to begin @supports rule but found '%1$S'. -PEFilterEOF=filter -PEExpectedNoneOrURL=Expected 'none' or URL but found '%1$S'. -PEExpectedNoneOrURLOrFilterFunction=Expected 'none', URL, or filter function but found '%1$S'. -PEExpectedNonnegativeNP=Expected non-negative number or percentage. -PEFilterFunctionArgumentsParsingError=Error in parsing arguments for filter function. diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index dddbf7941f4..7acf55bd140 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -384,22 +384,6 @@ nsLayoutUtils::AnimatedImageLayersEnabled() return sAnimatedImageLayersEnabled; } -bool -nsLayoutUtils::CSSFiltersEnabled() -{ - static bool sCSSFiltersEnabled; - static bool sCSSFiltersPrefCached = false; - - if (!sCSSFiltersPrefCached) { - sCSSFiltersPrefCached = true; - Preferences::AddBoolVarCache(&sCSSFiltersEnabled, - "layout.css.filters.enabled", - false); - } - - return sCSSFiltersEnabled; -} - void nsLayoutUtils::UnionChildOverflow(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas) diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index a6ad3441536..0efdf5d7e0c 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1622,11 +1622,6 @@ public: */ static bool AnimatedImageLayersEnabled(); - /** - * Checks if we should enable parsing for CSS Filters. - */ - static bool CSSFiltersEnabled(); - /** * Unions the overflow areas of all non-popup children of aFrame with * aOverflowAreas. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index f9a3de05c68..39d3656479b 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4961,7 +4961,7 @@ ComputeOutlineAndEffectsRect(nsIFrame* aFrame, // For SVG frames, we only need to account for filters. // TODO: We could also take account of clipPath and mask to reduce the // visual overflow, but that's not essential. - if (aFrame->StyleSVGReset()->SingleFilter()) { + if (aFrame->StyleSVGReset()->mFilter) { if (aStoreRectProperties) { aFrame->Properties(). Set(nsIFrame::PreEffectsBBoxProperty(), new nsRect(r)); diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 0205580ac60..3dab8884994 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -182,7 +182,6 @@ CSS_KEY(bidi-override, bidi_override) CSS_KEY(blink, blink) CSS_KEY(block, block) CSS_KEY(block-axis, block_axis) -CSS_KEY(blur, blur) CSS_KEY(bold, bold) CSS_KEY(bolder, bolder) CSS_KEY(border-box, border_box) @@ -192,7 +191,6 @@ CSS_KEY(bottom-outside, bottom_outside) CSS_KEY(bounding-box, bounding_box) CSS_KEY(break-all, break_all) CSS_KEY(break-word, break_word) -CSS_KEY(brightness, brightness) CSS_KEY(button, button) CSS_KEY(buttonface, buttonface) CSS_KEY(buttonhighlight, buttonhighlight) @@ -222,7 +220,6 @@ CSS_KEY(contain, contain) CSS_KEY(content-box, content_box) CSS_KEY(context-menu, context_menu) CSS_KEY(continuous, continuous) -CSS_KEY(contrast, contrast) CSS_KEY(copy, copy) CSS_KEY(contextual, contextual) CSS_KEY(cover, cover) @@ -273,7 +270,6 @@ CSS_KEY(forwards, forwards) CSS_KEY(full-width, full_width) CSS_KEY(georgian, georgian) CSS_KEY(grad, grad) -CSS_KEY(grayscale, grayscale) CSS_KEY(graytext, graytext) CSS_KEY(groove, groove) CSS_KEY(hebrew, hebrew) @@ -310,7 +306,6 @@ CSS_KEY(inline-table, inline_table) CSS_KEY(inset, inset) CSS_KEY(inside, inside) CSS_KEY(interpolatematrix, interpolatematrix) -CSS_KEY(invert, invert) CSS_KEY(italic, italic) CSS_KEY(jis78, jis78) CSS_KEY(jis83, jis83) @@ -374,7 +369,6 @@ CSS_KEY(nw-resize, nw_resize) CSS_KEY(nwse-resize, nwse_resize) CSS_KEY(oblique, oblique) CSS_KEY(oldstyle-nums, oldstyle_nums) -CSS_KEY(opacity, opacity) CSS_KEY(open-quote, open_quote) CSS_KEY(ordinal, ordinal) CSS_KEY(ornaments, ornaments) @@ -424,7 +418,6 @@ CSS_KEY(ruby, ruby) CSS_KEY(running, running) CSS_KEY(s, s) CSS_KEY(s-resize, s_resize) -CSS_KEY(saturate, saturate) CSS_KEY(scale, scale) CSS_KEY(scale3d, scale3d) CSS_KEY(scalex, scalex) @@ -442,7 +435,6 @@ CSS_KEY(select-same, select_same) CSS_KEY(semi-condensed, semi_condensed) CSS_KEY(semi-expanded, semi_expanded) CSS_KEY(separate, separate) -CSS_KEY(sepia, sepia) CSS_KEY(show, show) CSS_KEY(simplified, simplified) CSS_KEY(skew, skew) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 069e248c41a..70072b626be 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -604,10 +604,6 @@ protected: /* Functions for transform-origin/perspective-origin Parsing */ bool ParseTransformOrigin(bool aPerspective); - /* Functions for filter parsing */ - bool ParseFilter(); - bool ParseSingleFilter(nsCSSValue* aValue); - /* Find and return the namespace ID associated with aPrefix. If aPrefix has not been declared in an @namespace rule, returns kNameSpaceID_Unknown. */ @@ -6474,8 +6470,6 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID) return ParseCounterData(aPropID); case eCSSProperty_cursor: return ParseCursor(); - case eCSSProperty_filter: - return ParseFilter(); case eCSSProperty_flex: return ParseFlex(); case eCSSProperty_font: @@ -10038,144 +10032,6 @@ bool CSSParserImpl::ParseTransformOrigin(bool aPerspective) return true; } -/** - * Reads a single url or filter function from the tokenizer stream, reporting an - * error if something goes wrong. - */ -bool -CSSParserImpl::ParseSingleFilter(nsCSSValue* aValue) -{ - if (ParseVariant(*aValue, VARIANT_URL, nullptr)) { - return true; - } - - if (!nsLayoutUtils::CSSFiltersEnabled()) { - // With CSS Filters disabled, we should only accept an SVG reference filter. - REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURL); - return false; - } - - if (!GetToken(true)) { - REPORT_UNEXPECTED_EOF(PEFilterEOF); - return false; - } - - if (mToken.mType != eCSSToken_Function) { - REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURLOrFilterFunction); - return false; - } - - // Set up the parsing rules based on the filter function. - int32_t variantMask = VARIANT_PN; - bool rejectNegativeArgument = true; - bool clampArgumentToOne = false; - nsCSSKeyword functionName = nsCSSKeywords::LookupKeyword(mToken.mIdent); - switch (functionName) { - case eCSSKeyword_blur: - variantMask = VARIANT_LCALC | VARIANT_NONNEGATIVE_DIMENSION; - // VARIANT_NONNEGATIVE_DIMENSION will already reject negative lengths. - rejectNegativeArgument = false; - break; - case eCSSKeyword_grayscale: - case eCSSKeyword_invert: - case eCSSKeyword_sepia: - case eCSSKeyword_opacity: - clampArgumentToOne = true; - break; - case eCSSKeyword_brightness: - case eCSSKeyword_contrast: - case eCSSKeyword_saturate: - break; - default: - // Unrecognized filter function. - REPORT_UNEXPECTED_TOKEN(PEExpectedNoneOrURLOrFilterFunction); - SkipUntil(')'); - return false; - } - - // Parse the function. - uint16_t minElems = 1U; - uint16_t maxElems = 1U; - uint32_t allVariants = 0; - if (!ParseFunction(functionName, &variantMask, allVariants, - minElems, maxElems, *aValue)) { - REPORT_UNEXPECTED(PEFilterFunctionArgumentsParsingError); - return false; - } - - // Get the first and only argument to the filter function. - NS_ABORT_IF_FALSE(aValue->GetUnit() == eCSSUnit_Function, - "expected a filter function"); - NS_ABORT_IF_FALSE(aValue->UnitHasArrayValue(), - "filter function should be an array"); - NS_ABORT_IF_FALSE(aValue->GetArrayValue()->Count() == 2, - "filter function should have exactly one argument"); - nsCSSValue& arg = aValue->GetArrayValue()->Item(1); - - if (rejectNegativeArgument && - ((arg.GetUnit() == eCSSUnit_Percent && arg.GetPercentValue() < 0.0f) || - (arg.GetUnit() == eCSSUnit_Number && arg.GetFloatValue() < 0.0f))) { - REPORT_UNEXPECTED(PEExpectedNonnegativeNP); - return false; - } - - if (clampArgumentToOne) { - if (arg.GetUnit() == eCSSUnit_Number && - arg.GetFloatValue() > 1.0f) { - arg.SetFloatValue(1.0f, arg.GetUnit()); - } else if (arg.GetUnit() == eCSSUnit_Percent && - arg.GetPercentValue() > 1.0f) { - arg.SetPercentValue(1.0f); - } - } - - return true; -} - -/** - * Parses a filter property value by continuously reading in urls and/or filter - * functions and constructing a list. - * - * When CSS Filters are enabled, the filter property accepts one or more SVG - * reference filters and/or CSS filter functions. - * e.g. filter: url(#my-filter-1) blur(3px) url(#my-filter-2) grayscale(50%); - * - * When CSS Filters are disabled, the filter property only accepts one SVG - * reference filter. - * e.g. filter: url(#my-filter); - */ -bool -CSSParserImpl::ParseFilter() -{ - nsCSSValue value; - if (ParseVariant(value, VARIANT_INHERIT | VARIANT_NONE, nullptr)) { - // 'inherit', 'initial', and 'none' must be alone - if (!ExpectEndProperty()) { - return false; - } - } else { - nsCSSValueList* cur = value.SetListValue(); - while (cur) { - if (!ParseSingleFilter(&cur->mValue)) { - return false; - } - if (CheckEndProperty()) { - break; - } - if (!nsLayoutUtils::CSSFiltersEnabled()) { - // With CSS Filters disabled, we should only accept one SVG reference - // filter. - REPORT_UNEXPECTED_TOKEN(PEExpectEndValue); - return false; - } - cur->mNext = new nsCSSValueList; - cur = cur->mNext; - } - } - AppendValue(eCSSProperty_filter, value); - return true; -} - bool CSSParserImpl::ParseTransitionProperty() { diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 6355573f143..836f14fa5b9 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -3327,9 +3327,9 @@ CSS_PROP_SVGRESET( filter, filter, Filter, - CSS_PROPERTY_PARSE_FUNCTION, + CSS_PROPERTY_PARSE_VALUE, "", - 0, + VARIANT_HUO, nullptr, CSS_PROP_NO_OFFSET, eStyleAnimType_None) diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index 8f0860b0c05..d8418ac5355 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -89,9 +89,8 @@ #define VARIANT_UK (VARIANT_URL | VARIANT_KEYWORD) #define VARIANT_UO (VARIANT_URL | VARIANT_NONE) #define VARIANT_ANGLE_OR_ZERO (VARIANT_ANGLE | VARIANT_ZERO_ANGLE) -#define VARIANT_LCALC (VARIANT_LENGTH | VARIANT_CALC) -#define VARIANT_LPCALC (VARIANT_LCALC | VARIANT_PERCENT) -#define VARIANT_LNCALC (VARIANT_LCALC | VARIANT_NUMBER) +#define VARIANT_LPCALC (VARIANT_LENGTH | VARIANT_CALC | VARIANT_PERCENT) +#define VARIANT_LNCALC (VARIANT_LENGTH | VARIANT_CALC | VARIANT_NUMBER) #define VARIANT_LPNCALC (VARIANT_LNCALC | VARIANT_PERCENT) #define VARIANT_IMAGE (VARIANT_URL | VARIANT_NONE | VARIANT_GRADIENT | \ VARIANT_IMAGE_RECT | VARIANT_ELEMENT) diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 741853d6bff..f466d98aeed 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -4468,96 +4468,19 @@ nsComputedDOMStyle::DoGetClipPath() return val; } -void -nsComputedDOMStyle::SetCssTextToCoord(nsAString& aCssText, - const nsStyleCoord& aCoord) -{ - nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue; - bool clampNegativeCalc = true; - SetValueToCoord(value, aCoord, clampNegativeCalc); - value->GetCssText(aCssText); - delete value; -} - -static void -GetFilterFunctionName(nsAString& aString, nsStyleFilter::Type mType) -{ - switch (mType) { - case nsStyleFilter::Type::eBlur: - aString.AssignLiteral("blur("); - break; - case nsStyleFilter::Type::eBrightness: - aString.AssignLiteral("brightness("); - break; - case nsStyleFilter::Type::eContrast: - aString.AssignLiteral("contrast("); - break; - case nsStyleFilter::Type::eGrayscale: - aString.AssignLiteral("grayscale("); - break; - case nsStyleFilter::Type::eInvert: - aString.AssignLiteral("invert("); - break; - case nsStyleFilter::Type::eOpacity: - aString.AssignLiteral("opacity("); - break; - case nsStyleFilter::Type::eSaturate: - aString.AssignLiteral("saturate("); - break; - case nsStyleFilter::Type::eSepia: - aString.AssignLiteral("sepia("); - break; - default: - NS_NOTREACHED("unrecognized filter type"); - } -} - -nsROCSSPrimitiveValue* -nsComputedDOMStyle::CreatePrimitiveValueForStyleFilter( - const nsStyleFilter& aStyleFilter) -{ - nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue; - - // Handle url(). - if (nsStyleFilter::Type::eURL == aStyleFilter.mType) { - value->SetURI(aStyleFilter.mURL); - return value; - } - - // Filter function name and opening parenthesis. - nsAutoString filterFunctionString; - GetFilterFunctionName(filterFunctionString, aStyleFilter.mType); - - // Filter function argument. - nsAutoString argumentString; - SetCssTextToCoord(argumentString, aStyleFilter.mCoord); - filterFunctionString.Append(argumentString); - - // Filter function closing parenthesis. - filterFunctionString.AppendLiteral(")"); - - value->SetString(filterFunctionString); - return value; -} - CSSValue* nsComputedDOMStyle::DoGetFilter() { - const nsTArray& filters = StyleSVGReset()->mFilters; + nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue; - if (filters.IsEmpty()) { - nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue; - value->SetIdent(eCSSKeyword_none); - return value; - } + const nsStyleSVGReset* svg = StyleSVGReset(); - nsDOMCSSValueList* valueList = GetROCSSValueList(false); - for(uint32_t i = 0; i < filters.Length(); i++) { - nsROCSSPrimitiveValue* value = - CreatePrimitiveValueForStyleFilter(filters[i]); - valueList->AppendCSSValue(value); - } - return valueList; + if (svg->mFilter) + val->SetURI(svg->mFilter); + else + val->SetIdent(eCSSKeyword_none); + + return val; } CSSValue* diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 0b0f47ca6a4..4ce1d7d0993 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -491,11 +491,6 @@ private: bool GetFrameBorderRectWidth(nscoord& aWidth); bool GetFrameBorderRectHeight(nscoord& aHeight); - /* Helper functions for computing the filter property style. */ - void SetCssTextToCoord(nsAString& aCssText, const nsStyleCoord& aCoord); - nsROCSSPrimitiveValue* CreatePrimitiveValueForStyleFilter( - const nsStyleFilter& aStyleFilter); - struct ComputedStyleMapEntry { // Create a pointer-to-member-function type. diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 8c3afba855f..e507ac5cd9d 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -7707,68 +7707,6 @@ nsRuleNode::ComputeSVGData(void* aStartStruct, COMPUTE_END_INHERITED(SVG, svg) } -static nsStyleFilter::Type -StyleFilterTypeForFunctionName(nsCSSKeyword functionName) -{ - switch (functionName) { - case eCSSKeyword_blur: - return nsStyleFilter::Type::eBlur; - case eCSSKeyword_brightness: - return nsStyleFilter::Type::eBrightness; - case eCSSKeyword_contrast: - return nsStyleFilter::Type::eContrast; - case eCSSKeyword_grayscale: - return nsStyleFilter::Type::eGrayscale; - case eCSSKeyword_invert: - return nsStyleFilter::Type::eInvert; - case eCSSKeyword_opacity: - return nsStyleFilter::Type::eOpacity; - case eCSSKeyword_saturate: - return nsStyleFilter::Type::eSaturate; - case eCSSKeyword_sepia: - return nsStyleFilter::Type::eSepia; - default: - NS_NOTREACHED("Unknown filter type."); - return nsStyleFilter::Type::eNull; - } -} - -static void -SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter, - const nsCSSValue& aValue, - nsStyleContext* aStyleContext, - nsPresContext* aPresContext, - bool& aCanStoreInRuleTree) -{ - nsCSSUnit unit = aValue.GetUnit(); - if (unit == eCSSUnit_URL) { - aStyleFilter->mType = nsStyleFilter::Type::eURL; - aStyleFilter->mURL = aValue.GetURLValue(); - return; - } - - NS_ABORT_IF_FALSE(unit == eCSSUnit_Function, "expected a filter function"); - - nsCSSValue::Array* filterFunction = aValue.GetArrayValue(); - nsCSSKeyword functionName = - (nsCSSKeyword)filterFunction->Item(0).GetIntValue(); - aStyleFilter->mType = StyleFilterTypeForFunctionName(functionName); - - int32_t mask = SETCOORD_PERCENT | SETCOORD_FACTOR; - if (aStyleFilter->mType == nsStyleFilter::Type::eBlur) - mask = SETCOORD_LENGTH | SETCOORD_STORE_CALC; - - NS_ABORT_IF_FALSE(filterFunction->Count() == 2, - "all filter functions except drop-shadow should have " - "exactly one argument"); - - nsCSSValue& arg = filterFunction->Item(1); - DebugOnly success = SetCoord(arg, aStyleFilter->mCoord, nsStyleCoord(), - mask, aStyleContext, aPresContext, - aCanStoreInRuleTree); - NS_ABORT_IF_FALSE(success, "unexpected unit"); -} - const void* nsRuleNode::ComputeSVGResetData(void* aStartStruct, const nsRuleData* aRuleData, @@ -7845,34 +7783,14 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct, // filter: url, none, inherit const nsCSSValue* filterValue = aRuleData->ValueForFilter(); - switch (filterValue->GetUnit()) { - case eCSSUnit_Null: - break; - case eCSSUnit_None: - case eCSSUnit_Initial: - svgReset->mFilters.Clear(); - break; - case eCSSUnit_Inherit: - canStoreInRuleTree = false; - svgReset->mFilters = parentSVGReset->mFilters; - break; - case eCSSUnit_List: - case eCSSUnit_ListDep: { - svgReset->mFilters.Clear(); - const nsCSSValueList* cur = filterValue->GetListValue(); - while(cur) { - nsStyleFilter styleFilter; - SetStyleFilterToCSSValue(&styleFilter, cur->mValue, aContext, - mPresContext, canStoreInRuleTree); - NS_ABORT_IF_FALSE(styleFilter.mType != nsStyleFilter::Type::eNull, - "filter should be set"); - svgReset->mFilters.AppendElement(styleFilter); - cur = cur->mNext; - } - break; - } - default: - NS_NOTREACHED("unexpected unit"); + if (eCSSUnit_URL == filterValue->GetUnit()) { + svgReset->mFilter = filterValue->GetURLValue(); + } else if (eCSSUnit_None == filterValue->GetUnit() || + eCSSUnit_Initial == filterValue->GetUnit()) { + svgReset->mFilter = nullptr; + } else if (eCSSUnit_Inherit == filterValue->GetUnit()) { + canStoreInRuleTree = false; + svgReset->mFilter = parentSVGReset->mFilter; } // mask: url, none, inherit diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index f09d82b1bd7..06f8f065b67 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1000,48 +1000,6 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const return hint; } -// -------------------- -// nsStyleFilter -// -nsStyleFilter::nsStyleFilter() - : mType(eNull) -{ - MOZ_COUNT_CTOR(nsStyleFilter); -} - -nsStyleFilter::nsStyleFilter(const nsStyleFilter& aSource) - : mType(aSource.mType) -{ - MOZ_COUNT_CTOR(nsStyleFilter); - - if (mType == eURL) { - mURL = aSource.mURL; - } else if (mType != eNull) { - mCoord = aSource.mCoord; - } -} - -nsStyleFilter::~nsStyleFilter() -{ - MOZ_COUNT_DTOR(nsStyleFilter); -} - -bool -nsStyleFilter::operator==(const nsStyleFilter& aOther) const -{ - if (mType != aOther.mType) { - return false; - } - - if (mType == eURL) { - return EqualURIs(mURL, aOther.mURL); - } else if (mType != eNull) { - return mCoord == aOther.mCoord; - } - - return true; -} - // -------------------- // nsStyleSVGReset // @@ -1052,6 +1010,7 @@ nsStyleSVGReset::nsStyleSVGReset() mFloodColor = NS_RGB(0,0,0); mLightingColor = NS_RGB(255,255,255); mClipPath = nullptr; + mFilter = nullptr; mMask = nullptr; mStopOpacity = 1.0f; mFloodOpacity = 1.0f; @@ -1072,7 +1031,7 @@ nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource) mFloodColor = aSource.mFloodColor; mLightingColor = aSource.mLightingColor; mClipPath = aSource.mClipPath; - mFilters = aSource.mFilters; + mFilter = aSource.mFilter; mMask = aSource.mMask; mStopOpacity = aSource.mStopOpacity; mFloodOpacity = aSource.mFloodOpacity; @@ -1086,8 +1045,8 @@ nsChangeHint nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aOther) cons nsChangeHint hint = nsChangeHint(0); if (!EqualURIs(mClipPath, aOther.mClipPath) || - !EqualURIs(mMask, aOther.mMask) || - mFilters != aOther.mFilters) { + !EqualURIs(mFilter, aOther.mFilter) || + !EqualURIs(mMask, aOther.mMask)) { NS_UpdateHint(hint, nsChangeHint_UpdateEffects); NS_UpdateHint(hint, nsChangeHint_RepaintFrame); } diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index a8b1d76bc27..70c71e4b993 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -2268,34 +2268,6 @@ struct nsStyleSVG { } }; -struct nsStyleFilter { - nsStyleFilter(); - nsStyleFilter(const nsStyleFilter& aSource); - ~nsStyleFilter(); - - bool operator==(const nsStyleFilter& aOther) const; - - enum Type { - eNull, - eURL, - eBlur, - eBrightness, - eContrast, - eInvert, - eOpacity, - eGrayscale, - eSaturate, - eSepia, - }; - - Type mType; - union { - nsIURI* mURL; - nsStyleCoord mCoord; - // FIXME: Add a nsCSSShadowItem when we implement drop shadow. - }; -}; - struct nsStyleSVGReset { nsStyleSVGReset(); nsStyleSVGReset(const nsStyleSVGReset& aSource); @@ -2314,17 +2286,8 @@ struct nsStyleSVGReset { return NS_CombineHint(nsChangeHint_UpdateEffects, NS_STYLE_HINT_REFLOW); } - // The backend only supports one SVG reference right now. - // Eventually, it will support multiple chained SVG reference filters and CSS - // filter functions. - nsIURI* SingleFilter() const { - return (mFilters.Length() == 1 && - mFilters[0].mType == nsStyleFilter::Type::eURL) ? - mFilters[0].mURL : nullptr; - } - nsCOMPtr mClipPath; // [reset] - nsTArray mFilters; // [reset] + nsCOMPtr mFilter; // [reset] nsCOMPtr mMask; // [reset] nscolor mStopColor; // [reset] nscolor mFloodColor; // [reset] diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 062f8c14669..56feb7058d4 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -4411,180 +4411,3 @@ if (SpecialPowers.getBoolPref("svg.paint-order.enabled")) { invalid_values: [ "fill stroke markers fill", "fill normal" ] }; } - -if (SpecialPowers.getBoolPref("layout.css.filters.enabled")) { - gCSSProperties["filter"] = { - domProp: "filter", - inherited: false, - type: CSS_TYPE_LONGHAND, - initial_values: [ "none" ], - other_values: [ - // SVG reference filters - "url(#my-filter)", - "url(#my-filter-1) url(#my-filter-2)", - - // Filter functions - "opacity(50%) saturate(1.0)", - "invert(50%) sepia(0.1) brightness(90%)", - - // Mixed SVG reference filters and filter functions - "grayscale(1) url(#my-filter-1)", - "url(#my-filter-1) brightness(50%) contrast(0.9)", - - "blur(0)", - "blur(0px)", - "blur(0.5px)", - "blur(3px)", - "blur(100px)", - "blur(0.1em)", - "blur(calc(-1px))", // Parses and becomes blur(0px). - "blur(calc(0px))", - "blur(calc(5px))", - "blur(calc(2 * 5px))", - - "brightness(0)", - "brightness(50%)", - "brightness(1)", - "brightness(1.0)", - "brightness(2)", - "brightness(350%)", - "brightness(4.567)", - - "contrast(0)", - "contrast(50%)", - "contrast(1)", - "contrast(1.0)", - "contrast(2)", - "contrast(350%)", - "contrast(4.567)", - - "grayscale(0)", - "grayscale(50%)", - "grayscale(1)", - "grayscale(1.0)", - "grayscale(2)", - "grayscale(350%)", - "grayscale(4.567)", - - "invert(0)", - "invert(50%)", - "invert(1)", - "invert(1.0)", - "invert(2)", - "invert(350%)", - "invert(4.567)", - - "opacity(0)", - "opacity(50%)", - "opacity(1)", - "opacity(1.0)", - "opacity(2)", - "opacity(350%)", - "opacity(4.567)", - - "saturate(0)", - "saturate(50%)", - "saturate(1)", - "saturate(1.0)", - "saturate(2)", - "saturate(350%)", - "saturate(4.567)", - - "sepia(0)", - "sepia(50%)", - "sepia(1)", - "sepia(1.0)", - "sepia(2)", - "sepia(350%)", - "sepia(4.567)", - ], - invalid_values: [ - // none - "none none", - "url(#my-filter) none", - "none url(#my-filter)", - "blur(2px) none url(#my-filter)", - - // Nested filters - "grayscale(invert(1.0))", - - // Comma delimited filters - "url(#my-filter),", - "invert(50%), url(#my-filter), brightness(90%)", - - // Test the following situations for each filter function: - // - Invalid number of arguments - // - Comma delimited arguments - // - Wrong argument type - // - Argument value out of range - "blur()", - "blur(3px 5px)", - "blur(3px,)", - "blur(3px, 5px)", - "blur(#my-filter)", - "blur(0.5)", - "blur(50%)", - "blur(calc(0))", // Unitless zero in calc is not a valid length. - "blur(calc(0.1))", - "blur(calc(10%))", - "blur(calc(20px - 5%))", - "blur(-3px)", - - "brightness()", - "brightness(0.5 0.5)", - "brightness(0.5,)", - "brightness(0.5, 0.5)", - "brightness(#my-filter)", - "brightness(10px)", - "brightness(-1)", - - "contrast()", - "contrast(0.5 0.5)", - "contrast(0.5,)", - "contrast(0.5, 0.5)", - "contrast(#my-filter)", - "contrast(10px)", - "contrast(-1)", - - "grayscale()", - "grayscale(0.5 0.5)", - "grayscale(0.5,)", - "grayscale(0.5, 0.5)", - "grayscale(#my-filter)", - "grayscale(10px)", - "grayscale(-1)", - - "invert()", - "invert(0.5 0.5)", - "invert(0.5,)", - "invert(0.5, 0.5)", - "invert(#my-filter)", - "invert(10px)", - "invert(-1)", - - "opacity()", - "opacity(0.5 0.5)", - "opacity(0.5,)", - "opacity(0.5, 0.5)", - "opacity(#my-filter)", - "opacity(10px)", - "opacity(-1)", - - "saturate()", - "saturate(0.5 0.5)", - "saturate(0.5,)", - "saturate(0.5, 0.5)", - "saturate(#my-filter)", - "saturate(10px)", - "saturate(-1)", - - "sepia()", - "sepia(0.5 0.5)", - "sepia(0.5,)", - "sepia(0.5, 0.5)", - "sepia(#my-filter)", - "sepia(10px)", - "sepia(-1)", - ] - }; -} diff --git a/layout/svg/nsSVGEffects.cpp b/layout/svg/nsSVGEffects.cpp index 1306dd8f262..a684d65ccdf 100644 --- a/layout/svg/nsSVGEffects.cpp +++ b/layout/svg/nsSVGEffects.cpp @@ -450,7 +450,7 @@ nsSVGEffects::GetEffectProperties(nsIFrame *aFrame) EffectProperties result; const nsStyleSVGReset *style = aFrame->StyleSVGReset(); result.mFilter = static_cast - (GetEffectProperty(style->SingleFilter(), aFrame, FilterProperty(), + (GetEffectProperty(style->mFilter, aFrame, FilterProperty(), CreateFilterProperty)); result.mClipPath = GetPaintingProperty(style->mClipPath, aFrame, ClipPathProperty()); @@ -526,7 +526,7 @@ nsSVGEffects::UpdateEffects(nsIFrame *aFrame) // Ensure that the filter is repainted correctly // We can't do that in DoUpdate as the referenced frame may not be valid - GetEffectProperty(aFrame->StyleSVGReset()->SingleFilter(), + GetEffectProperty(aFrame->StyleSVGReset()->mFilter, aFrame, FilterProperty(), CreateFilterProperty); if (aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame && @@ -547,7 +547,7 @@ nsSVGEffects::GetFilterProperty(nsIFrame *aFrame) { NS_ASSERTION(!aFrame->GetPrevContinuation(), "aFrame should be first continuation"); - if (!aFrame->StyleSVGReset()->SingleFilter()) + if (!aFrame->StyleSVGReset()->mFilter) return nullptr; return static_cast diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index 5a7381b5562..eeb454e1a8b 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -150,7 +150,7 @@ nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame) // checking the SDL prefs here, since we don't know if we're being called for // painting or hit-testing anyway. const nsStyleSVGReset *style = aFrame->StyleSVGReset(); - return (style->SingleFilter() || style->mClipPath || style->mMask); + return (style->mFilter || style->mClipPath || style->mMask); } /* static */ nsPoint diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 85cda525fbe..50fdceb7680 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1269,7 +1269,7 @@ nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame) type != nsGkAtoms::svgPathGeometryFrame) { return false; } - if (aFrame->StyleSVGReset()->SingleFilter()) { + if (aFrame->StyleSVGReset()->mFilter) { return false; } // XXX The SVG WG is intending to allow fill, stroke and markers on diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index bbab814fa2b..754eb33a1fd 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -1774,9 +1774,6 @@ pref("layout.css.masking.enabled", true); // Is support for the the @supports rule enabled? pref("layout.css.supports-rule.enabled", true); -// Is support for CSS Filters enabled? -pref("layout.css.filters.enabled", false); - // Is support for CSS Flexbox enabled? pref("layout.css.flexbox.enabled", true); From 6ea0563e723590c9f2f27ad638cf4240b3206754 Mon Sep 17 00:00:00 2001 From: Guillaume Abadie Date: Tue, 23 Jul 2013 11:41:25 -0400 Subject: [PATCH 62/69] bug 896875 - [WebGL 2.0] WebGL2 unable to create context. r=bjacob --- content/html/content/src/Makefile.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index 2e22d6f51dd..c4cf466cc30 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -42,3 +42,7 @@ INCLUDES += \ DEFINES += \ -D_IMPL_NS_LAYOUT \ $(NULL) + +ifdef MOZ_WEBGL +DEFINES += -DMOZ_WEBGL +endif From dc1be624889df705f17dd1693a9585d5cba5f39d Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 18 Jun 2013 15:35:03 -0700 Subject: [PATCH 63/69] Bug 896842 - Implement mozilla::DoublesAreIdentical. r=luke --- js/src/ion/MIR.cpp | 9 +-- mfbt/FloatingPoint.h | 13 ++++ mfbt/tests/Makefile.in | 1 + mfbt/tests/TestFloatingPoint.cpp | 104 +++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 mfbt/tests/TestFloatingPoint.cpp diff --git a/js/src/ion/MIR.cpp b/js/src/ion/MIR.cpp index e37eeb51cba..e4e0dc64fda 100644 --- a/js/src/ion/MIR.cpp +++ b/js/src/ion/MIR.cpp @@ -6,7 +6,7 @@ #include "ion/MIR.h" -#include "mozilla/Casting.h" +#include "mozilla/FloatingPoint.h" #include "ion/BaselineInspector.h" #include "ion/IonBuilder.h" @@ -26,7 +26,7 @@ using namespace js; using namespace js::ion; -using mozilla::BitwiseCast; +using mozilla::DoublesAreIdentical; void MDefinition::PrintOpcodeName(FILE *fp, MDefinition::Opcode op) @@ -888,10 +888,7 @@ IsConstant(MDefinition *def, double v) if (!def->isConstant()) return false; - // Compare the underlying bits to not equate -0 and +0. - uint64_t lhs = BitwiseCast(def->toConstant()->value().toNumber()); - uint64_t rhs = BitwiseCast(v); - return lhs == rhs; + return DoublesAreIdentical(def->toConstant()->value().toNumber(), v); } MDefinition * diff --git a/mfbt/FloatingPoint.h b/mfbt/FloatingPoint.h index a79a32154de..8785c0cb1e5 100644 --- a/mfbt/FloatingPoint.h +++ b/mfbt/FloatingPoint.h @@ -191,6 +191,19 @@ UnspecifiedNaN() return SpecificNaN(0, 0xfffffffffffffULL); } +/** + * Compare two doubles for equality, *without* equating -0 to +0, and equating + * any NaN value to any other NaN value. (The normal equality operators equate + * -0 with +0, and they equate NaN to no other value.) + */ +static inline bool +DoublesAreIdentical(double d1, double d2) +{ + if (IsNaN(d1)) + return IsNaN(d2); + return BitwiseCast(d1) == BitwiseCast(d2); +} + } /* namespace mozilla */ #endif /* mozilla_FloatingPoint_h_ */ diff --git a/mfbt/tests/Makefile.in b/mfbt/tests/Makefile.in index 948b60ebf58..40b86aa3864 100644 --- a/mfbt/tests/Makefile.in +++ b/mfbt/tests/Makefile.in @@ -20,6 +20,7 @@ CPP_UNIT_TESTS = \ TestCountZeroes.cpp \ TestEndian.cpp \ TestEnumSet.cpp \ + TestFloatingPoint.cpp \ TestSHA1.cpp \ TestTypeTraits.cpp \ TestWeakPtr.cpp \ diff --git a/mfbt/tests/TestFloatingPoint.cpp b/mfbt/tests/TestFloatingPoint.cpp new file mode 100644 index 00000000000..6e16cba18d0 --- /dev/null +++ b/mfbt/tests/TestFloatingPoint.cpp @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +#include "mozilla/FloatingPoint.h" + +#include + +using mozilla::DoublesAreIdentical; +using mozilla::NegativeInfinity; +using mozilla::PositiveInfinity; +using mozilla::SpecificNaN; +using mozilla::UnspecifiedNaN; + +static void +ShouldBeIdentical(double d1, double d2) +{ + MOZ_ASSERT(DoublesAreIdentical(d1, d2)); + MOZ_ASSERT(DoublesAreIdentical(d2, d1)); +} + +static void +ShouldNotBeIdentical(double d1, double d2) +{ + MOZ_ASSERT(!DoublesAreIdentical(d1, d2)); + MOZ_ASSERT(!DoublesAreIdentical(d2, d1)); +} + +static void +TestDoublesAreIdentical() +{ + ShouldBeIdentical(+0.0, +0.0); + ShouldBeIdentical(-0.0, -0.0); + ShouldNotBeIdentical(+0.0, -0.0); + + ShouldBeIdentical(1.0, 1.0); + ShouldNotBeIdentical(-1.0, 1.0); + ShouldBeIdentical(4294967295.0, 4294967295.0); + ShouldNotBeIdentical(-4294967295.0, 4294967295.0); + ShouldBeIdentical(4294967296.0, 4294967296.0); + ShouldBeIdentical(4294967297.0, 4294967297.0); + ShouldBeIdentical(1e300, 1e300); + + ShouldBeIdentical(PositiveInfinity(), PositiveInfinity()); + ShouldBeIdentical(NegativeInfinity(), NegativeInfinity()); + ShouldNotBeIdentical(PositiveInfinity(), NegativeInfinity()); + + ShouldNotBeIdentical(-0.0, NegativeInfinity()); + ShouldNotBeIdentical(+0.0, NegativeInfinity()); + ShouldNotBeIdentical(1e300, NegativeInfinity()); + ShouldNotBeIdentical(3.141592654, NegativeInfinity()); + + ShouldBeIdentical(UnspecifiedNaN(), UnspecifiedNaN()); + ShouldBeIdentical(-UnspecifiedNaN(), UnspecifiedNaN()); + ShouldBeIdentical(UnspecifiedNaN(), -UnspecifiedNaN()); + + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 42)); + ShouldBeIdentical(SpecificNaN(1, 17), SpecificNaN(1, 42)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(1, 42)); + ShouldBeIdentical(SpecificNaN(1, 17), SpecificNaN(0, 42)); + + const uint64_t Mask = 0xfffffffffffffULL; + for (unsigned i = 0; i < 52; i++) { + for (unsigned j = 0; j < 52; j++) { + for (unsigned sign = 0; i < 2; i++) { + ShouldBeIdentical(SpecificNaN(0, 1ULL << i), SpecificNaN(sign, 1ULL << j)); + ShouldBeIdentical(SpecificNaN(1, 1ULL << i), SpecificNaN(sign, 1ULL << j)); + + ShouldBeIdentical(SpecificNaN(0, Mask & ~(1ULL << i)), + SpecificNaN(sign, Mask & ~(1ULL << j))); + ShouldBeIdentical(SpecificNaN(1, Mask & ~(1ULL << i)), + SpecificNaN(sign, Mask & ~(1ULL << j))); + } + } + } + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x8000000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x4000000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x2000000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x1000000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0800000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0400000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0200000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0100000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0080000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0040000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0020000000000ULL)); + ShouldBeIdentical(SpecificNaN(0, 17), SpecificNaN(0, 0x0010000000000ULL)); + ShouldBeIdentical(SpecificNaN(1, 17), SpecificNaN(0, 0xff0ffffffffffULL)); + ShouldBeIdentical(SpecificNaN(1, 17), SpecificNaN(0, 0xfffffffffff0fULL)); + + ShouldNotBeIdentical(UnspecifiedNaN(), +0.0); + ShouldNotBeIdentical(UnspecifiedNaN(), -0.0); + ShouldNotBeIdentical(UnspecifiedNaN(), 1.0); + ShouldNotBeIdentical(UnspecifiedNaN(), -1.0); + ShouldNotBeIdentical(UnspecifiedNaN(), PositiveInfinity()); + ShouldNotBeIdentical(UnspecifiedNaN(), NegativeInfinity()); +} + +int +main() +{ + TestDoublesAreIdentical(); +} From 3cb66b880ea047c86edfd5827131c4cdaa3ebb9d Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Tue, 23 Jul 2013 12:06:52 -0400 Subject: [PATCH 64/69] Bug 887250 - ARIA textbox role doesn't expose value, r=tbsaunde --- accessible/src/base/nsTextEquivUtils.cpp | 13 ------------- accessible/src/base/nsTextEquivUtils.h | 11 ++++++++--- accessible/src/generic/Accessible.cpp | 6 ++++++ .../tests/mochitest/value/test_general.html | 19 ++++++++++++++++--- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/accessible/src/base/nsTextEquivUtils.cpp b/accessible/src/base/nsTextEquivUtils.cpp index d602314380e..2d77c2d2488 100644 --- a/accessible/src/base/nsTextEquivUtils.cpp +++ b/accessible/src/base/nsTextEquivUtils.cpp @@ -55,19 +55,6 @@ nsTextEquivUtils::GetNameFromSubtree(Accessible* aAccessible, return NS_OK; } -void -nsTextEquivUtils::GetTextEquivFromSubtree(Accessible* aAccessible, - nsString& aTextEquiv) -{ - aTextEquiv.Truncate(); - - uint32_t nameRule = GetRoleRule(aAccessible->Role()); - if (nameRule & eNameFromSubtreeIfReqRule) { - AppendFromAccessibleChildren(aAccessible, &aTextEquiv); - aTextEquiv.CompressWhitespace(); - } -} - nsresult nsTextEquivUtils::GetTextEquivFromIDRefs(Accessible* aAccessible, nsIAtom *aIDRefsAttr, diff --git a/accessible/src/base/nsTextEquivUtils.h b/accessible/src/base/nsTextEquivUtils.h index 1280fe61909..0615e20b433 100644 --- a/accessible/src/base/nsTextEquivUtils.h +++ b/accessible/src/base/nsTextEquivUtils.h @@ -55,11 +55,16 @@ public: /** * Calculates text equivalent from the subtree. Similar to GetNameFromSubtree. - * The difference it returns not empty result for things like HTML p, i.e. - * if the role has eNameFromSubtreeIfReq rule. + * However it returns not empty result for things like HTML p. */ static void GetTextEquivFromSubtree(Accessible* aAccessible, - nsString& aTextEquiv); + nsString& aTextEquiv) + { + aTextEquiv.Truncate(); + + AppendFromAccessibleChildren(aAccessible, &aTextEquiv); + aTextEquiv.CompressWhitespace(); + } /** * Calculates text equivalent for the given accessible from its IDRefs diff --git a/accessible/src/generic/Accessible.cpp b/accessible/src/generic/Accessible.cpp index d678f5d9212..3f0ec2b2a83 100644 --- a/accessible/src/generic/Accessible.cpp +++ b/accessible/src/generic/Accessible.cpp @@ -1681,6 +1681,12 @@ Accessible::Value(nsString& aValue) return; } + // Value of textbox is a textified subtree. + if (mRoleMapEntry->Is(nsGkAtoms::textbox)) { + nsTextEquivUtils::GetTextEquivFromSubtree(this, aValue); + return; + } + // Value of combobox is a text of current or selected item. if (mRoleMapEntry->Is(nsGkAtoms::combobox)) { Accessible* option = CurrentItem(); diff --git a/accessible/tests/mochitest/value/test_general.html b/accessible/tests/mochitest/value/test_general.html index 74602ae722a..12e718ba17c 100644 --- a/accessible/tests/mochitest/value/test_general.html +++ b/accessible/tests/mochitest/value/test_general.html @@ -50,6 +50,11 @@ testValue("aria_main_link", href); testValue("aria_navigation_link", href); + ////////////////////////////////////////////////////////////////////////// + // ARIA textboxes + + testValue("aria_textbox1", "helo"); + ////////////////////////////////////////////////////////////////////////// // ARIA comboboxes @@ -83,12 +88,17 @@ - Mozilla Bug 494807 + Bug 494807 - Mozilla Bug 819273 + title="ARIA combobox should have accessible value"> + Bug 819273 + + + Bug 887250