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

Side by Side Diff: webkit/glue/webdevtoolsagent_impl.cc

Issue 150220: DevTools: Set up utility context earlier (prevent from crash). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 | « webkit/glue/webdevtoolsagent_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "Document.h" 9 #include "Document.h"
10 #include "EventListener.h" 10 #include "EventListener.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 128 }
129 129
130 // We were attached prior to the page load -> init agents with Document. 130 // We were attached prior to the page load -> init agents with Document.
131 Document* doc; 131 Document* doc;
132 if (ready) { 132 if (ready) {
133 Page* page = web_view_impl_->page(); 133 Page* page = web_view_impl_->page();
134 doc = page->mainFrame()->document(); 134 doc = page->mainFrame()->document();
135 } else { 135 } else {
136 doc = NULL; 136 doc = NULL;
137 } 137 }
138 debugger_agent_impl_->ResetUtilityContext(doc, &utility_context_);
139 if (doc) { 138 if (doc) {
139 // Do not clear utility context when document is being cleared -
140 // there still can be pending messages from the client that require
141 // context to be processed.
142 debugger_agent_impl_->ResetUtilityContext(doc, &utility_context_);
140 InitDevToolsAgentHost(); 143 InitDevToolsAgentHost();
144 if (!report_frame_navigate_url_.empty()) {
145 // This is a document from the first load, issue frame navigate
146 // scheduled in DidCommitLoadForFrame.
147 tools_agent_delegate_stub_->FrameNavigate(report_frame_navigate_url_);
148 report_frame_navigate_url_ = "";
149 }
141 } 150 }
142 dom_agent_impl_->SetDocument(doc); 151 dom_agent_impl_->SetDocument(doc);
143 } 152 }
144 153
145 void WebDevToolsAgentImpl::DidCommitLoadForFrame( 154 void WebDevToolsAgentImpl::DidCommitLoadForFrame(
146 WebViewImpl* webview, 155 WebViewImpl* webview,
147 WebFrame* frame, 156 WebFrame* frame,
148 bool is_new_navigation) { 157 bool is_new_navigation) {
149 if (!attached_) { 158 if (!attached_) {
150 DisposeUtilityContext(); 159 DisposeUtilityContext();
151 return; 160 return;
152 } 161 }
153 WebDataSource* ds = frame->GetDataSource(); 162 WebDataSource* ds = frame->GetDataSource();
154 const WebURLRequest& request = ds->request(); 163 const WebURLRequest& request = ds->request();
155 GURL url = ds->hasUnreachableURL() ? 164 GURL url = ds->hasUnreachableURL() ?
156 ds->unreachableURL() : 165 ds->unreachableURL() :
157 request.url(); 166 request.url();
158 tools_agent_delegate_stub_->FrameNavigate( 167 if (webview->GetMainFrame() == frame) {
159 url.possibly_invalid_spec(), 168 // Schedule frame navigate event.
160 webview->GetMainFrame() == frame); 169 report_frame_navigate_url_ = url.possibly_invalid_spec();
170 }
161 InspectorController* ic = webview->page()->inspectorController(); 171 InspectorController* ic = webview->page()->inspectorController();
162 // Unhide resources panel if necessary. 172 // Unhide resources panel if necessary.
163 tools_agent_delegate_stub_->SetResourcesPanelEnabled( 173 tools_agent_delegate_stub_->SetResourcesPanelEnabled(
164 ic->resourceTrackingEnabled()); 174 ic->resourceTrackingEnabled());
165 } 175 }
166 176
167 void WebDevToolsAgentImpl::WindowObjectCleared(WebFrameImpl* webframe) { 177 void WebDevToolsAgentImpl::WindowObjectCleared(WebFrameImpl* webframe) {
168 DebuggerAgentManager::SetHostId(webframe, host_id_); 178 DebuggerAgentManager::SetHostId(webframe, host_id_);
169 } 179 }
170 180
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 const std::string& command, 335 const std::string& command,
326 int caller_id) { 336 int caller_id) {
327 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id); 337 DebuggerAgentManager::ExecuteDebuggerCommand(command, caller_id);
328 } 338 }
329 339
330 // static 340 // static
331 void WebDevToolsAgent::SetMessageLoopDispatchHandler( 341 void WebDevToolsAgent::SetMessageLoopDispatchHandler(
332 MessageLoopDispatchHandler handler) { 342 MessageLoopDispatchHandler handler) {
333 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler); 343 DebuggerAgentManager::SetMessageLoopDispatchHandler(handler);
334 } 344 }
OLDNEW
« no previous file with comments | « webkit/glue/webdevtoolsagent_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698