Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Issue 2601893002: SharedWorker: Remove message forwarding mechanism (Closed)

Created:
3 years, 11 months ago by nhiroki
Modified:
3 years, 11 months ago
Reviewers:
kinuko, dcheng, horo
CC:
chromium-reviews, jam, kinuko+watch, darin-cc_chromium.org, blink-worker-reviews_chromium.org, mlamouri+watch-content_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

SharedWorker: Remove message forwarding mechanism SharedWorker service has a mechanism to forward a message sent from a document to a worker. With this mechanism, a sender creates a nested IPC message and sends it to the SharedWorker service in the browser process. The service interprets the nested message and forwards it to an appropriate receiver. This mechanism is available for any IPC messages but it has been used only for worker connection message. If we use it only for one message type, we don't have to manage such a complex mechanism. Therefore, this CL removes the mechanism and uses a plain IPC message for connecting to a worker. This simplification also makes it easier to mojofy SharedWorker. BUG=612308 Review-Url: https://codereview.chromium.org/2601893002 Cr-Commit-Position: refs/heads/master@{#441785} Committed: https://chromium.googlesource.com/chromium/src/+/b46ff78092b42dfe9f3d816a4c16972217f9947a

Patch Set 1 #

Total comments: 11

Patch Set 2 : address kinuko's comments #

Patch Set 3 : tweak #

Patch Set 4 : style fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -65 lines) Patch
M content/browser/shared_worker/shared_worker_host.h View 1 2 3 2 chunks +7 lines, -7 lines 0 comments Download
M content/browser/shared_worker/shared_worker_host.cc View 1 2 3 chunks +26 lines, -40 lines 0 comments Download
M content/browser/shared_worker/shared_worker_message_filter.h View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/shared_worker/shared_worker_message_filter.cc View 2 chunks +5 lines, -3 lines 0 comments Download
M content/browser/shared_worker/shared_worker_service_impl.h View 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/shared_worker/shared_worker_service_impl.cc View 1 2 1 chunk +5 lines, -3 lines 0 comments Download
M content/browser/shared_worker/shared_worker_service_impl_unittest.cc View 1 chunk +2 lines, -3 lines 0 comments Download
M content/common/view_messages.h View 1 chunk +5 lines, -4 lines 0 comments Download
M content/renderer/websharedworker_proxy.cc View 2 chunks +3 lines, -3 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 48 (31 generated)
nhiroki
Hi, can you review this? This change is useful for SharedWorker mojofication: https://codereview.chromium.org/2600113003/ Thank you.
3 years, 11 months ago (2016-12-28 07:41:45 UTC) #15
nhiroki
https://codereview.chromium.org/2601893002/diff/40001/content/renderer/websharedworker_proxy.cc File content/renderer/websharedworker_proxy.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/renderer/websharedworker_proxy.cc#newcode47 content/renderer/websharedworker_proxy.cc:47: // also want to queue the message. Question: How ...
3 years, 11 months ago (2016-12-28 08:04:20 UTC) #18
nhiroki
https://codereview.chromium.org/2601893002/diff/40001/content/renderer/websharedworker_proxy.cc File content/renderer/websharedworker_proxy.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/renderer/websharedworker_proxy.cc#newcode47 content/renderer/websharedworker_proxy.cc:47: // also want to queue the message. On 2016/12/28 ...
3 years, 11 months ago (2016-12-28 08:16:19 UTC) #21
nhiroki
https://codereview.chromium.org/2601893002/diff/40001/content/renderer/websharedworker_proxy.cc File content/renderer/websharedworker_proxy.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/renderer/websharedworker_proxy.cc#newcode47 content/renderer/websharedworker_proxy.cc:47: // also want to queue the message. On 2016/12/28 ...
3 years, 11 months ago (2016-12-28 09:48:26 UTC) #22
horo
lgtm with a nit. https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc File content/browser/shared_worker/shared_worker_host.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc#newcode120 content/browser/shared_worker/shared_worker_host.cc:120: if (!instance_) nit: DCHECK(instance_);
3 years, 11 months ago (2017-01-05 03:54:13 UTC) #24
nhiroki
Thank you for your comment. https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc File content/browser/shared_worker/shared_worker_host.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc#newcode120 content/browser/shared_worker/shared_worker_host.cc:120: if (!instance_) On 2017/01/05 ...
3 years, 11 months ago (2017-01-05 04:11:40 UTC) #25
nhiroki
+dcheng@, can you review content/common/view_messages.h? Thanks.
3 years, 11 months ago (2017-01-05 04:14:57 UTC) #28
kinuko
https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_service_impl.cc File content/browser/shared_worker/shared_worker_service_impl.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_service_impl.cc#newcode334 content/browser/shared_worker/shared_worker_service_impl.cc:334: if (iter->second->CanHandleMessage(route_id, filter)) { It feels this method doesn't ...
3 years, 11 months ago (2017-01-05 04:28:25 UTC) #29
kinuko
(lgtm/2)
3 years, 11 months ago (2017-01-05 04:28:36 UTC) #30
dcheng
https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc File content/browser/shared_worker/shared_worker_host.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc#newcode120 content/browser/shared_worker/shared_worker_host.cc:120: if (!instance_) On 2017/01/05 04:11:40, nhiroki wrote: > On ...
3 years, 11 months ago (2017-01-05 06:19:18 UTC) #34
nhiroki
Thank you for your comments. https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc File content/browser/shared_worker/shared_worker_host.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc#newcode120 content/browser/shared_worker/shared_worker_host.cc:120: if (!instance_) On 2017/01/05 ...
3 years, 11 months ago (2017-01-05 07:54:33 UTC) #37
nhiroki
https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_service_impl.cc File content/browser/shared_worker/shared_worker_service_impl.cc (right): https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_service_impl.cc#newcode334 content/browser/shared_worker/shared_worker_service_impl.cc:334: if (iter->second->CanHandleMessage(route_id, filter)) { On 2017/01/05 04:28:25, kinuko wrote: ...
3 years, 11 months ago (2017-01-05 08:40:55 UTC) #38
dcheng
On 2017/01/05 07:54:33, nhiroki (slow) wrote: > Thank you for your comments. > > https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_worker/shared_worker_host.cc ...
3 years, 11 months ago (2017-01-05 16:33:34 UTC) #39
nhiroki
On 2017/01/05 16:33:34, dcheng wrote: > On 2017/01/05 07:54:33, nhiroki (slow) wrote: > > Thank ...
3 years, 11 months ago (2017-01-05 23:28:06 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2601893002/140001
3 years, 11 months ago (2017-01-05 23:29:25 UTC) #44
commit-bot: I haz the power
Committed patchset #4 (id:140001) as https://chromium.googlesource.com/chromium/src/+/b46ff78092b42dfe9f3d816a4c16972217f9947a
3 years, 11 months ago (2017-01-06 01:23:29 UTC) #47
nhiroki
3 years, 11 months ago (2017-01-06 07:04:30 UTC) #48
Message was sent while issue was closed.
On 2017/01/05 23:28:06, nhiroki wrote:
> On 2017/01/05 16:33:34, dcheng wrote:
> > On 2017/01/05 07:54:33, nhiroki (slow) wrote:
> > > Thank you for your comments.
> > > 
> > >
> >
>
https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_...
> > > File content/browser/shared_worker/shared_worker_host.cc (right):
> > > 
> > >
> >
>
https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_...
> > > content/browser/shared_worker/shared_worker_host.cc:120: if (!instance_)
> > > On 2017/01/05 06:19:18, dcheng wrote:
> > > > On 2017/01/05 04:11:40, nhiroki wrote:
> > > > > On 2017/01/05 03:54:13, horo wrote:
> > > > > > nit: DCHECK(instance_);
> > > > > 
> > > > > I'll make a separate CL to replace all such if-statements at once.
> > > > 
> > > > Why is it OK to DCHECK instance_?
> > > 
> > > |instance_| is set at the ctor of SharedWorkerHost and unset in
> > > SharedWorkerHost::WorkerContextDestroyed. The host is destroyed
immediately
> > > after WorkerContextDestroyed (see [1]), so |instance_| should not be null
> > here.
> > > 
> > > [1]
> > >
> >
>
https://chromium.googlesource.com/chromium/src/+/a2f777316c98a1bcc06f2d34120b...
> > > 
> > >
> >
>
https://codereview.chromium.org/2601893002/diff/40001/content/browser/shared_...
> > > content/browser/shared_worker/shared_worker_host.cc:123:
> > > DCHECK(container_render_filter_);
> > > On 2017/01/05 06:19:18, dcheng wrote:
> > > > Ditto: why is this OK to DCHECK? These messages are coming from the
> renderer
> > > and
> > > > untrusted. So it could send them at an invalid time, I think.
> > > 
> > > Because this filter is set at the ctor and the host is destroyed when the
> > filter
> > > is closed (see [2])
> > > 
> > > [2]
> > >
> >
>
https://chromium.googlesource.com/chromium/src/+/a2f777316c98a1bcc06f2d34120b...
> > 
> > IPC LGTM. thanks for the explanation. it's a little subtle, it might be
worth
> > documenting lifetime in comments somewhere. I notice there's one location
that
> > still null checks this, even though it can never be null:
> >
>
https://cs.chromium.org/chromium/src/content/browser/shared_worker/shared_wor...
> > is that worth cleaning up in the followup as well?
> 
> Thank you. Documenting lifetime is a good idea. I'll make a followup CL.

JFYI: I created a CL:
https://codereview.chromium.org/2614013004/

Powered by Google App Engine
This is Rietveld 408576698