| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 | 156 |
| 157 static TypeBuilder::Console::ConsoleMessage::Level::Enum messageLevelValue(Messa
geLevel level) | 157 static TypeBuilder::Console::ConsoleMessage::Level::Enum messageLevelValue(Messa
geLevel level) |
| 158 { | 158 { |
| 159 switch (level) { | 159 switch (level) { |
| 160 case DebugMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::
Debug; | 160 case DebugMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::
Debug; |
| 161 case LogMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Lo
g; | 161 case LogMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Lo
g; |
| 162 case WarningMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level
::Warning; | 162 case WarningMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level
::Warning; |
| 163 case ErrorMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::
Error; | 163 case ErrorMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::
Error; |
| 164 case InfoMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::I
nfo; | 164 case InfoMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::I
nfo; |
| 165 case RevokedErrorMessageLevel: return TypeBuilder::Console::ConsoleMessage::
Level::RevokedError; |
| 165 } | 166 } |
| 166 return TypeBuilder::Console::ConsoleMessage::Level::Log; | 167 return TypeBuilder::Console::ConsoleMessage::Level::Log; |
| 167 } | 168 } |
| 168 | 169 |
| 169 void InspectorConsoleAgent::sendConsoleMessageToFrontend(ConsoleMessage* console
Message, bool generatePreview) | 170 void InspectorConsoleAgent::sendConsoleMessageToFrontend(ConsoleMessage* console
Message, bool generatePreview) |
| 170 { | 171 { |
| 171 if (consoleMessage->workerGlobalScopeProxy()) | 172 if (consoleMessage->workerGlobalScopeProxy()) |
| 172 return; | 173 return; |
| 173 | 174 |
| 174 RefPtr<TypeBuilder::Console::ConsoleMessage> jsonObj = TypeBuilder::Console:
:ConsoleMessage::create() | 175 RefPtr<TypeBuilder::Console::ConsoleMessage> jsonObj = TypeBuilder::Console:
:ConsoleMessage::create() |
| 176 .setSequenceNumber(static_cast<int>(consoleMessage->sequenceNumber())) |
| 175 .setSource(messageSourceValue(consoleMessage->source())) | 177 .setSource(messageSourceValue(consoleMessage->source())) |
| 176 .setLevel(messageLevelValue(consoleMessage->level())) | 178 .setLevel(messageLevelValue(consoleMessage->level())) |
| 177 .setText(consoleMessage->message()) | 179 .setText(consoleMessage->message()) |
| 178 .setTimestamp(consoleMessage->timestamp()); | 180 .setTimestamp(consoleMessage->timestamp()); |
| 179 // FIXME: only send out type for ConsoleAPI source messages. | 181 // FIXME: only send out type for ConsoleAPI source messages. |
| 180 jsonObj->setType(messageTypeValue(consoleMessage->type())); | 182 jsonObj->setType(messageTypeValue(consoleMessage->type())); |
| 181 jsonObj->setLine(static_cast<int>(consoleMessage->lineNumber())); | 183 jsonObj->setLine(static_cast<int>(consoleMessage->lineNumber())); |
| 182 jsonObj->setColumn(static_cast<int>(consoleMessage->columnNumber())); | 184 jsonObj->setColumn(static_cast<int>(consoleMessage->columnNumber())); |
| 183 if (consoleMessage->scriptId()) | 185 if (consoleMessage->scriptId()) |
| 184 jsonObj->setScriptId(String::number(consoleMessage->scriptId())); | 186 jsonObj->setScriptId(String::number(consoleMessage->scriptId())); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 214 } | 216 } |
| 215 jsonObj->setParameters(jsonArgs); | 217 jsonObj->setParameters(jsonArgs); |
| 216 } | 218 } |
| 217 } | 219 } |
| 218 if (consoleMessage->callStack()) { | 220 if (consoleMessage->callStack()) { |
| 219 jsonObj->setStackTrace(consoleMessage->callStack()->buildInspectorArray(
)); | 221 jsonObj->setStackTrace(consoleMessage->callStack()->buildInspectorArray(
)); |
| 220 RefPtrWillBeRawPtr<ScriptAsyncCallStack> asyncCallStack = consoleMessage
->callStack()->asyncCallStack(); | 222 RefPtrWillBeRawPtr<ScriptAsyncCallStack> asyncCallStack = consoleMessage
->callStack()->asyncCallStack(); |
| 221 if (asyncCallStack) | 223 if (asyncCallStack) |
| 222 jsonObj->setAsyncStackTrace(asyncCallStack->buildInspectorObject()); | 224 jsonObj->setAsyncStackTrace(asyncCallStack->buildInspectorObject()); |
| 223 } | 225 } |
| 226 if (consoleMessage->relatedSequenceNumber()) |
| 227 jsonObj->setRelatedSequenceNumber(consoleMessage->relatedSequenceNumber(
)); |
| 224 frontend()->messageAdded(jsonObj); | 228 frontend()->messageAdded(jsonObj); |
| 225 frontend()->flush(); | 229 frontend()->flush(); |
| 226 } | 230 } |
| 227 | 231 |
| 228 } // namespace blink | 232 } // namespace blink |
| OLD | NEW |