Closed Bug 850247 Opened 11 years ago Closed 11 years ago

Remove Off-Main-Thread XPCWrappedJS refcounting from nsRequestObserverProxy

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(3 files)

      No description provided.
I'm doing this so that I can safely make this class use nsMainThreadPtr{Handle,Holder}.
There's no theoretical reason why we couldn't support other threads here, but it
would mean implementing that functionality in the PtrHolders, renaming them, and
weakening their assertions/invariants. AFAICT the consumers here don't actually have
a reason to proxy events anywhere but the main thread, so I'm just going to do this
rather than writing code to support something that we don't do (and thus can't test).
Attachment #723985 - Flags: review?(mcmanus)
Both the consumers just do this manually. The context here is sometimes an
XPCWrappedJS, so passing it around with nsCOMPtrs off-main-thread can't
happen anymore.

We add assertions in OnStartRequest/OnStopRequest to catch any consumers
that might try to change contexts midstream.
Attachment #723986 - Flags: review?(mcmanus)
Comment on attachment 723985 [details] [diff] [review]
Part 1 - Make nsRequestObserverProxy proxy events to the main thread only. v1

Review of attachment 723985 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/base/public/nsIRequestObserverProxy.idl
@@ -21,5 @@
>      /**
>       * Initializes an nsIRequestObserverProxy.
>       *
>       * @param observer - receives observer notifications on the other thread
> -     * @param target - may be NULL indicating the calling thread's event target

I think you need a uuid change?

update the documentation in the idl to indicate that this happens on main thread rather than "another thread" as it says now

r+ with that
Attachment #723985 - Flags: review?(mcmanus) → review+
Comment on attachment 723986 [details] [diff] [review]
Part 2 - Make nsRequestObserverProxy hold onto its context. v1

Review of attachment 723986 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/base/public/nsIRequestObserverProxy.idl
@@ +17,2 @@
>   */
>  [scriptable, uuid(7df8845f-938a-4437-9ea4-b11b850048f1)]

uuid bump
Attachment #723986 - Flags: review?(mcmanus) → review+
Comment on attachment 723987 [details] [diff] [review]
Part 3 - Move nsRequestObserverProxy to nsMainThreadPtr{Holder,Handle}. v1

Review of attachment 723987 [details] [diff] [review]:
-----------------------------------------------------------------

::: netwerk/base/src/nsRequestObserverProxy.cpp
@@ -118,5 @@
> -
> -nsRequestObserverProxy::~nsRequestObserverProxy()
> -{
> -    if (mObserver) {
> -        // order is crucial here... we must be careful to clear mObserver

deleting code like that just makes ya feel good :)
Attachment #723987 - Flags: review?(mcmanus) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: