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

Issue 2562323002: Devirtualize Frame::domWindow(). (Closed)

Created:
4 years ago by dcheng
Modified:
4 years ago
Reviewers:
haraken
CC:
chromium-reviews, tyoshino+watch_chromium.org, blink-reviews-html_chromium.org, mvanouwerkerk+watch_chromium.org, webcomponents-bugzilla_chromium.org, sof, eae+blinkwatch, mlamouri+watch-blink_chromium.org, dcheng, blink-reviews-dom_chromium.org, dglazkov+blink, dominicc+watchlist_chromium.org, gavinp+loader_chromium.org, feature-vr-reviews_chromium.org, blink-reviews, kinuko+watch, Nate Chapin, loading-reviews_chromium.org, rwlbuis, yhirano, tyoshino (SeeGerritForStatus), esprehn
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Devirtualize Frame::domWindow(). Originally, this was a virtual, but it meant that LocalFrame::domWindow could not return a LocalDOMWindow, due to the circular dependencies between the LocalFrame and LocalDOMWindow header. As a workaround, LocalFrame exposed a special localDOMWindow getter. However, this leads to code that reads very LocalFrame-centric. Since the ultimate goal of OOPIF integration is to integrate seamlessly, it would be nice to remove the "local" prefix from the getter. Since this function doesn't need to be virtual, just de-virtualize it and have the getters of derived classes return the appropriate type. BUG=none Committed: https://crrev.com/fd3cea4f35b5b831cef689f0720f13d8f22ba103 Cr-Commit-Position: refs/heads/master@{#437887}

Patch Set 1 #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+75 lines, -78 lines) Patch
M third_party/WebKit/Source/core/dom/Document.cpp View 3 chunks +8 lines, -7 lines 4 comments Download
M third_party/WebKit/Source/core/dom/custom/CustomElementRegistryTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/custom/CustomElementTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/editing/FrameSelection.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/DOMWindowProperty.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/Frame.h View 3 chunks +3 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/Frame.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/LocalFrame.h View 4 chunks +1 line, -7 lines 0 comments Download
M third_party/WebKit/Source/core/frame/LocalFrame.cpp View 5 chunks +9 lines, -9 lines 2 comments Download
M third_party/WebKit/Source/core/frame/RemoteDOMWindow.h View 2 chunks +7 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/frame/RemoteFrame.h View 3 chunks +0 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/frame/RemoteFrame.cpp View 3 chunks +4 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/core/html/ImageDocumentTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/loader/DocumentLoader.cpp View 1 chunk +1 line, -2 lines 0 comments Download
M third_party/WebKit/Source/core/loader/FrameLoader.cpp View 3 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/page/Page.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/xml/XSLTProcessor.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/csspaint/PaintWorkletTest.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/gamepad/NavigatorGamepad.cpp View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/storage/StorageArea.cpp View 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/modules/vr/NavigatorVR.cpp View 2 chunks +8 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/web/WebLocalFrameImpl.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/web/WebPagePopupImpl.cpp View 3 chunks +3 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp View 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/web/tests/VisualViewportTest.cpp View 1 chunk +1 line, -2 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebFrameTest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 20 (10 generated)
dcheng
4 years ago (2016-12-12 08:16:49 UTC) #5
dcheng
Note: I also want to make similar de-vritualization transformations for DOMWindow::frame() in followups as well ...
4 years ago (2016-12-12 08:18:31 UTC) #6
haraken
https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp#newcode413 third_party/WebKit/Source/core/dom/Document.cpp:413: // pointer? I want to guarantee the following fact: ...
4 years ago (2016-12-12 09:54:59 UTC) #7
dcheng
https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp#newcode413 third_party/WebKit/Source/core/dom/Document.cpp:413: // pointer? On 2016/12/12 09:54:59, haraken wrote: > > ...
4 years ago (2016-12-12 10:21:39 UTC) #10
dcheng
https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp File third_party/WebKit/Source/core/dom/Document.cpp (right): https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp#newcode413 third_party/WebKit/Source/core/dom/Document.cpp:413: // pointer? On 2016/12/12 10:21:39, dcheng wrote: > On ...
4 years ago (2016-12-12 10:32:23 UTC) #11
haraken
On 2016/12/12 10:32:23, dcheng wrote: > https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp > File third_party/WebKit/Source/core/dom/Document.cpp (right): > > https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/core/dom/Document.cpp#newcode413 > ...
4 years ago (2016-12-12 11:12:23 UTC) #12
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/2562323002/1
4 years ago (2016-12-12 16:02:01 UTC) #14
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years ago (2016-12-12 16:34:23 UTC) #17
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/fd3cea4f35b5b831cef689f0720f13d8f22ba103 Cr-Commit-Position: refs/heads/master@{#437887}
4 years ago (2016-12-12 16:37:37 UTC) #19
haraken
4 years ago (2016-12-13 07:22:23 UTC) #20
Message was sent while issue was closed.
https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/dom/Document.cpp (right):

https://codereview.chromium.org/2562323002/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/dom/Document.cpp:413: // pointer?
On 2016/12/12 10:32:23, dcheng wrote:
> On 2016/12/12 10:21:39, dcheng wrote:
> > On 2016/12/12 09:54:59, haraken wrote:
> > > 
> > > I want to guarantee the following fact:
> > > 
> > > - When a context is detached, frame()->domWindow(),
domWindow()->document(),
> > > document()->frame() and frame()->document() start returning nullptr.
> > > 
> > > To that goal, I tried to clear domWindow()->document() when the context
gets
> > > detached (https://codereview.chromium.org/2393133005) but found that it
> needs
> > to
> > > fix a lot of call sites that are assuming that domWindow()->document()
> doesn't
> > > return null after the detachment...
> > > 
> > 
> > Yes, that's basically not possible today: because JS can access properties
of
> a
> > detached window, we can't clear any of the pointers when a frame is
detached.
> > 
> > If we ever want to change this invariant, we'll have to revisit this, but
> until
> > then, I think it would be better if code doesn't null-check unnecessarily,
> > because it makes the invariants harder to understand.
> 
> ALso, in a followup CL, I want to explore removing m_frame or m_domWindow, so
> it's easier to keep these two in sync. That would help resolve the TODO below
as
> well. Probaby I would want to remove m_frame, since we clear
> m_domWindow->frame() on detach already.

You're right that e.g., frame()->domWindow() should not be cleared when the
context is detached. However, document()->frame() is cleared when the context is
detached.

I think we shouldn't break the connection between Frame and Window on the
context detachment. However, I think we should break the connection between
Document and Frame and the connection between Document and Window.

That's confusing anyway :)

Powered by Google App Engine
This is Rietveld 408576698