RESOLVED FIXED Bug 78459
[Chromium] [WebSocket] provide WebFrameClient with a chance of accessing to opening WebSocketStreamHandle
https://bugs.webkit.org/show_bug.cgi?id=78459
Summary [Chromium] [WebSocket] provide WebFrameClient with a chance of accessing to o...
Takashi Toyoshima
Reported 2012-02-12 22:26:53 PST
In Chromium port, we should bind a WebSocket object with its owner RenderView to share RenderView wide information between the objects. RenderView implements WebFrameClient, so if a WebSocketStreamHandle object has a reference to the owner WebFrame object, it means that it also has a chance to call RenderView functions via WebFrameClient delegate. Then, the RenderView could set owner RenderView information to WebSocketStreamHandle at the delegate function. This is chromium side issue. http://code.google.com/p/chromium/issues/detail?id=53836
Attachments
to show overview to dependent change reviewers (has dependencies on them, so not ready for review) (7.20 KB, patch)
2012-02-13 00:42 PST, Takashi Toyoshima
no flags
patch candidate (depends on other dependent changes) (15.46 KB, patch)
2012-02-14 02:12 PST, Takashi Toyoshima
no flags
Patch (15.58 KB, patch)
2012-02-15 00:40 PST, Takashi Toyoshima
no flags
Patch (16.23 KB, patch)
2012-02-21 05:03 PST, Takashi Toyoshima
no flags
Patch (15.94 KB, patch)
2012-02-22 06:16 PST, Takashi Toyoshima
no flags
Patch (13.27 KB, patch)
2012-02-28 15:24 PST, Takashi Toyoshima
no flags
Patch (13.26 KB, patch)
2012-03-09 17:19 PST, Takashi Toyoshima
no flags
just rebase (13.24 KB, patch)
2012-03-12 12:37 PDT, Takashi Toyoshima
no flags
rename some methods to have dispatch prefix, too (13.31 KB, patch)
2012-03-12 16:18 PDT, Takashi Toyoshima
no flags
Patch (13.28 KB, patch)
2012-03-13 16:33 PDT, Takashi Toyoshima
no flags
Patch (13.27 KB, patch)
2012-03-19 13:11 PDT, Takashi Toyoshima
no flags
rebase (13.33 KB, patch)
2012-03-21 06:27 PDT, Takashi Toyoshima
no flags
Takashi Toyoshima
Comment 1 2012-02-13 00:42:57 PST
Created attachment 126731 [details] to show overview to dependent change reviewers (has dependencies on them, so not ready for review)
Takashi Toyoshima
Comment 2 2012-02-14 02:12:11 PST
Created attachment 126939 [details] patch candidate (depends on other dependent changes)
Takashi Toyoshima
Comment 3 2012-02-14 02:16:01 PST
The second patch will work with 78576 and 78581. The whole change containing this CL and other dependent CLs could be shown in following CL. https://codereview.appspot.com/5664047
Takashi Toyoshima
Comment 4 2012-02-15 00:40:17 PST
Kent Tamura
Comment 5 2012-02-15 01:26:01 PST
Comment on attachment 127126 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=127126&action=review > Source/WebCore/platform/network/chromium/SocketStreamHandle.h:69 > + friend class FrameLoaderClientImpl; Why is this needed?
WebKit Review Bot
Comment 6 2012-02-15 03:54:34 PST
Please wait for approval from fishd@chromium.org before submitting because this patch contains changes to the Chromium public API.
Darin Fisher (:fishd, Google)
Comment 7 2012-02-16 11:34:21 PST
Comment on attachment 127126 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=127126&action=review > Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h:55 > + // Set requestor ID binded to RenderView. nit: RenderView in the WebKit tree means something totally different. See WebCore::RenderView. It is really best to avoid mentioning Chrome-isms for this reason. Can you please implement this using the ExtraData approach instead? I know it is more work, but we have a pending cleanup work item to remove WebURLRequest::requestorID. The issue here is that we don't want to pollute WebKit with things that really don't concern it. requestorID is a good example of that.
Takashi Toyoshima
Comment 8 2012-02-21 04:44:21 PST
Comment on attachment 127126 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=127126&action=review >> Source/WebCore/platform/network/chromium/SocketStreamHandle.h:69 >> + friend class FrameLoaderClientImpl; > > Why is this needed? Sorry, I mistakenly inherit this from an old experimental implementation. I remove changes on this file. >> Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h:55 >> + // Set requestor ID binded to RenderView. > > nit: RenderView in the WebKit tree means something totally different. See WebCore::RenderView. > It is really best to avoid mentioning Chrome-isms for this reason. > > Can you please implement this using the ExtraData approach instead? I know it is more work, > but we have a pending cleanup work item to remove WebURLRequest::requestorID. The issue here > is that we don't want to pollute WebKit with things that really don't concern it. requestorID > is a good example of that. Thank you. I define ExtraData internal class and change these functions to setExtraData()/extraData().
Takashi Toyoshima
Comment 9 2012-02-21 05:03:18 PST
Kent Tamura
Comment 10 2012-02-21 16:06:48 PST
Comment on attachment 127955 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=127955&action=review > Source/WebCore/websockets/WebSocketChannel.cpp:274 > + m_document->frame()->loader()->willOpenSocketStream(handle); m_document->frame() can be NULL.
Darin Fisher (:fishd, Google)
Comment 11 2012-02-21 16:17:19 PST
Comment on attachment 127955 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=127955&action=review > Source/WebCore/loader/FrameLoaderClient.h:337 > + virtual void willOpenSocketStream(SocketStreamHandle*) { } on this interface, methods like this are typically prefixed with "dispatch" see for example dispatchWillSendRequest. > Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h:44 > + nit: no new line here > Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h:62 > + ExtraData* extraData() const { return 0; } I just realized that the WebSocketStreamHandle is allocated by the embedder. This implies that the embedder could also downcast WebSocketStreamHandle implementations to the Impl class (or some other intermediate class), which could provide methods for setting extra data fields. WebURLRequest works differently. There, WebKit implements WebURLRequest, and so it is necessary for it to provide the ExtraData facility. Maybe my advice to have you extend WebSocketStreamHandle like this was actually not so good... Maybe all you really need to do is plumb the willOpenSocketStream call.
Takashi Toyoshima
Comment 12 2012-02-22 06:16:03 PST
Takashi Toyoshima
Comment 13 2012-02-22 06:16:40 PST
Comment on attachment 127955 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=127955&action=review >> Source/WebCore/loader/FrameLoaderClient.h:337 >> + virtual void willOpenSocketStream(SocketStreamHandle*) { } > > on this interface, methods like this are typically prefixed with "dispatch" > see for example dispatchWillSendRequest. I see. Fixed. >> Source/WebCore/websockets/WebSocketChannel.cpp:274 >> + m_document->frame()->loader()->willOpenSocketStream(handle); > > m_document->frame() can be NULL. I added pointer check. >> Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h:44 >> + > > nit: no new line here Fixed. >> Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h:62 >> + ExtraData* extraData() const { return 0; } > > I just realized that the WebSocketStreamHandle is allocated by the embedder. > This implies that the embedder could also downcast WebSocketStreamHandle > implementations to the Impl class (or some other intermediate class), which > could provide methods for setting extra data fields. > > WebURLRequest works differently. There, WebKit implements WebURLRequest, > and so it is necessary for it to provide the ExtraData facility. > > Maybe my advice to have you extend WebSocketStreamHandle like this was > actually not so good... Maybe all you really need to do is plumb the > willOpenSocketStream call. I see. OK, I remove ExtraData related changes and will implement similar functions in chromium side impl class. Is this ExtraData approach overkill as a chromium side implementation approach? I think removing pure virtual functions is still useful. I'll remain them in the next CL.
Takashi Toyoshima
Comment 14 2012-02-27 14:13:19 PST
Hi Darin, Could you review on my last patch?
Adam Barth
Comment 15 2012-02-28 14:19:31 PST
Comment on attachment 128198 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=128198&action=review > Source/WebCore/loader/FrameLoader.cpp:1422 > +void FrameLoader::willOpenSocketStream(SocketStreamHandle* handle) > +{ > + m_client->dispatchWillOpenSocketStream(handle); > +} We don't require these wrapper functions in FrameLoader anymore. Folks can just call functions on loader()->client() directly.
Takashi Toyoshima
Comment 16 2012-02-28 14:44:06 PST
Comment on attachment 128198 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=128198&action=review >> Source/WebCore/loader/FrameLoader.cpp:1422 >> +} > > We don't require these wrapper functions in FrameLoader anymore. Folks can just call functions on loader()->client() directly. Thanks. I remove this wrapper and call client function from WebSocketChannel directly.
Takashi Toyoshima
Comment 17 2012-02-28 15:24:09 PST
Takashi Toyoshima
Comment 18 2012-03-09 17:19:15 PST
Takashi Toyoshima
Comment 19 2012-03-09 17:21:30 PST
Rebase to the latest code and fix a typo in ChangeLog. Darin, could you review this change including API revision again?
Takashi Toyoshima
Comment 20 2012-03-12 12:37:47 PDT
Created attachment 131382 [details] just rebase
Takashi Toyoshima
Comment 21 2012-03-12 16:18:42 PDT
Created attachment 131441 [details] rename some methods to have dispatch prefix, too
Takashi Toyoshima
Comment 22 2012-03-12 16:22:58 PDT
Hi, Darin. Now, I notice that I must apply the same renaming to other methods. Sorry for narrow understanding on your comments.
Darin Fisher (:fishd, Google)
Comment 23 2012-03-13 16:11:12 PDT
Comment on attachment 131441 [details] rename some methods to have dispatch prefix, too View in context: https://bugs.webkit.org/attachment.cgi?id=131441&action=review > Source/WebCore/Modules/websockets/WebSocketChannel.cpp:277 > + frame->loader()->client()->dispatchWillOpenSocketStream(handle); nit: indentation nit: Document::frame() is a very cheap inline getter. Better to just do: if (m_document->frame()) m_document->frame()->loader()->client()->dispatch... > Source/WebKit/chromium/public/WebFrameClient.h:392 > + virtual void dispatchWillOpenSocketStream(WebSocketStreamHandle*) { } on WebFrameClient, we drop the "dispatch" prefix. that prefix is for FrameLoaderClient methods. it is telling the FrameLoaderClient to dispatch the "Foo" event, so if FrameLoaderClient has dispatchFoo, then WebFrameClient should have a "foo" method.
Takashi Toyoshima
Comment 24 2012-03-13 16:33:40 PDT
Takashi Toyoshima
Comment 25 2012-03-13 16:34:44 PDT
Comment on attachment 131441 [details] rename some methods to have dispatch prefix, too View in context: https://bugs.webkit.org/attachment.cgi?id=131441&action=review >> Source/WebCore/Modules/websockets/WebSocketChannel.cpp:277 >> + frame->loader()->client()->dispatchWillOpenSocketStream(handle); > > nit: indentation > > nit: Document::frame() is a very cheap inline getter. Better to just do: > > if (m_document->frame()) > m_document->frame()->loader()->client()->dispatch... Done. Sorry for poor nits. >> Source/WebKit/chromium/public/WebFrameClient.h:392 >> + virtual void dispatchWillOpenSocketStream(WebSocketStreamHandle*) { } > > on WebFrameClient, we drop the "dispatch" prefix. that prefix is for > FrameLoaderClient methods. it is telling the FrameLoaderClient to > dispatch the "Foo" event, so if FrameLoaderClient has dispatchFoo, > then WebFrameClient should have a "foo" method. I see. Thank you for explaining. I mistakenly followed upper dispatchIntent name. I fixed this name again now.
Takashi Toyoshima
Comment 26 2012-03-19 13:11:12 PDT
Takashi Toyoshima
Comment 27 2012-03-19 13:14:05 PDT
Upload a new CL. Nothing is different from the previous one. I just perform rebase.
Darin Fisher (:fishd, Google)
Comment 28 2012-03-19 13:43:22 PDT
Comment on attachment 132638 [details] Patch R=me for WebKit API changes.
Takashi Toyoshima
Comment 29 2012-03-19 14:00:41 PDT
Thank you Darin. Kent-san, could you review other parts except WebKit API?
Kent Tamura
Comment 30 2012-03-20 18:33:20 PDT
Comment on attachment 132638 [details] Patch ok
WebKit Review Bot
Comment 31 2012-03-20 18:36:27 PDT
Comment on attachment 132638 [details] Patch Rejecting attachment 132638 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: at 78. Hunk #4 succeeded at 1623 (offset -26 lines). 2 out of 4 hunks FAILED -- saving rejects to file Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp.rej patching file Source/WebKit/chromium/src/FrameLoaderClientImpl.h Hunk #2 succeeded at 210 (offset -2 lines). patching file Source/WebKit/chromium/src/SocketStreamHandle.cpp Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--force', u'--reviewer', u'Kent Tamura']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue/ Full output: http://queues.webkit.org/results/12035155
Takashi Toyoshima
Comment 32 2012-03-21 06:27:57 PDT
WebKit Review Bot
Comment 33 2012-03-21 06:29:25 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
WebKit Review Bot
Comment 34 2012-03-21 07:00:53 PDT
Comment on attachment 133033 [details] rebase Clearing flags on attachment: 133033 Committed r111537: <http://trac.webkit.org/changeset/111537>
WebKit Review Bot
Comment 35 2012-03-21 07:01:01 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.