| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/inspector/ConsoleMessage.h" | 5 #include "core/inspector/ConsoleMessage.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptCallStack.h" | 7 #include "bindings/core/v8/ScriptCallStack.h" |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "core/inspector/ScriptArguments.h" | 9 #include "core/inspector/ScriptArguments.h" |
| 10 #include "wtf/CurrentTime.h" | 10 #include "wtf/CurrentTime.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 void ConsoleMessage::setCallStack(PassRefPtr<ScriptCallStack> callStack) | 97 void ConsoleMessage::setCallStack(PassRefPtr<ScriptCallStack> callStack) |
| 98 { | 98 { |
| 99 m_callStack = callStack; | 99 m_callStack = callStack; |
| 100 if (m_callStack && !m_callStack->isEmpty() && !m_scriptId) { | 100 if (m_callStack && !m_callStack->isEmpty() && !m_scriptId) { |
| 101 m_url = m_callStack->topSourceURL(); | 101 m_url = m_callStack->topSourceURL(); |
| 102 m_lineNumber = m_callStack->topLineNumber(); | 102 m_lineNumber = m_callStack->topLineNumber(); |
| 103 m_columnNumber = m_callStack->topColumnNumber(); | 103 m_columnNumber = m_callStack->topColumnNumber(); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 ScriptState* ConsoleMessage::scriptState() const | 107 ScriptState* ConsoleMessage::getScriptState() const |
| 108 { | 108 { |
| 109 if (m_scriptState) | 109 if (m_scriptState) |
| 110 return m_scriptState->get(); | 110 return m_scriptState->get(); |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ConsoleMessage::setScriptState(ScriptState* scriptState) | 114 void ConsoleMessage::setScriptState(ScriptState* scriptState) |
| 115 { | 115 { |
| 116 if (m_scriptState) | 116 if (m_scriptState) |
| 117 m_scriptState->clear(); | 117 m_scriptState->clear(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return m_message; | 174 return m_message; |
| 175 } | 175 } |
| 176 | 176 |
| 177 unsigned ConsoleMessage::columnNumber() const | 177 unsigned ConsoleMessage::columnNumber() const |
| 178 { | 178 { |
| 179 return m_columnNumber; | 179 return m_columnNumber; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void ConsoleMessage::frameWindowDiscarded(LocalDOMWindow* window) | 182 void ConsoleMessage::frameWindowDiscarded(LocalDOMWindow* window) |
| 183 { | 183 { |
| 184 if (scriptState() && scriptState()->domWindow() == window) | 184 if (getScriptState() && getScriptState()->domWindow() == window) |
| 185 setScriptState(nullptr); | 185 setScriptState(nullptr); |
| 186 | 186 |
| 187 if (!m_scriptArguments) | 187 if (!m_scriptArguments) |
| 188 return; | 188 return; |
| 189 if (m_scriptArguments->scriptState()->domWindow() != window) | 189 if (m_scriptArguments->getScriptState()->domWindow() != window) |
| 190 return; | 190 return; |
| 191 if (!m_message) | 191 if (!m_message) |
| 192 m_message = "<message collected>"; | 192 m_message = "<message collected>"; |
| 193 m_scriptArguments.clear(); | 193 m_scriptArguments.clear(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 unsigned ConsoleMessage::argumentCount() | 196 unsigned ConsoleMessage::argumentCount() |
| 197 { | 197 { |
| 198 if (m_scriptArguments) | 198 if (m_scriptArguments) |
| 199 return m_scriptArguments->argumentCount(); | 199 return m_scriptArguments->argumentCount(); |
| 200 return 0; | 200 return 0; |
| 201 } | 201 } |
| 202 | 202 |
| 203 void ConsoleMessage::collectCallStack() | 203 void ConsoleMessage::collectCallStack() |
| 204 { | 204 { |
| 205 if (m_type == EndGroupMessageType) | 205 if (m_type == EndGroupMessageType) |
| 206 return; | 206 return; |
| 207 | 207 |
| 208 if (!m_callStack) | 208 if (!m_callStack) |
| 209 setCallStack(ScriptCallStack::captureForConsole()); | 209 setCallStack(ScriptCallStack::captureForConsole()); |
| 210 } | 210 } |
| 211 | 211 |
| 212 DEFINE_TRACE(ConsoleMessage) | 212 DEFINE_TRACE(ConsoleMessage) |
| 213 { | 213 { |
| 214 visitor->trace(m_scriptArguments); | 214 visitor->trace(m_scriptArguments); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |