From 63a5c2a2b231a3dca148360d3acf3b6903de0363 Mon Sep 17 00:00:00 2001 From: "pfeldman@chromium.org" Date: Thu, 26 Mar 2009 11:12:53 +0000 Subject: Make DevTools client survive 'refresh' of the inspectable tab. Review URL: http://codereview.chromium.org/54002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12541 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/renderer/devtools_agent.cc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'chrome/renderer/devtools_agent.cc') diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc index 4d52fca1..1a60ed5 100644 --- a/chrome/renderer/devtools_agent.cc +++ b/chrome/renderer/devtools_agent.cc @@ -177,11 +177,26 @@ void DevToolsAgent::OnRpcMessage(const std::string& raw_msg) { } void DevToolsAgent::OnInspectElement(int x, int y) { - WebDevToolsAgent* web_agent = view_->webview()->GetWebDevToolsAgent(); - web_agent->InspectElement(x, y); + view_loop_->PostTask(FROM_HERE, NewRunnableMethod( + this, &DevToolsAgent::InspectElement, x, y)); } void DevToolsAgent::DispatchRpcMessage(const std::string& raw_msg) { - WebDevToolsAgent* web_agent = view_->webview()->GetWebDevToolsAgent(); + if (!view_) + return; + WebView* web_view = view_->webview(); + if (!web_view) + return; + WebDevToolsAgent* web_agent = web_view->GetWebDevToolsAgent(); web_agent->DispatchMessageFromClient(raw_msg); } + +void DevToolsAgent::InspectElement(int x, int y) { + if (!view_) + return; + WebView* web_view = view_->webview(); + if (!web_view) + return; + WebDevToolsAgent* web_agent = web_view->GetWebDevToolsAgent(); + web_agent->InspectElement(x, y); +} -- cgit v1.1