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

Side by Side Diff: Source/web/WebViewFrameWidget.cpp

Issue 1310063002: Snapshot a pointer to the main frame when creating WebViewFrameWidget. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Futureproof Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebViewFrameWidget.h ('k') | public/web/WebFrameWidget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be found 2 // Use of this source code is governed by a BSD-style license that can be found
3 // in the LICENSE file. 3 // in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "web/WebViewFrameWidget.h" 6 #include "web/WebViewFrameWidget.h"
7 7
8 #include "web/WebLocalFrameImpl.h" 8 #include "web/WebLocalFrameImpl.h"
9 #include "web/WebViewImpl.h" 9 #include "web/WebViewImpl.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 WebViewFrameWidget::WebViewFrameWidget(WebViewImpl& webView) : m_webView(&webVie w) 13 WebViewFrameWidget::WebViewFrameWidget(WebWidgetClient* client, WebViewImpl& web View, WebLocalFrameImpl& mainFrame)
14 : m_client(client), m_webView(&webView), m_mainFrame(&mainFrame)
14 { 15 {
15 m_webView->mainFrameImpl()->setFrameWidget(this); 16 m_mainFrame->setFrameWidget(this);
16 } 17 }
17 18
18 WebViewFrameWidget::~WebViewFrameWidget() 19 WebViewFrameWidget::~WebViewFrameWidget()
19 { 20 {
20 } 21 }
21 22
22 void WebViewFrameWidget::close() 23 void WebViewFrameWidget::close()
23 { 24 {
24 m_webView->mainFrameImpl()->setFrameWidget(nullptr); 25 // Note: it's important to use the captured main frame pointer here. During
26 // a frame swap, the swapped frame is detached *after* the frame tree is
27 // updated. If the main frame is being swapped, then
28 // m_webView()->mainFrameImpl() will no longer point to the original frame.
29 m_mainFrame->setFrameWidget(nullptr);
30 m_mainFrame = nullptr;
25 m_webView = nullptr; 31 m_webView = nullptr;
32 m_client = nullptr;
26 33
27 // Note: this intentionally does not forward to WebView::close(), to make it 34 // Note: this intentionally does not forward to WebView::close(), to make it
28 // easier to untangle the cleanup logic later. 35 // easier to untangle the cleanup logic later.
29 36
30 delete this; 37 delete this;
31 } 38 }
32 39
33 WebSize WebViewFrameWidget::size() 40 WebSize WebViewFrameWidget::size()
34 { 41 {
35 return m_webView->size(); 42 return m_webView->size();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 { 255 {
249 return m_webView->updateTopControlsState(constraints, current, animate); 256 return m_webView->updateTopControlsState(constraints, current, animate);
250 } 257 }
251 258
252 void WebViewFrameWidget::setVisibilityState(WebPageVisibilityState visibilitySta te, bool isInitialState) 259 void WebViewFrameWidget::setVisibilityState(WebPageVisibilityState visibilitySta te, bool isInitialState)
253 { 260 {
254 return m_webView->setVisibilityState(visibilityState, isInitialState); 261 return m_webView->setVisibilityState(visibilityState, isInitialState);
255 } 262 }
256 263
257 } // namespace blink 264 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewFrameWidget.h ('k') | public/web/WebFrameWidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698