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

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

Issue 593123003: DevTools: make console.timeline/timelineEnd work for tracing based Timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments Created 6 years, 3 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
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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 21 matching lines...) Expand all
32 #include "core/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/frame/UseCounter.h" 33 #include "core/frame/UseCounter.h"
34 #include "core/inspector/ConsoleMessage.h" 34 #include "core/inspector/ConsoleMessage.h"
35 #include "core/inspector/ConsoleMessageStorage.h" 35 #include "core/inspector/ConsoleMessageStorage.h"
36 #include "core/inspector/IdentifiersFactory.h" 36 #include "core/inspector/IdentifiersFactory.h"
37 #include "core/inspector/InjectedScript.h" 37 #include "core/inspector/InjectedScript.h"
38 #include "core/inspector/InjectedScriptHost.h" 38 #include "core/inspector/InjectedScriptHost.h"
39 #include "core/inspector/InjectedScriptManager.h" 39 #include "core/inspector/InjectedScriptManager.h"
40 #include "core/inspector/InspectorState.h" 40 #include "core/inspector/InspectorState.h"
41 #include "core/inspector/InspectorTimelineAgent.h" 41 #include "core/inspector/InspectorTimelineAgent.h"
42 #include "core/inspector/InspectorTracingAgent.h"
43 #include "core/inspector/InstrumentingAgents.h" 42 #include "core/inspector/InstrumentingAgents.h"
44 #include "core/inspector/ScriptArguments.h" 43 #include "core/inspector/ScriptArguments.h"
45 #include "core/inspector/ScriptAsyncCallStack.h" 44 #include "core/inspector/ScriptAsyncCallStack.h"
46 #include "core/inspector/ScriptCallFrame.h" 45 #include "core/inspector/ScriptCallFrame.h"
47 #include "core/inspector/ScriptCallStack.h" 46 #include "core/inspector/ScriptCallStack.h"
48 #include "core/loader/DocumentLoader.h" 47 #include "core/loader/DocumentLoader.h"
49 #include "core/page/Page.h" 48 #include "core/page/Page.h"
50 #include "core/xml/XMLHttpRequest.h" 49 #include "core/xml/XMLHttpRequest.h"
51 #include "platform/network/ResourceError.h" 50 #include "platform/network/ResourceError.h"
52 #include "platform/network/ResourceResponse.h" 51 #include "platform/network/ResourceResponse.h"
53 #include "wtf/CurrentTime.h" 52 #include "wtf/CurrentTime.h"
54 #include "wtf/OwnPtr.h" 53 #include "wtf/OwnPtr.h"
55 #include "wtf/PassOwnPtr.h" 54 #include "wtf/PassOwnPtr.h"
56 #include "wtf/text/StringBuilder.h" 55 #include "wtf/text/StringBuilder.h"
57 #include "wtf/text/WTFString.h" 56 #include "wtf/text/WTFString.h"
58 57
59 namespace blink { 58 namespace blink {
60 59
61 namespace ConsoleAgentState { 60 namespace ConsoleAgentState {
62 static const char monitoringXHR[] = "monitoringXHR"; 61 static const char monitoringXHR[] = "monitoringXHR";
63 static const char consoleMessagesEnabled[] = "consoleMessagesEnabled"; 62 static const char consoleMessagesEnabled[] = "consoleMessagesEnabled";
64 static const char tracingBasedTimeline[] = "tracingBasedTimeline"; 63 static const char tracingBasedTimeline[] = "tracingBasedTimeline";
65 } 64 }
66 65
67 int InspectorConsoleAgent::s_enabledAgentCount = 0; 66 int InspectorConsoleAgent::s_enabledAgentCount = 0;
68 67
69 InspectorConsoleAgent::InspectorConsoleAgent(InspectorTimelineAgent* timelineAge nt, InspectorTracingAgent* tracingAgent, InjectedScriptManager* injectedScriptMa nager) 68 InspectorConsoleAgent::InspectorConsoleAgent(InspectorTimelineAgent* timelineAge nt, InjectedScriptManager* injectedScriptManager)
70 : InspectorBaseAgent<InspectorConsoleAgent>("Console") 69 : InspectorBaseAgent<InspectorConsoleAgent>("Console")
71 , m_timelineAgent(timelineAgent) 70 , m_timelineAgent(timelineAgent)
72 , m_tracingAgent(tracingAgent)
73 , m_injectedScriptManager(injectedScriptManager) 71 , m_injectedScriptManager(injectedScriptManager)
74 , m_frontend(0) 72 , m_frontend(0)
75 , m_enabled(false) 73 , m_enabled(false)
76 { 74 {
77 } 75 }
78 76
79 InspectorConsoleAgent::~InspectorConsoleAgent() 77 InspectorConsoleAgent::~InspectorConsoleAgent()
80 { 78 {
81 #if !ENABLE(OILPAN) 79 #if !ENABLE(OILPAN)
82 m_instrumentingAgents->setInspectorConsoleAgent(0); 80 m_instrumentingAgents->setInspectorConsoleAgent(0);
83 #endif 81 #endif
84 } 82 }
85 83
86 void InspectorConsoleAgent::trace(Visitor* visitor) 84 void InspectorConsoleAgent::trace(Visitor* visitor)
87 { 85 {
88 visitor->trace(m_timelineAgent); 86 visitor->trace(m_timelineAgent);
89 visitor->trace(m_tracingAgent);
90 visitor->trace(m_injectedScriptManager); 87 visitor->trace(m_injectedScriptManager);
91 InspectorBaseAgent::trace(visitor); 88 InspectorBaseAgent::trace(visitor);
92 } 89 }
93 90
94 void InspectorConsoleAgent::init() 91 void InspectorConsoleAgent::init()
95 { 92 {
96 m_instrumentingAgents->setInspectorConsoleAgent(this); 93 m_instrumentingAgents->setInspectorConsoleAgent(this);
97 } 94 }
98 95
99 void InspectorConsoleAgent::enable(ErrorString*) 96 void InspectorConsoleAgent::enable(ErrorString*)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 167 }
171 168
172 void InspectorConsoleAgent::setTracingBasedTimeline(ErrorString*, bool enabled) 169 void InspectorConsoleAgent::setTracingBasedTimeline(ErrorString*, bool enabled)
173 { 170 {
174 m_state->setBoolean(ConsoleAgentState::tracingBasedTimeline, enabled); 171 m_state->setBoolean(ConsoleAgentState::tracingBasedTimeline, enabled);
175 } 172 }
176 173
177 void InspectorConsoleAgent::consoleTimeline(ExecutionContext* context, const Str ing& title, ScriptState* scriptState) 174 void InspectorConsoleAgent::consoleTimeline(ExecutionContext* context, const Str ing& title, ScriptState* scriptState)
178 { 175 {
179 UseCounter::count(context, UseCounter::DevToolsConsoleTimeline); 176 UseCounter::count(context, UseCounter::DevToolsConsoleTimeline);
180 if (m_tracingAgent && m_state->getBoolean(ConsoleAgentState::tracingBasedTim eline)) 177 if (!m_state->getBoolean(ConsoleAgentState::tracingBasedTimeline))
181 m_tracingAgent->consoleTimeline(title);
182 else
183 m_timelineAgent->consoleTimeline(context, title, scriptState); 178 m_timelineAgent->consoleTimeline(context, title, scriptState);
184 } 179 }
185 180
186 void InspectorConsoleAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState) 181 void InspectorConsoleAgent::consoleTimelineEnd(ExecutionContext* context, const String& title, ScriptState* scriptState)
187 { 182 {
188 if (m_state->getBoolean(ConsoleAgentState::tracingBasedTimeline)) 183 if (!m_state->getBoolean(ConsoleAgentState::tracingBasedTimeline))
189 m_tracingAgent->consoleTimelineEnd(title);
190 else
191 m_timelineAgent->consoleTimelineEnd(context, title, scriptState); 184 m_timelineAgent->consoleTimelineEnd(context, title, scriptState);
192 } 185 }
193 186
194 void InspectorConsoleAgent::frameWindowDiscarded(LocalDOMWindow* window) 187 void InspectorConsoleAgent::frameWindowDiscarded(LocalDOMWindow* window)
195 { 188 {
196 m_injectedScriptManager->discardInjectedScriptsFor(window); 189 m_injectedScriptManager->discardInjectedScriptsFor(window);
197 } 190 }
198 191
199 void InspectorConsoleAgent::didFinishXHRLoading(XMLHttpRequest*, ThreadableLoade rClient*, unsigned long requestIdentifier, ScriptString, const AtomicString& met hod, const String& url, const String& sendURL, unsigned sendLineNumber) 192 void InspectorConsoleAgent::didFinishXHRLoading(XMLHttpRequest*, ThreadableLoade rClient*, unsigned long requestIdentifier, ScriptString, const AtomicString& met hod, const String& url, const String& sendURL, unsigned sendLineNumber)
200 { 193 {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 private: 338 private:
346 int m_heapObjectId; 339 int m_heapObjectId;
347 }; 340 };
348 341
349 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe apObjectId) 342 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe apObjectId)
350 { 343 {
351 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n ew InspectableHeapObject(inspectedHeapObjectId))); 344 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n ew InspectableHeapObject(inspectedHeapObjectId)));
352 } 345 }
353 346
354 } // namespace blink 347 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorConsoleAgent.h ('k') | Source/core/inspector/InspectorController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698