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

Side by Side Diff: Source/core/inspector/PageConsoleAgent.cpp

Issue 1092123004: DevTools: remove dependency of most agents on InspectorPageAgent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed debug build Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/PageConsoleAgent.h ('k') | Source/core/inspector/PageDebuggerAgent.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "core/inspector/PageConsoleAgent.h" 32 #include "core/inspector/PageConsoleAgent.h"
33 33
34 #include "bindings/core/v8/ScriptController.h" 34 #include "bindings/core/v8/ScriptController.h"
35 #include "core/dom/Document.h" 35 #include "core/dom/Document.h"
36 #include "core/frame/FrameConsole.h" 36 #include "core/frame/FrameConsole.h"
37 #include "core/frame/FrameHost.h" 37 #include "core/frame/FrameHost.h"
38 #include "core/inspector/ConsoleMessage.h" 38 #include "core/inspector/ConsoleMessage.h"
39 #include "core/inspector/ConsoleMessageStorage.h" 39 #include "core/inspector/ConsoleMessageStorage.h"
40 #include "core/inspector/InspectorDOMAgent.h" 40 #include "core/inspector/InspectorDOMAgent.h"
41 #include "core/inspector/InspectorPageAgent.h"
42 #include "core/workers/WorkerInspectorProxy.h" 41 #include "core/workers/WorkerInspectorProxy.h"
43 42
44 namespace blink { 43 namespace blink {
45 44
46 int PageConsoleAgent::s_enabledAgentCount = 0; 45 int PageConsoleAgent::s_enabledAgentCount = 0;
47 46
48 PageConsoleAgent::PageConsoleAgent(InjectedScriptManager* injectedScriptManager, InspectorDOMAgent* domAgent, InspectorPageAgent* pageAgent) 47 PageConsoleAgent::PageConsoleAgent(LocalFrame* inspectedFrame, InjectedScriptMan ager* injectedScriptManager, InspectorDOMAgent* domAgent)
49 : InspectorConsoleAgent(injectedScriptManager) 48 : InspectorConsoleAgent(injectedScriptManager)
49 , m_inspectedFrame(inspectedFrame)
50 , m_inspectorDOMAgent(domAgent) 50 , m_inspectorDOMAgent(domAgent)
51 , m_pageAgent(pageAgent)
52 { 51 {
53 } 52 }
54 53
55 PageConsoleAgent::~PageConsoleAgent() 54 PageConsoleAgent::~PageConsoleAgent()
56 { 55 {
57 #if !ENABLE(OILPAN) 56 #if !ENABLE(OILPAN)
58 m_inspectorDOMAgent = nullptr; 57 m_inspectorDOMAgent = nullptr;
59 m_instrumentingAgents->setPageConsoleAgent(nullptr); 58 m_instrumentingAgents->setPageConsoleAgent(nullptr);
60 #endif 59 #endif
61 } 60 }
62 61
63 DEFINE_TRACE(PageConsoleAgent) 62 DEFINE_TRACE(PageConsoleAgent)
64 { 63 {
64 visitor->trace(m_inspectedFrame);
65 visitor->trace(m_inspectorDOMAgent); 65 visitor->trace(m_inspectorDOMAgent);
66 visitor->trace(m_pageAgent);
67 InspectorConsoleAgent::trace(visitor); 66 InspectorConsoleAgent::trace(visitor);
68 } 67 }
69 68
70 void PageConsoleAgent::enable(ErrorString* errorString) 69 void PageConsoleAgent::enable(ErrorString* errorString)
71 { 70 {
72 InspectorConsoleAgent::enable(errorString); 71 InspectorConsoleAgent::enable(errorString);
73 m_workersWithEnabledConsole.clear(); 72 m_workersWithEnabledConsole.clear();
74 m_instrumentingAgents->setPageConsoleAgent(this); 73 m_instrumentingAgents->setPageConsoleAgent(this);
75 } 74 }
76 75
77 void PageConsoleAgent::disable(ErrorString* errorString) 76 void PageConsoleAgent::disable(ErrorString* errorString)
78 { 77 {
79 m_instrumentingAgents->setPageConsoleAgent(nullptr); 78 m_instrumentingAgents->setPageConsoleAgent(nullptr);
80 InspectorConsoleAgent::disable(errorString); 79 InspectorConsoleAgent::disable(errorString);
81 } 80 }
82 81
83 void PageConsoleAgent::clearMessages(ErrorString* errorString) 82 void PageConsoleAgent::clearMessages(ErrorString* errorString)
84 { 83 {
85 m_inspectorDOMAgent->releaseDanglingNodes(); 84 m_inspectorDOMAgent->releaseDanglingNodes();
86 messageStorage()->clear(m_pageAgent->inspectedFrame()->document()); 85 messageStorage()->clear(m_inspectedFrame->document());
87 } 86 }
88 87
89 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy) 88 void PageConsoleAgent::workerConsoleAgentEnabled(WorkerGlobalScopeProxy* proxy)
90 { 89 {
91 m_workersWithEnabledConsole.add(proxy); 90 m_workersWithEnabledConsole.add(proxy);
92 } 91 }
93 92
94 ConsoleMessageStorage* PageConsoleAgent::messageStorage() 93 ConsoleMessageStorage* PageConsoleAgent::messageStorage()
95 { 94 {
96 return &m_pageAgent->frameHost()->consoleMessageStorage(); 95 return &m_inspectedFrame->host()->consoleMessageStorage();
97 } 96 }
98 97
99 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro xy) 98 void PageConsoleAgent::workerTerminated(WorkerInspectorProxy* workerInspectorPro xy)
100 { 99 {
101 WorkerGlobalScopeProxy* proxy = workerInspectorProxy->workerGlobalScopeProxy (); 100 WorkerGlobalScopeProxy* proxy = workerInspectorProxy->workerGlobalScopeProxy ();
102 if (!proxy) 101 if (!proxy)
103 return; 102 return;
104 103
105 HashSet<WorkerGlobalScopeProxy*>::iterator iterator = m_workersWithEnabledCo nsole.find(proxy); 104 HashSet<WorkerGlobalScopeProxy*>::iterator iterator = m_workersWithEnabledCo nsole.find(proxy);
106 bool workerAgentWasEnabled = iterator != m_workersWithEnabledConsole.end(); 105 bool workerAgentWasEnabled = iterator != m_workersWithEnabledConsole.end();
(...skipping 18 matching lines...) Expand all
125 ++s_enabledAgentCount; 124 ++s_enabledAgentCount;
126 } 125 }
127 126
128 void PageConsoleAgent::disableStackCapturingIfNeeded() 127 void PageConsoleAgent::disableStackCapturingIfNeeded()
129 { 128 {
130 if (!(--s_enabledAgentCount)) 129 if (!(--s_enabledAgentCount))
131 ScriptController::setCaptureCallStackForUncaughtExceptions(false); 130 ScriptController::setCaptureCallStackForUncaughtExceptions(false);
132 } 131 }
133 132
134 } // namespace blink 133 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/PageConsoleAgent.h ('k') | Source/core/inspector/PageDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698