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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 if (m_enabled) | 101 if (m_enabled) |
102 return; | 102 return; |
103 m_enabled = true; | 103 m_enabled = true; |
104 if (!s_enabledAgentCount) | 104 if (!s_enabledAgentCount) |
105 ScriptController::setCaptureCallStackForUncaughtExceptions(true); | 105 ScriptController::setCaptureCallStackForUncaughtExceptions(true); |
106 ++s_enabledAgentCount; | 106 ++s_enabledAgentCount; |
107 | 107 |
108 m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, true); | 108 m_state->setBoolean(ConsoleAgentState::consoleMessagesEnabled, true); |
109 | 109 |
110 if (m_expiredConsoleMessageCount) { | 110 if (m_expiredConsoleMessageCount) { |
111 InspectorConsoleMessage expiredMessage(!isWorkerAgent(), OtherMessageSou
rce, LogMessageType, WarningMessageLevel, String::format("%d console messages ar
e not shown.", m_expiredConsoleMessageCount)); | 111 InspectorConsoleMessage expiredMessage(OtherMessageSource, LogMessageTyp
e, WarningMessageLevel, String::format("%d console messages are not shown.", m_e
xpiredConsoleMessageCount)); |
112 expiredMessage.setTimestamp(0); | 112 expiredMessage.setTimestamp(0); |
113 expiredMessage.addToFrontend(m_frontend, m_injectedScriptManager, false)
; | 113 expiredMessage.addToFrontend(m_frontend, m_injectedScriptManager, false)
; |
114 } | 114 } |
115 | 115 |
116 size_t messageCount = m_consoleMessages.size(); | 116 size_t messageCount = m_consoleMessages.size(); |
117 for (size_t i = 0; i < messageCount; ++i) | 117 for (size_t i = 0; i < messageCount; ++i) |
118 m_consoleMessages[i]->addToFrontend(m_frontend, m_injectedScriptManager,
false); | 118 m_consoleMessages[i]->addToFrontend(m_frontend, m_injectedScriptManager,
false); |
119 } | 119 } |
120 | 120 |
121 void InspectorConsoleAgent::disable(ErrorString*) | 121 void InspectorConsoleAgent::disable(ErrorString*) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 m_frontend = 0; | 165 m_frontend = 0; |
166 String errorString; | 166 String errorString; |
167 disable(&errorString); | 167 disable(&errorString); |
168 } | 168 } |
169 | 169 |
170 void InspectorConsoleAgent::addMessageToConsole(ConsoleMessage* consoleMessage) | 170 void InspectorConsoleAgent::addMessageToConsole(ConsoleMessage* consoleMessage) |
171 { | 171 { |
172 if (consoleMessage->callStack()) { | 172 if (consoleMessage->callStack()) { |
173 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(consoleMessage->s
ource(), LogMessageType, consoleMessage->level(), consoleMessage->message(), con
soleMessage->callStack(), consoleMessage->requestIdentifier()))); | 173 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(consoleMessage->s
ource(), LogMessageType, consoleMessage->level(), consoleMessage->message(), con
soleMessage->callStack(), consoleMessage->requestIdentifier()))); |
174 } else { | 174 } else { |
175 bool canGenerateCallStack = !isWorkerAgent() && m_frontend; | 175 bool shouldGenerateCallStack = m_frontend; |
176 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(canGenerateCallSt
ack, consoleMessage->source(), LogMessageType, consoleMessage->level(), consoleM
essage->message(), consoleMessage->url(), consoleMessage->lineNumber(), consoleM
essage->columnNumber(), consoleMessage->scriptState(), consoleMessage->requestId
entifier()))); | 176 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(shouldGenerateCal
lStack, consoleMessage->source(), LogMessageType, consoleMessage->level(), conso
leMessage->message(), consoleMessage->url(), consoleMessage->lineNumber(), conso
leMessage->columnNumber(), consoleMessage->scriptState(), consoleMessage->reques
tIdentifier()))); |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 void InspectorConsoleAgent::addConsoleAPIMessageToConsole(MessageType type, Mess
ageLevel level, const String& message, ScriptState* scriptState, PassRefPtrWillB
eRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier) | 180 void InspectorConsoleAgent::addConsoleAPIMessageToConsole(MessageType type, Mess
ageLevel level, const String& message, ScriptState* scriptState, PassRefPtrWillB
eRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier) |
181 { | 181 { |
182 if (type == ClearMessageType) { | 182 if (type == ClearMessageType) { |
183 ErrorString error; | 183 ErrorString error; |
184 clearMessages(&error); | 184 clearMessages(&error); |
185 } | 185 } |
186 | 186 |
187 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(!isWorkerAgent(), Con
soleAPIMessageSource, type, level, message, arguments, scriptState, requestIdent
ifier))); | 187 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(ConsoleAPIMessageSour
ce, type, level, message, arguments, scriptState, requestIdentifier))); |
188 } | 188 } |
189 | 189 |
190 Vector<unsigned> InspectorConsoleAgent::consoleMessageArgumentCounts() | 190 Vector<unsigned> InspectorConsoleAgent::consoleMessageArgumentCounts() |
191 { | 191 { |
192 Vector<unsigned> result(m_consoleMessages.size()); | 192 Vector<unsigned> result(m_consoleMessages.size()); |
193 for (size_t i = 0; i < m_consoleMessages.size(); i++) | 193 for (size_t i = 0; i < m_consoleMessages.size(); i++) |
194 result[i] = m_consoleMessages[i]->argumentCount(); | 194 result[i] = m_consoleMessages[i]->argumentCount(); |
195 return result; | 195 return result; |
196 } | 196 } |
197 | 197 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 private: | 344 private: |
345 int m_heapObjectId; | 345 int m_heapObjectId; |
346 }; | 346 }; |
347 | 347 |
348 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe
apObjectId) | 348 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe
apObjectId) |
349 { | 349 { |
350 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableHeapObject(inspectedHeapObjectId))); | 350 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableHeapObject(inspectedHeapObjectId))); |
351 } | 351 } |
352 | 352 |
353 } // namespace blink | 353 } // namespace blink |
OLD | NEW |