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

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

Issue 1907663005: [DevTools] Move v8-related instrumentation from agents to InspectorSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1889533002
Patch Set: profiler agent restore starts instrumenting 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/platform/v8_inspector/public/V8InspectorSessionClient.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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, sessionId, false /* autoFlush */); 380 m_session = new InspectorSession(this, m_inspectedFrames.get(), sessionId, f alse /* 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 481
482 Platform::current()->currentThread()->removeTaskObserver(this); 482 Platform::current()->currentThread()->removeTaskObserver(this);
483 InspectorInstrumentation::unregisterInstrumentingSessions(m_instrumentingSes sions.get()); 483 InspectorInstrumentation::unregisterInstrumentingSessions(m_instrumentingSes sions.get());
484 } 484 }
485 485
486 void WebDevToolsAgentImpl::attach(const WebString& hostId, int sessionId) 486 void WebDevToolsAgentImpl::attach(const WebString& hostId, int sessionId)
487 { 487 {
488 if (attached()) 488 if (attached())
489 return; 489 return;
490 initializeSession(sessionId, hostId); 490 initializeSession(sessionId, hostId);
491 m_session->attach(nullptr); 491 m_session->attach(m_v8Session.get(), nullptr);
492 } 492 }
493 493
494 void WebDevToolsAgentImpl::reattach(const WebString& hostId, int sessionId, cons t WebString& savedState) 494 void WebDevToolsAgentImpl::reattach(const WebString& hostId, int sessionId, cons t WebString& savedState)
495 { 495 {
496 if (attached()) 496 if (attached())
497 return; 497 return;
498 initializeSession(sessionId, hostId); 498 initializeSession(sessionId, hostId);
499 String state = savedState; 499 String state = savedState;
500 m_session->attach(&state); 500 m_session->attach(m_v8Session.get(), &state);
501 } 501 }
502 502
503 void WebDevToolsAgentImpl::detach() 503 void WebDevToolsAgentImpl::detach()
504 { 504 {
505 if (!attached()) 505 if (!attached())
506 return; 506 return;
507 destroySession(); 507 destroySession();
508 } 508 }
509 509
510 void WebDevToolsAgentImpl::continueProgram() 510 void WebDevToolsAgentImpl::continueProgram()
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 void WebDevToolsAgentImpl::flushPendingProtocolNotifications() 647 void WebDevToolsAgentImpl::flushPendingProtocolNotifications()
648 { 648 {
649 if (m_session) 649 if (m_session)
650 m_session->flushPendingProtocolNotifications(); 650 m_session->flushPendingProtocolNotifications();
651 } 651 }
652 652
653 void WebDevToolsAgentImpl::willProcessTask() 653 void WebDevToolsAgentImpl::willProcessTask()
654 { 654 {
655 if (!attached()) 655 if (!attached())
656 return; 656 return;
657 for (InspectorSession* session : *m_instrumentingSessions) { 657 InspectorInstrumentation::willProcessTask(m_inspectedFrames->root());
658 if (InspectorProfilerAgent* profilerAgent = session->instrumentingAgents ()->inspectorProfilerAgent())
659 profilerAgent->willProcessTask();
660 }
661 } 658 }
662 659
663 void WebDevToolsAgentImpl::didProcessTask() 660 void WebDevToolsAgentImpl::didProcessTask()
664 { 661 {
665 if (!attached()) 662 if (!attached())
666 return; 663 return;
667 for (InspectorSession* session : *m_instrumentingSessions) { 664 InspectorInstrumentation::didProcessTask(m_inspectedFrames->root());
668 if (InspectorProfilerAgent* profilerAgent = session->instrumentingAgents ()->inspectorProfilerAgent())
669 profilerAgent->didProcessTask();
670 }
671 flushPendingProtocolNotifications(); 665 flushPendingProtocolNotifications();
672 } 666 }
673 667
674 void WebDevToolsAgentImpl::runDebuggerTask(int sessionId, PassOwnPtr<WebDevTools Agent::MessageDescriptor> descriptor) 668 void WebDevToolsAgentImpl::runDebuggerTask(int sessionId, PassOwnPtr<WebDevTools Agent::MessageDescriptor> descriptor)
675 { 669 {
676 WebDevToolsAgent* webagent = descriptor->agent(); 670 WebDevToolsAgent* webagent = descriptor->agent();
677 if (!webagent) 671 if (!webagent)
678 return; 672 return;
679 673
680 WebDevToolsAgentImpl* agentImpl = static_cast<WebDevToolsAgentImpl*>(webagen t); 674 WebDevToolsAgentImpl* agentImpl = static_cast<WebDevToolsAgentImpl*>(webagen t);
(...skipping 13 matching lines...) Expand all
694 if (!protocol::Dispatcher::getCommandName(message, &commandName)) 688 if (!protocol::Dispatcher::getCommandName(message, &commandName))
695 return false; 689 return false;
696 return commandName == "Debugger.pause" 690 return commandName == "Debugger.pause"
697 || commandName == "Debugger.setBreakpoint" 691 || commandName == "Debugger.setBreakpoint"
698 || commandName == "Debugger.setBreakpointByUrl" 692 || commandName == "Debugger.setBreakpointByUrl"
699 || commandName == "Debugger.removeBreakpoint" 693 || commandName == "Debugger.removeBreakpoint"
700 || commandName == "Debugger.setBreakpointsActive"; 694 || commandName == "Debugger.setBreakpointsActive";
701 } 695 }
702 696
703 } // namespace blink 697 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/v8_inspector/public/V8InspectorSessionClient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698