| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 #include "bindings/core/v8/ScriptProfiler.h" | 30 #include "bindings/core/v8/ScriptProfiler.h" |
| 31 #include "core/frame/LocalFrame.h" | 31 #include "core/frame/LocalFrame.h" |
| 32 #include "core/frame/UseCounter.h" | 32 #include "core/frame/UseCounter.h" |
| 33 #include "core/inspector/ConsoleMessage.h" | 33 #include "core/inspector/ConsoleMessage.h" |
| 34 #include "core/inspector/ConsoleMessageStorage.h" | 34 #include "core/inspector/ConsoleMessageStorage.h" |
| 35 #include "core/inspector/IdentifiersFactory.h" | 35 #include "core/inspector/IdentifiersFactory.h" |
| 36 #include "core/inspector/InjectedScript.h" | 36 #include "core/inspector/InjectedScript.h" |
| 37 #include "core/inspector/InjectedScriptHost.h" | 37 #include "core/inspector/InjectedScriptHost.h" |
| 38 #include "core/inspector/InjectedScriptManager.h" | 38 #include "core/inspector/InjectedScriptManager.h" |
| 39 #include "core/inspector/InspectorState.h" | 39 #include "core/inspector/InspectorState.h" |
| 40 #include "core/inspector/InspectorTimelineAgent.h" | |
| 41 #include "core/inspector/InstrumentingAgents.h" | 40 #include "core/inspector/InstrumentingAgents.h" |
| 42 #include "core/inspector/ScriptArguments.h" | 41 #include "core/inspector/ScriptArguments.h" |
| 43 #include "core/inspector/ScriptAsyncCallStack.h" | 42 #include "core/inspector/ScriptAsyncCallStack.h" |
| 44 #include "core/inspector/ScriptCallFrame.h" | 43 #include "core/inspector/ScriptCallFrame.h" |
| 45 #include "core/inspector/ScriptCallStack.h" | 44 #include "core/inspector/ScriptCallStack.h" |
| 46 #include "core/loader/DocumentLoader.h" | 45 #include "core/loader/DocumentLoader.h" |
| 47 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
| 48 #include "core/xmlhttprequest/XMLHttpRequest.h" | 47 #include "core/xmlhttprequest/XMLHttpRequest.h" |
| 49 #include "platform/network/ResourceError.h" | 48 #include "platform/network/ResourceError.h" |
| 50 #include "platform/network/ResourceResponse.h" | 49 #include "platform/network/ResourceResponse.h" |
| 51 #include "wtf/CurrentTime.h" | 50 #include "wtf/CurrentTime.h" |
| 52 #include "wtf/OwnPtr.h" | 51 #include "wtf/OwnPtr.h" |
| 53 #include "wtf/PassOwnPtr.h" | 52 #include "wtf/PassOwnPtr.h" |
| 54 #include "wtf/text/StringBuilder.h" | 53 #include "wtf/text/StringBuilder.h" |
| 55 #include "wtf/text/WTFString.h" | 54 #include "wtf/text/WTFString.h" |
| 56 | 55 |
| 57 namespace blink { | 56 namespace blink { |
| 58 | 57 |
| 59 namespace ConsoleAgentState { | 58 namespace ConsoleAgentState { |
| 60 static const char monitoringXHR[] = "monitoringXHR"; | 59 static const char monitoringXHR[] = "monitoringXHR"; |
| 61 static const char consoleMessagesEnabled[] = "consoleMessagesEnabled"; | 60 static const char consoleMessagesEnabled[] = "consoleMessagesEnabled"; |
| 62 static const char tracingBasedTimeline[] = "tracingBasedTimeline"; | |
| 63 } | 61 } |
| 64 | 62 |
| 65 InspectorConsoleAgent::InspectorConsoleAgent(InspectorTimelineAgent* timelineAge
nt, InjectedScriptManager* injectedScriptManager) | 63 InspectorConsoleAgent::InspectorConsoleAgent(InjectedScriptManager* injectedScri
ptManager) |
| 66 : InspectorBaseAgent<InspectorConsoleAgent>("Console") | 64 : InspectorBaseAgent<InspectorConsoleAgent>("Console") |
| 67 , m_timelineAgent(timelineAgent) | |
| 68 , m_injectedScriptManager(injectedScriptManager) | 65 , m_injectedScriptManager(injectedScriptManager) |
| 69 , m_frontend(0) | 66 , m_frontend(0) |
| 70 , m_enabled(false) | 67 , m_enabled(false) |
| 71 { | 68 { |
| 72 } | 69 } |
| 73 | 70 |
| 74 InspectorConsoleAgent::~InspectorConsoleAgent() | 71 InspectorConsoleAgent::~InspectorConsoleAgent() |
| 75 { | 72 { |
| 76 #if !ENABLE(OILPAN) | 73 #if !ENABLE(OILPAN) |
| 77 m_instrumentingAgents->setInspectorConsoleAgent(0); | 74 m_instrumentingAgents->setInspectorConsoleAgent(0); |
| 78 #endif | 75 #endif |
| 79 } | 76 } |
| 80 | 77 |
| 81 void InspectorConsoleAgent::trace(Visitor* visitor) | 78 void InspectorConsoleAgent::trace(Visitor* visitor) |
| 82 { | 79 { |
| 83 visitor->trace(m_timelineAgent); | |
| 84 visitor->trace(m_injectedScriptManager); | 80 visitor->trace(m_injectedScriptManager); |
| 85 InspectorBaseAgent::trace(visitor); | 81 InspectorBaseAgent::trace(visitor); |
| 86 } | 82 } |
| 87 | 83 |
| 88 void InspectorConsoleAgent::enable(ErrorString*) | 84 void InspectorConsoleAgent::enable(ErrorString*) |
| 89 { | 85 { |
| 90 if (m_enabled) | 86 if (m_enabled) |
| 91 return; | 87 return; |
| 92 m_instrumentingAgents->setInspectorConsoleAgent(this); | 88 m_instrumentingAgents->setInspectorConsoleAgent(this); |
| 93 m_enabled = true; | 89 m_enabled = true; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 109 | 105 |
| 110 void InspectorConsoleAgent::disable(ErrorString*) | 106 void InspectorConsoleAgent::disable(ErrorString*) |
| 111 { | 107 { |
| 112 if (!m_enabled) | 108 if (!m_enabled) |
| 113 return; | 109 return; |
| 114 m_instrumentingAgents->setInspectorConsoleAgent(0); | 110 m_instrumentingAgents->setInspectorConsoleAgent(0); |
| 115 m_enabled = false; | 111 m_enabled = false; |
| 116 disableStackCapturingIfNeeded(); | 112 disableStackCapturingIfNeeded(); |
| 117 | 113 |
| 118 m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false); | 114 m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, false); |
| 119 m_state->setBoolean(ConsoleAgentState::tracingBasedTimeline, false); | |
| 120 } | 115 } |
| 121 | 116 |
| 122 void InspectorConsoleAgent::clearMessages(ErrorString*) | 117 void InspectorConsoleAgent::clearMessages(ErrorString*) |
| 123 { | 118 { |
| 124 messageStorage()->clear(); | 119 messageStorage()->clear(); |
| 125 } | 120 } |
| 126 | 121 |
| 127 void InspectorConsoleAgent::restore() | 122 void InspectorConsoleAgent::restore() |
| 128 { | 123 { |
| 129 if (m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled)) { | 124 if (m_state->getBoolean(ConsoleAgentState::consoleMessagesEnabled)) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 151 sendConsoleMessageToFrontend(consoleMessage, true); | 146 sendConsoleMessageToFrontend(consoleMessage, true); |
| 152 } | 147 } |
| 153 | 148 |
| 154 void InspectorConsoleAgent::consoleMessagesCleared() | 149 void InspectorConsoleAgent::consoleMessagesCleared() |
| 155 { | 150 { |
| 156 m_injectedScriptManager->releaseObjectGroup("console"); | 151 m_injectedScriptManager->releaseObjectGroup("console"); |
| 157 if (m_frontend) | 152 if (m_frontend) |
| 158 m_frontend->messagesCleared(); | 153 m_frontend->messagesCleared(); |
| 159 } | 154 } |
| 160 | 155 |
| 161 void InspectorConsoleAgent::setTracingBasedTimeline(ErrorString*, bool enabled) | |
| 162 { | |
| 163 m_state->setBoolean(ConsoleAgentState::tracingBasedTimeline, enabled); | |
| 164 } | |
| 165 | |
| 166 void InspectorConsoleAgent::consoleTimeline(ExecutionContext* context, const Str
ing& title, ScriptState* scriptState) | |
| 167 { | |
| 168 UseCounter::count(context, UseCounter::DevToolsConsoleTimeline); | |
| 169 if (!m_state->getBoolean(ConsoleAgentState::tracingBasedTimeline)) | |
| 170 m_timelineAgent->consoleTimeline(context, title, scriptState); | |
| 171 } | |
| 172 | |
| 173 void InspectorConsoleAgent::consoleTimelineEnd(ExecutionContext* context, const
String& title, ScriptState* scriptState) | |
| 174 { | |
| 175 if (!m_state->getBoolean(ConsoleAgentState::tracingBasedTimeline)) | |
| 176 m_timelineAgent->consoleTimelineEnd(context, title, scriptState); | |
| 177 } | |
| 178 | |
| 179 void InspectorConsoleAgent::didFinishXHRLoading(XMLHttpRequest*, ThreadableLoade
rClient*, unsigned long requestIdentifier, ScriptString, const AtomicString& met
hod, const String& url) | 156 void InspectorConsoleAgent::didFinishXHRLoading(XMLHttpRequest*, ThreadableLoade
rClient*, unsigned long requestIdentifier, ScriptString, const AtomicString& met
hod, const String& url) |
| 180 { | 157 { |
| 181 if (m_frontend && m_state->getBoolean(ConsoleAgentState::monitoringXHR)) { | 158 if (m_frontend && m_state->getBoolean(ConsoleAgentState::monitoringXHR)) { |
| 182 String message = "XHR finished loading: " + method + " \"" + url + "\"."
; | 159 String message = "XHR finished loading: " + method + " \"" + url + "\"."
; |
| 183 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea
te(NetworkMessageSource, DebugMessageLevel, message); | 160 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea
te(NetworkMessageSource, DebugMessageLevel, message); |
| 184 consoleMessage->setRequestIdentifier(requestIdentifier); | 161 consoleMessage->setRequestIdentifier(requestIdentifier); |
| 185 messageStorage()->reportMessage(consoleMessage.release()); | 162 messageStorage()->reportMessage(consoleMessage.release()); |
| 186 } | 163 } |
| 187 } | 164 } |
| 188 | 165 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 { | 297 { |
| 321 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(objectId); | 298 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(objectId); |
| 322 if (injectedScript.isEmpty()) { | 299 if (injectedScript.isEmpty()) { |
| 323 *errorString = "Inspected frame has gone"; | 300 *errorString = "Inspected frame has gone"; |
| 324 return; | 301 return; |
| 325 } | 302 } |
| 326 injectedScript.setLastEvaluationResult(objectId); | 303 injectedScript.setLastEvaluationResult(objectId); |
| 327 } | 304 } |
| 328 | 305 |
| 329 } // namespace blink | 306 } // namespace blink |
| OLD | NEW |