Closed Bug 1268160 Opened 4 years ago Closed 4 years ago

Assert that PostIdleTask is only ever used on the main thread

Categories

(Core :: IPC, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: khuey, Assigned: khuey)

References

(Blocks 1 open bug)

Details

(Whiteboard: btpp-active)

Attachments

(1 file)

Attached patch PatchSplinter Review
No need to allow the plague to spread further.
Attachment #8746126 - Flags: review?(jld)
Comment on attachment 8746126 [details] [diff] [review]
Patch

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

::: ipc/chromium/src/base/message_loop.cc
@@ +270,5 @@
>  }
>  
>  void MessageLoop::PostIdleTask(already_AddRefed<Runnable> task) {
>    DCHECK(current() == this);
> +  MOZ_ASSERT(NS_IsMainThread());

Any reason not to make this a release assert, or at least a diagnostic assert?  (Same with the ones in MessagePump.)

::: xpcom/base/nsIMessageLoop.idl
@@ +12,5 @@
>   * instance, with some extra sugar added.  If you're calling from C++, it may
>   * or may not make sense for you to use this interface.  If you're calling from
>   * JS, you don't have a choice!
>   *
> + * Right now, you can only call PostIdleTask(), and the wrath of khuey is

This could also mention bug 1260828.
Attachment #8746126 - Flags: review?(jld) → review+
Whiteboard: btpp-active
https://hg.mozilla.org/mozilla-central/rev/7a9039d4e931
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.