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

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

Issue 338993006: DevTools: pass agent host id to the renderer (Blink). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Same w/ reattach. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.h ('k') | public/web/WebDevToolsAgent.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 /* 1 /*
2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (C) 2010-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 webagent->dispatchOnInspectorBackend(m_descriptor->message()); 193 webagent->dispatchOnInspectorBackend(m_descriptor->message());
194 } 194 }
195 195
196 private: 196 private:
197 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor; 197 OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor;
198 }; 198 };
199 199
200 WebDevToolsAgentImpl::WebDevToolsAgentImpl( 200 WebDevToolsAgentImpl::WebDevToolsAgentImpl(
201 WebViewImpl* webViewImpl, 201 WebViewImpl* webViewImpl,
202 WebDevToolsAgentClient* client) 202 WebDevToolsAgentClient* client)
203 : m_hostId(client->hostIdentifier()) 203 : m_debuggerId(client->debuggerId())
204 , m_layerTreeId(0) 204 , m_layerTreeId(0)
205 , m_client(client) 205 , m_client(client)
206 , m_webViewImpl(webViewImpl) 206 , m_webViewImpl(webViewImpl)
207 , m_attached(false) 207 , m_attached(false)
208 , m_generatingEvent(false) 208 , m_generatingEvent(false)
209 , m_deviceMetricsEnabled(false) 209 , m_deviceMetricsEnabled(false)
210 , m_emulateViewportEnabled(false) 210 , m_emulateViewportEnabled(false)
211 , m_originalViewportEnabled(false) 211 , m_originalViewportEnabled(false)
212 , m_isOverlayScrollbarsEnabled(false) 212 , m_isOverlayScrollbarsEnabled(false)
213 , m_originalMinimumPageScaleFactor(0) 213 , m_originalMinimumPageScaleFactor(0)
214 , m_originalMaximumPageScaleFactor(0) 214 , m_originalMaximumPageScaleFactor(0)
215 , m_pageScaleLimitsOverriden(false) 215 , m_pageScaleLimitsOverriden(false)
216 , m_touchEventEmulationEnabled(false) 216 , m_touchEventEmulationEnabled(false)
217 { 217 {
218 ASSERT(m_hostId > 0); 218 ASSERT(m_debuggerId > 0);
219 ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); 219 ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client);
220 } 220 }
221 221
222 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() 222 WebDevToolsAgentImpl::~WebDevToolsAgentImpl()
223 { 223 {
224 ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl); 224 ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl);
225 if (m_attached) 225 if (m_attached)
226 blink::Platform::current()->currentThread()->removeTaskObserver(this); 226 blink::Platform::current()->currentThread()->removeTaskObserver(this);
227 } 227 }
228 228
229 void WebDevToolsAgentImpl::attach() 229 void WebDevToolsAgentImpl::attach()
230 { 230 {
231 attach("");
232 }
233
234 void WebDevToolsAgentImpl::reattach(const WebString& savedState)
235 {
236 reattach("", savedState);
237 }
238
239 void WebDevToolsAgentImpl::attach(const WebString& hostId)
240 {
231 if (m_attached) 241 if (m_attached)
232 return; 242 return;
233 243
234 inspectorController()->connectFrontend(this); 244 inspectorController()->connectFrontend(hostId, this);
235 blink::Platform::current()->currentThread()->addTaskObserver(this); 245 blink::Platform::current()->currentThread()->addTaskObserver(this);
236 m_attached = true; 246 m_attached = true;
237 } 247 }
238 248
239 void WebDevToolsAgentImpl::reattach(const WebString& savedState) 249 void WebDevToolsAgentImpl::reattach(const WebString& hostId, const WebString& sa vedState)
240 { 250 {
241 if (m_attached) 251 if (m_attached)
242 return; 252 return;
243 253
244 inspectorController()->reuseFrontend(this, savedState); 254 inspectorController()->reuseFrontend(hostId, this, savedState);
245 blink::Platform::current()->currentThread()->addTaskObserver(this); 255 blink::Platform::current()->currentThread()->addTaskObserver(this);
246 m_attached = true; 256 m_attached = true;
247 } 257 }
248 258
249 void WebDevToolsAgentImpl::detach() 259 void WebDevToolsAgentImpl::detach()
250 { 260 {
251 blink::Platform::current()->currentThread()->removeTaskObserver(this); 261 blink::Platform::current()->currentThread()->removeTaskObserver(this);
252 262
253 // Prevent controller from sending messages to the frontend. 263 // Prevent controller from sending messages to the frontend.
254 InspectorController* ic = inspectorController(); 264 InspectorController* ic = inspectorController();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 if (InspectorController* ic = inspectorController()) 297 if (InspectorController* ic = inspectorController())
288 ic->didComposite(); 298 ic->didComposite();
289 } 299 }
290 300
291 void WebDevToolsAgentImpl::didCreateScriptContext(WebLocalFrameImpl* webframe, i nt worldId) 301 void WebDevToolsAgentImpl::didCreateScriptContext(WebLocalFrameImpl* webframe, i nt worldId)
292 { 302 {
293 // Skip non main world contexts. 303 // Skip non main world contexts.
294 if (worldId) 304 if (worldId)
295 return; 305 return;
296 if (WebCore::LocalFrame* frame = webframe->frame()) 306 if (WebCore::LocalFrame* frame = webframe->frame())
297 frame->script().setContextDebugId(m_hostId); 307 frame->script().setContextDebugId(m_debuggerId);
298 } 308 }
299 309
300 bool WebDevToolsAgentImpl::handleInputEvent(WebCore::Page* page, const WebInputE vent& inputEvent) 310 bool WebDevToolsAgentImpl::handleInputEvent(WebCore::Page* page, const WebInputE vent& inputEvent)
301 { 311 {
302 if (!m_attached && !m_generatingEvent) 312 if (!m_attached && !m_generatingEvent)
303 return false; 313 return false;
304 314
305 // FIXME: This workaround is required for touch emulation on Mac, where 315 // FIXME: This workaround is required for touch emulation on Mac, where
306 // compositor-side pinch handling is not enabled. See http://crbug.com/13800 3. 316 // compositor-side pinch handling is not enabled. See http://crbug.com/13800 3.
307 bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin || inputE vent.type == WebInputEvent::GesturePinchUpdate || inputEvent.type == WebInputEve nt::GesturePinchEnd; 317 bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin || inputE vent.type == WebInputEvent::GesturePinchUpdate || inputEvent.type == WebInputEve nt::GesturePinchEnd;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd) 731 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_removeBreakpointCmd)
722 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd); 732 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke ndDispatcher::kDebugger_setBreakpointsActiveCmd);
723 } 733 }
724 734
725 void WebDevToolsAgent::processPendingMessages() 735 void WebDevToolsAgent::processPendingMessages()
726 { 736 {
727 PageScriptDebugServer::shared().runPendingTasks(); 737 PageScriptDebugServer::shared().runPendingTasks();
728 } 738 }
729 739
730 } // namespace blink 740 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebDevToolsAgentImpl.h ('k') | public/web/WebDevToolsAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698