Closed Bug 1377215 Opened 7 years ago Closed 7 years ago

Add WebSocketEventService::Get

Categories

(Core :: Networking: WebSockets, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: farre, Assigned: farre)

References

Details

(Whiteboard: [necko-active])

Attachments

(1 file, 1 obsolete file)

For the cases where we really only need to get ahold of a WebSocketEventService if there is one.
Assignee: nobody → afarre
Attachment #8882297 - Flags: review?(mcmanus)
Blocks: 1362322
Whiteboard: [necko-active]
Comment on attachment 8882297 [details] [diff] [review]
0001-Bug-1377215-Add-WebSocketEventService-Get.-r-mcmanus.patch

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

::: netwerk/protocol/websocket/WebSocketEventService.cpp
@@ +206,5 @@
> +WebSocketEventService::Get()
> +{
> +  MOZ_ASSERT(NS_IsMainThread());
> +
> +  return gWebSocketEventService.forget();

This patch seems to call forget(), which will set gWeb* to null, in a method named get() (which wouldn't normally have a side effect..)

maybe you just want GetOrCreate() ?
Attachment #8882297 - Flags: review?(mcmanus) → review-
I really do want ::Get that explicitly doesn't create. I'm going to use Get before calling HasListenerFor, and if the case is that there is no service I don't want to create it since, then there won't be any listeners to begin with but I'll end up with a service that isn't actually used.

So it's just me being stupip, I should've gone through a RefPtr as with GetOrCreate.
Attachment #8882297 - Attachment is obsolete: true
Attachment #8882591 - Flags: review?(mcmanus)
Attachment #8882591 - Flags: review?(mcmanus) → review+
Pushed by afarre@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/454598683af7
Add WebSocketEventService::Get. r=mcmanus
https://hg.mozilla.org/mozilla-central/rev/454598683af7
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: