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

Issue 23506013: Make the embedder responsible for creating the WebFrame (Closed)

Created:
7 years, 3 months ago by awong
Modified:
7 years, 2 months ago
CC:
blink-reviews, jamesr, dglazkov+blink, eae+blinkwatch, abarth-chromium, chromium-site-isolation-reviews_chromium.org, nasko, dcheng
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Make the embedder responsible for creating the WebFrame. Previously, the WebViewImpl created the mainframe, and the WebFrameImpl created the child frames. This CL moves responsibility for creating all WebFrameImpls to the embedder. WebFrames are now allocated using the create() factory method. The caller is responsible for ensuring WebFrame::close() is called to balance out the reference count. This parallels the lifetime of WebView. For the main frame, the embedder constructs the WebFrame first, and then provides the WebView a references to the main frame via the WebView::setMainFrame() method. For child frames, the embedder provides the new WebFrame via WebFrameClient::createChildFrame(). The embedder is notified that the WebFrame is no longer needed via the WebFrameClient::frameDetached() call. Because WebView no longer creates its own main frame, a WebViewHelper class has been added to reduce boilerplate in unittests. Lastly, there is still some vestigial code left (all labeled with FIXMEs) to facilitate migration of embedders to the new lifetime semantics. Those will be removed in a subsequent CL. (https://codereview.chromium.org/23841002/ is the Chrome side of the CL) BUG=245126 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=158354

Patch Set 1 #

Patch Set 2 : Make creation and ownership similar to RenderView/WebView #

Patch Set 3 : fix style #

Total comments: 1

Patch Set 4 : updated to handle the mainframe creation. #

Patch Set 5 : Move creation of MainFrame outside of WebViewImpl. #

Patch Set 6 : make embedder own mainframe. #

Patch Set 7 : detach() -> close(). Clean up lifetimes. #

Patch Set 8 : Add WebViewHelper for unittests. #

Total comments: 15

Patch Set 9 : Make unittest compile. #

Patch Set 10 : Make landable and fix style #

Patch Set 11 : finish addressing Darin's comments. #

Patch Set 12 : fix try-bot failures #

Patch Set 13 : detach client on WebViewHelper teardown. #

Patch Set 14 : Move the helper out of the test fixture in WebFrameTests #

Patch Set 15 : This time for sure. #

Patch Set 16 : layout tests? why do those matter? #

Patch Set 17 : wordmith a comment #

Total comments: 30

Patch Set 18 : address comments #

Total comments: 8

Patch Set 19 : Address dcheng's comments #

Patch Set 20 : rebased #

Patch Set 21 : Fix WebFrameTest #

Patch Set 22 : whackamole #

Patch Set 23 : Fix lifetime on frame detach #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1319 lines, -1239 lines) Patch
M Source/web/WebFrameImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 chunks +8 lines, -4 lines 0 comments Download
M Source/web/WebFrameImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 12 chunks +66 lines, -21 lines 0 comments Download
M Source/web/WebHelperPluginImpl.h View 1 2 3 4 5 6 2 chunks +2 lines, -1 line 0 comments Download
M Source/web/WebHelperPluginImpl.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -2 lines 0 comments Download
M Source/web/WebSharedWorkerImpl.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M Source/web/WebSharedWorkerImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 3 chunks +7 lines, -4 lines 0 comments Download
M Source/web/WebViewImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 3 chunks +3 lines, -2 lines 0 comments Download
M Source/web/WebViewImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +23 lines, -8 lines 0 comments Download
M Source/web/tests/AssociatedURLLoaderTest.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +4 lines, -1 line 0 comments Download
M Source/web/tests/ChromeClientImplTest.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +5 lines, -1 line 0 comments Download
M Source/web/tests/CustomEventTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -3 lines 0 comments Download
M Source/web/tests/FrameLoaderClientImplTest.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -1 line 0 comments Download
M Source/web/tests/FrameTestHelpers.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +28 lines, -6 lines 0 comments Download
M Source/web/tests/FrameTestHelpers.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +64 lines, -35 lines 0 comments Download
M Source/web/tests/LinkHighlightTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 6 chunks +6 lines, -6 lines 0 comments Download
M Source/web/tests/ListenerLeakTest.cpp View 1 2 3 4 5 6 7 1 chunk +2 lines, -6 lines 0 comments Download
M Source/web/tests/PageSerializerTest.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +5 lines, -1 line 0 comments Download
M Source/web/tests/PrerenderingTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +9 lines, -20 lines 0 comments Download
M Source/web/tests/ProgrammaticScrollTest.cpp View 1 2 3 4 5 6 7 10 chunks +10 lines, -15 lines 0 comments Download
M Source/web/tests/RenderLayerBackingTest.cpp View 1 2 3 4 5 6 7 8 9 4 chunks +4 lines, -1 line 0 comments Download
M Source/web/tests/RenderTableCellTest.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +17 lines, -12 lines 0 comments Download
M Source/web/tests/RenderTableRowTest.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +17 lines, -12 lines 0 comments Download
M Source/web/tests/ScrollingCoordinatorChromiumTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 chunks +4 lines, -1 line 0 comments Download
M Source/web/tests/WebFrameTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 139 chunks +928 lines, -972 lines 0 comments Download
M Source/web/tests/WebInputEventConversionTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 2 chunks +2 lines, -3 lines 0 comments Download
M Source/web/tests/WebPageNewSerializerTest.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +4 lines, -1 line 0 comments Download
M Source/web/tests/WebPageSerializerTest.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -1 line 0 comments Download
M Source/web/tests/WebPluginContainerTest.cpp View 1 2 3 4 5 6 7 4 chunks +6 lines, -9 lines 0 comments Download
M Source/web/tests/WebViewTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 39 chunks +43 lines, -81 lines 0 comments Download
M public/web/WebFrame.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 4 chunks +24 lines, -1 line 0 comments Download
M public/web/WebFrameClient.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +5 lines, -1 line 0 comments Download
M public/web/WebView.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 1 chunk +8 lines, -7 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
darin (slow to review)
I like what you are doing here. It might be nice if didCreateFrame was named ...
7 years, 3 months ago (2013-09-05 06:07:53 UTC) #1
awong
I've made it so the embedder manages the lifetime. Now 1) For the mainframe WebFrameImpl, ...
7 years, 3 months ago (2013-09-13 01:37:53 UTC) #2
darin (slow to review)
Wow, good stuff! https://codereview.chromium.org/23506013/diff/21001/Source/core/loader/FrameLoader.cpp File Source/core/loader/FrameLoader.cpp (right): https://codereview.chromium.org/23506013/diff/21001/Source/core/loader/FrameLoader.cpp#newcode1161 Source/core/loader/FrameLoader.cpp:1161: // Note...the problem is mainframe ownership ...
7 years, 3 months ago (2013-09-13 04:02:47 UTC) #3
awong
Thanks for the comments! I'll address most of them tomorrow. However, I wanted to respond ...
7 years, 3 months ago (2013-09-13 04:25:02 UTC) #4
darin (slow to review)
I'd need to study WebSharedWorkerImpl.cpp and WebHelperPluginImpl.cpp some more. The frame identifier is unlikely to ...
7 years, 3 months ago (2013-09-13 04:32:20 UTC) #5
darin (slow to review)
I think the frame identifier is used by the Chrome Extension system in its WebRequest ...
7 years, 3 months ago (2013-09-13 04:32:48 UTC) #6
awong
I'll look at it too, but even if it's okay to ignore them for WebSharedWorkerImpl ...
7 years, 3 months ago (2013-09-13 04:46:08 UTC) #7
darin (slow to review)
Good point. Perhaps just add a FIXME noting this temporary wart. On Sep 12, 2013 ...
7 years, 3 months ago (2013-09-13 04:52:31 UTC) #8
awong
Ready for a real review! https://codereview.chromium.org/23506013/diff/21001/Source/web/WebHelperPluginImpl.cpp File Source/web/WebHelperPluginImpl.cpp (right): https://codereview.chromium.org/23506013/diff/21001/Source/web/WebHelperPluginImpl.cpp#newcode153 Source/web/WebHelperPluginImpl.cpp:153: m_mainFrame = static_cast<WebFrameImpl*>(WebFrame::create(client)); On ...
7 years, 3 months ago (2013-09-18 22:04:47 UTC) #9
darin (slow to review)
https://codereview.chromium.org/23506013/diff/58001/Source/web/WebFrameImpl.cpp File Source/web/WebFrameImpl.cpp (right): https://codereview.chromium.org/23506013/diff/58001/Source/web/WebFrameImpl.cpp#newcode559 Source/web/WebFrameImpl.cpp:559: return embedderIdentifier(); maybe identifier() should just be implemented as ...
7 years, 3 months ago (2013-09-19 22:36:18 UTC) #10
nasko
Just a few clarifying comments. https://codereview.chromium.org/23506013/diff/58001/Source/web/tests/FrameTestHelpers.cpp File Source/web/tests/FrameTestHelpers.cpp (right): https://codereview.chromium.org/23506013/diff/58001/Source/web/tests/FrameTestHelpers.cpp#newcode131 Source/web/tests/FrameTestHelpers.cpp:131: reset(); Unneeded reset? The ...
7 years, 3 months ago (2013-09-19 22:54:12 UTC) #11
awong
Comments addressed. https://codereview.chromium.org/23506013/diff/58001/Source/web/WebFrameImpl.cpp File Source/web/WebFrameImpl.cpp (right): https://codereview.chromium.org/23506013/diff/58001/Source/web/WebFrameImpl.cpp#newcode559 Source/web/WebFrameImpl.cpp:559: return embedderIdentifier(); On 2013/09/19 22:36:19, darin wrote: ...
7 years, 3 months ago (2013-09-20 00:36:23 UTC) #12
dcheng
https://codereview.chromium.org/23506013/diff/90001/Source/web/WebFrameImpl.cpp File Source/web/WebFrameImpl.cpp (right): https://codereview.chromium.org/23506013/diff/90001/Source/web/WebFrameImpl.cpp#newcode2192 Source/web/WebFrameImpl.cpp:2192: if (mustCallDidCreateFrame && m_client) Just curious--why do we need ...
7 years, 3 months ago (2013-09-20 02:29:59 UTC) #13
awong
PTAL https://codereview.chromium.org/23506013/diff/90001/Source/web/WebFrameImpl.cpp File Source/web/WebFrameImpl.cpp (right): https://codereview.chromium.org/23506013/diff/90001/Source/web/WebFrameImpl.cpp#newcode2192 Source/web/WebFrameImpl.cpp:2192: if (mustCallDidCreateFrame && m_client) On 2013/09/20 02:29:59, dcheng ...
7 years, 3 months ago (2013-09-20 23:57:13 UTC) #14
darin (slow to review)
LGTM
7 years, 3 months ago (2013-09-21 04:04:17 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ajwong@chromium.org/23506013/96001
7 years, 3 months ago (2013-09-21 04:16:09 UTC) #16
awong
FYI, I found a bug where I introduced an extra m_client->frameDetach() during the error case ...
7 years, 2 months ago (2013-09-25 23:24:56 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ajwong@chromium.org/23506013/116001
7 years, 2 months ago (2013-09-25 23:25:14 UTC) #18
commit-bot: I haz the power
Commit queue rejected this change because the description was changed between the time the change ...
7 years, 2 months ago (2013-09-26 06:01:49 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ajwong@chromium.org/23506013/116001
7 years, 2 months ago (2013-09-26 06:21:29 UTC) #20
commit-bot: I haz the power
7 years, 2 months ago (2013-09-26 06:22:58 UTC) #21
Message was sent while issue was closed.
Change committed as 158354

Powered by Google App Engine
This is Rietveld 408576698