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

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

Issue 1924173002: [DevTools] Improve performance of InstrumentingAgents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/web/WebDevToolsAgentImpl.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 /* 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 WebDevToolsAgentImpl::WebDevToolsAgentImpl( 296 WebDevToolsAgentImpl::WebDevToolsAgentImpl(
297 WebLocalFrameImpl* webLocalFrameImpl, 297 WebLocalFrameImpl* webLocalFrameImpl,
298 WebDevToolsAgentClient* client, 298 WebDevToolsAgentClient* client,
299 InspectorOverlay* overlay, 299 InspectorOverlay* overlay,
300 bool includeViewAgents) 300 bool includeViewAgents)
301 : m_client(client) 301 : m_client(client)
302 , m_webLocalFrameImpl(webLocalFrameImpl) 302 , m_webLocalFrameImpl(webLocalFrameImpl)
303 #if DCHECK_IS_ON() 303 #if DCHECK_IS_ON()
304 , m_hasBeenDisposed(false) 304 , m_hasBeenDisposed(false)
305 #endif 305 #endif
306 , m_instrumentingSessions(m_webLocalFrameImpl->frame()->instrumentingSession s()) 306 , m_instrumentingAgents(m_webLocalFrameImpl->frame()->instrumentingAgents())
307 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF rameImpl->frame())) 307 , m_resourceContentLoader(InspectorResourceContentLoader::create(m_webLocalF rameImpl->frame()))
308 , m_overlay(overlay) 308 , m_overlay(overlay)
309 , m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame())) 309 , m_inspectedFrames(InspectedFrames::create(m_webLocalFrameImpl->frame()))
310 , m_resourceContainer(new InspectorResourceContainer(m_inspectedFrames)) 310 , m_resourceContainer(new InspectorResourceContainer(m_inspectedFrames))
311 , m_domAgent(nullptr) 311 , m_domAgent(nullptr)
312 , m_pageAgent(nullptr) 312 , m_pageAgent(nullptr)
313 , m_resourceAgent(nullptr) 313 , m_resourceAgent(nullptr)
314 , m_layerTreeAgent(nullptr) 314 , m_layerTreeAgent(nullptr)
315 , m_tracingAgent(nullptr) 315 , m_tracingAgent(nullptr)
316 , m_includeViewAgents(includeViewAgents) 316 , m_includeViewAgents(includeViewAgents)
(...skipping 30 matching lines...) Expand all
347 347
348 // static 348 // static
349 void WebDevToolsAgentImpl::webFrameWidgetImplClosed(WebFrameWidgetImpl* webFrame WidgetImpl) 349 void WebDevToolsAgentImpl::webFrameWidgetImplClosed(WebFrameWidgetImpl* webFrame WidgetImpl)
350 { 350 {
351 ClientMessageLoopAdapter::webFrameWidgetImplClosed(webFrameWidgetImpl); 351 ClientMessageLoopAdapter::webFrameWidgetImplClosed(webFrameWidgetImpl);
352 } 352 }
353 353
354 DEFINE_TRACE(WebDevToolsAgentImpl) 354 DEFINE_TRACE(WebDevToolsAgentImpl)
355 { 355 {
356 visitor->trace(m_webLocalFrameImpl); 356 visitor->trace(m_webLocalFrameImpl);
357 visitor->trace(m_instrumentingSessions); 357 visitor->trace(m_instrumentingAgents);
358 visitor->trace(m_resourceContentLoader); 358 visitor->trace(m_resourceContentLoader);
359 visitor->trace(m_overlay); 359 visitor->trace(m_overlay);
360 visitor->trace(m_inspectedFrames); 360 visitor->trace(m_inspectedFrames);
361 visitor->trace(m_resourceContainer); 361 visitor->trace(m_resourceContainer);
362 visitor->trace(m_domAgent); 362 visitor->trace(m_domAgent);
363 visitor->trace(m_pageAgent); 363 visitor->trace(m_pageAgent);
364 visitor->trace(m_resourceAgent); 364 visitor->trace(m_resourceAgent);
365 visitor->trace(m_layerTreeAgent); 365 visitor->trace(m_layerTreeAgent);
366 visitor->trace(m_tracingAgent); 366 visitor->trace(m_tracingAgent);
367 visitor->trace(m_session); 367 visitor->trace(m_session);
368 } 368 }
369 369
370 void WebDevToolsAgentImpl::willBeDestroyed() 370 void WebDevToolsAgentImpl::willBeDestroyed()
371 { 371 {
372 DCHECK(m_webLocalFrameImpl->frame()); 372 DCHECK(m_webLocalFrameImpl->frame());
373 DCHECK(m_inspectedFrames->root()->view()); 373 DCHECK(m_inspectedFrames->root()->view());
374 detach(); 374 detach();
375 m_resourceContentLoader->dispose(); 375 m_resourceContentLoader->dispose();
376 } 376 }
377 377
378 void WebDevToolsAgentImpl::initializeSession(int sessionId, const String& hostId ) 378 void WebDevToolsAgentImpl::initializeSession(int sessionId, const String& hostId )
379 { 379 {
380 m_session = new InspectorSession(this, m_inspectedFrames.get(), sessionId, f alse /* autoFlush */); 380 m_session = new InspectorSession(this, m_inspectedFrames.get(), m_instrument ingAgents.get(), sessionId, false /* autoFlush */);
381 381
382 ClientMessageLoopAdapter::ensureMainThreadDebuggerCreated(m_client); 382 ClientMessageLoopAdapter::ensureMainThreadDebuggerCreated(m_client);
383 MainThreadDebugger* mainThreadDebugger = MainThreadDebugger::instance(); 383 MainThreadDebugger* mainThreadDebugger = MainThreadDebugger::instance();
384 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate(); 384 v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate();
385 385
386 m_v8Session = mainThreadDebugger->debugger()->connect(mainThreadDebugger->co ntextGroupId(m_inspectedFrames->root())); 386 m_v8Session = mainThreadDebugger->debugger()->connect(mainThreadDebugger->co ntextGroupId(m_inspectedFrames->root()));
387 V8RuntimeAgent* runtimeAgent = m_v8Session->runtimeAgent(); 387 V8RuntimeAgent* runtimeAgent = m_v8Session->runtimeAgent();
388 388
389 m_session->append(PageRuntimeAgent::create(this, runtimeAgent, m_inspectedFr ames.get())); 389 m_session->append(PageRuntimeAgent::create(this, runtimeAgent, m_inspectedFr ames.get()));
390 390
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 m_session->append(DeviceOrientationInspectorAgent::create(page)); 451 m_session->append(DeviceOrientationInspectorAgent::create(page));
452 m_session->append(new InspectorAccessibilityAgent(page, m_domAgent)); 452 m_session->append(new InspectorAccessibilityAgent(page, m_domAgent));
453 m_session->append(InspectorDOMStorageAgent::create(page)); 453 m_session->append(InspectorDOMStorageAgent::create(page));
454 m_session->append(InspectorCacheStorageAgent::create()); 454 m_session->append(InspectorCacheStorageAgent::create());
455 } 455 }
456 456
457 if (m_overlay) 457 if (m_overlay)
458 m_overlay->init(cssAgent, debuggerAgent, m_domAgent); 458 m_overlay->init(cssAgent, debuggerAgent, m_domAgent);
459 459
460 Platform::current()->currentThread()->addTaskObserver(this); 460 Platform::current()->currentThread()->addTaskObserver(this);
461 InspectorInstrumentation::registerInstrumentingSessions(m_instrumentingSessi ons.get()); 461 InspectorInstrumentation::registerInstrumentingAgents(m_instrumentingAgents. get());
462 m_instrumentingSessions->add(m_session);
463 } 462 }
464 463
465 void WebDevToolsAgentImpl::destroySession() 464 void WebDevToolsAgentImpl::destroySession()
466 { 465 {
467 if (m_overlay) 466 if (m_overlay)
468 m_overlay->clear(); 467 m_overlay->clear();
469 468
470 m_tracingAgent.clear(); 469 m_tracingAgent.clear();
471 m_layerTreeAgent.clear(); 470 m_layerTreeAgent.clear();
472 m_resourceAgent.clear(); 471 m_resourceAgent.clear();
473 m_pageAgent.clear(); 472 m_pageAgent.clear();
474 m_domAgent.clear(); 473 m_domAgent.clear();
475 474
476 m_session->detach(); 475 m_session->detach();
477 m_instrumentingSessions->remove(m_session);
478 m_v8Session.clear(); 476 m_v8Session.clear();
479 m_session.clear(); 477 m_session.clear();
480 478
481 Platform::current()->currentThread()->removeTaskObserver(this); 479 Platform::current()->currentThread()->removeTaskObserver(this);
482 InspectorInstrumentation::unregisterInstrumentingSessions(m_instrumentingSes sions.get()); 480 InspectorInstrumentation::unregisterInstrumentingAgents(m_instrumentingAgent s.get());
483 } 481 }
484 482
485 void WebDevToolsAgentImpl::attach(const WebString& hostId, int sessionId) 483 void WebDevToolsAgentImpl::attach(const WebString& hostId, int sessionId)
486 { 484 {
487 if (attached()) 485 if (attached())
488 return; 486 return;
489 initializeSession(sessionId, hostId); 487 initializeSession(sessionId, hostId);
490 m_session->attach(m_v8Session.get(), nullptr); 488 m_session->attach(m_v8Session.get(), nullptr);
491 } 489 }
492 490
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 if (!protocol::Dispatcher::getCommandName(message, &commandName)) 685 if (!protocol::Dispatcher::getCommandName(message, &commandName))
688 return false; 686 return false;
689 return commandName == "Debugger.pause" 687 return commandName == "Debugger.pause"
690 || commandName == "Debugger.setBreakpoint" 688 || commandName == "Debugger.setBreakpoint"
691 || commandName == "Debugger.setBreakpointByUrl" 689 || commandName == "Debugger.setBreakpointByUrl"
692 || commandName == "Debugger.removeBreakpoint" 690 || commandName == "Debugger.removeBreakpoint"
693 || commandName == "Debugger.setBreakpointsActive"; 691 || commandName == "Debugger.setBreakpointsActive";
694 } 692 }
695 693
696 } // namespace blink 694 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebDevToolsAgentImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698