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

Unified Diff: webkit/glue/webview_impl.cc

Issue 150208: Set the WebViewDelegate earlier during WebView creation to ensure that... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webview_impl.cc
===================================================================
--- webkit/glue/webview_impl.cc (revision 19802)
+++ webkit/glue/webview_impl.cc (working copy)
@@ -313,15 +313,14 @@
instance->AddRef();
instance->SetPreferences(prefs);
- // Here, we construct a new WebFrameImpl with a reference count of 0. That
- // is bumped up to 1 by InitMainFrame. The reference count is decremented
- // when the corresponding WebCore::Frame object is destroyed.
- WebFrameImpl* main_frame = new WebFrameImpl();
- main_frame->InitMainFrame(instance);
+ // NOTE: The WebFrameImpl takes a reference to itself within InitMainFrame
+ // and releases that reference once the corresponding Frame is destroyed.
+ scoped_refptr<WebFrameImpl> main_frame = new WebFrameImpl();
- // Set the delegate after initializing the main frame, to avoid trying to
- // respond to notifications before we're fully initialized.
+ // Set the delegate before initializing the frame, so that notifications like
+ // DidCreateDataSource make their way to the client.
instance->delegate_ = delegate;
+ main_frame->InitMainFrame(instance);
WebDevToolsAgentDelegate* tools_delegate =
delegate->GetWebDevToolsAgentDelegate();
« no previous file with comments | « chrome/renderer/render_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698