Open Bug 1054744 Opened 10 years ago Updated 2 years ago

Replace use of boolean flags in MessageChannel with ChannelFlags apis

Categories

(Core :: IPC, defect, P3)

x86_64
All
defect

Tracking

()

People

(Reporter: jimm, Unassigned)

References

Details

Attachments

(1 file)

Attached patch patch v.1Splinter Review
Follow up after bug 874437 sticks, get rid of boolean flags that have piled up in MessageChannel.
Attachment #8474228 - Flags: review?(wmccloskey)
+    MOZ_ASSERT(aFlags & REQUIRE_URGENT_SCRIPT_BLOCKING ? NS_IsMainThread() : true);
+    mFlags |= aFlags;

Can any flag changes happen while the channel is in operation? Because if any changes happen after initial channel setup, then this is a giant read/write footgun. mFlags isn't an atomic, and |= operations can't be atomic anyway.
Comment on attachment 8474228 [details] [diff] [review]
patch v.1

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

::: ipc/glue/MessageChannel.cpp
@@ +1709,5 @@
>      PostErrorNotifyTask();
>  }
>  
>  void
> +MessageChannel::SetChannelFlags(uint32_t aFlags)

Maybe we should assert in this function and the next that we haven't opened the channel yet. I think !mLink should work. Then we'll have to move the existing SetChannelFlags above the Open calls, but that looks easy. Hopefully that will allay bsmedberg's concern.

@@ +1714,2 @@
>  {
> +    MOZ_ASSERT(aFlags & REQUIRE_URGENT_SCRIPT_BLOCKING ? NS_IsMainThread() : true);

Can you put this in ClearFlags as well?

::: ipc/glue/MessageChannel.h
@@ +92,5 @@
>        // WindowsMessageLoop code should enable deferred native message
>        // handling to prevent deadlocks. Should only be used for protocols
>        // that manage child processes which might create native UI, like
>        // plugins.
> +      REQUIRE_DEFERRED_MESSAGE_PROTECTION     = 1 << 0,

The REQUIRE_ prefix on these doesn't really seem necessary. Can we just remove it and change REQUIRE_DEFAULT to DEFAULT_FLAGS? Also, can you please put an empty line after each flag?
Attachment #8474228 - Flags: review?(wmccloskey) → review+
Assignee: jmathies → nobody
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: