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 "config.h" | 5 #include "config.h" |
6 #include "core/inspector/ConsoleMessage.h" | 6 #include "core/inspector/ConsoleMessage.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptCallStackFactory.h" | 8 #include "bindings/core/v8/ScriptCallStackFactory.h" |
9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
10 #include "core/inspector/ScriptArguments.h" | 10 #include "core/inspector/ScriptArguments.h" |
11 #include "wtf/CurrentTime.h" | 11 #include "wtf/CurrentTime.h" |
12 #include "wtf/PassOwnPtr.h" | 12 #include "wtf/PassOwnPtr.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 unsigned nextMessageId() | |
17 { | |
18 struct MessageId { | |
19 MessageId() : value(0) { } | |
20 unsigned value; | |
21 }; | |
22 | |
23 AtomicallyInitializedStaticReference(WTF::ThreadSpecific<MessageId>, message
Id, new WTF::ThreadSpecific<MessageId>); | |
24 return ++messageId->value; | |
25 } | |
26 | |
27 ConsoleMessage::ConsoleMessage(MessageSource source, | 16 ConsoleMessage::ConsoleMessage(MessageSource source, |
28 MessageLevel level, | 17 MessageLevel level, |
29 const String& message, | 18 const String& message, |
30 const String& url, | 19 const String& url, |
31 unsigned lineNumber, | 20 unsigned lineNumber, |
32 unsigned columnNumber) | 21 unsigned columnNumber) |
33 : m_source(source) | 22 : m_source(source) |
34 , m_level(level) | 23 , m_level(level) |
35 , m_type(LogMessageType) | 24 , m_type(LogMessageType) |
36 , m_message(message) | 25 , m_message(message) |
37 , m_scriptId(0) | 26 , m_scriptId(0) |
38 , m_url(url) | 27 , m_url(url) |
39 , m_lineNumber(lineNumber) | 28 , m_lineNumber(lineNumber) |
40 , m_columnNumber(columnNumber) | 29 , m_columnNumber(columnNumber) |
41 , m_requestIdentifier(0) | 30 , m_requestIdentifier(0) |
42 , m_timestamp(WTF::currentTime()) | 31 , m_timestamp(WTF::currentTime()) |
43 , m_workerProxy(nullptr) | 32 , m_workerProxy(nullptr) |
44 , m_messageId(0) | |
45 , m_relatedMessageId(0) | |
46 { | 33 { |
47 } | 34 } |
48 | 35 |
49 ConsoleMessage::~ConsoleMessage() | 36 ConsoleMessage::~ConsoleMessage() |
50 { | 37 { |
51 } | 38 } |
52 | 39 |
53 MessageType ConsoleMessage::type() const | 40 MessageType ConsoleMessage::type() const |
54 { | 41 { |
55 return m_type; | 42 return m_type; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 double ConsoleMessage::timestamp() const | 128 double ConsoleMessage::timestamp() const |
142 { | 129 { |
143 return m_timestamp; | 130 return m_timestamp; |
144 } | 131 } |
145 | 132 |
146 void ConsoleMessage::setTimestamp(double timestamp) | 133 void ConsoleMessage::setTimestamp(double timestamp) |
147 { | 134 { |
148 m_timestamp = timestamp; | 135 m_timestamp = timestamp; |
149 } | 136 } |
150 | 137 |
151 unsigned ConsoleMessage::assignMessageId() | |
152 { | |
153 if (!m_messageId) | |
154 m_messageId = nextMessageId(); | |
155 return m_messageId; | |
156 } | |
157 | |
158 MessageSource ConsoleMessage::source() const | 138 MessageSource ConsoleMessage::source() const |
159 { | 139 { |
160 return m_source; | 140 return m_source; |
161 } | 141 } |
162 | 142 |
163 MessageLevel ConsoleMessage::level() const | 143 MessageLevel ConsoleMessage::level() const |
164 { | 144 { |
165 return m_level; | 145 return m_level; |
166 } | 146 } |
167 | 147 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 m_callStack.clear(); | 196 m_callStack.clear(); |
217 } | 197 } |
218 | 198 |
219 DEFINE_TRACE(ConsoleMessage) | 199 DEFINE_TRACE(ConsoleMessage) |
220 { | 200 { |
221 visitor->trace(m_callStack); | 201 visitor->trace(m_callStack); |
222 visitor->trace(m_scriptArguments); | 202 visitor->trace(m_scriptArguments); |
223 } | 203 } |
224 | 204 |
225 } // namespace blink | 205 } // namespace blink |
OLD | NEW |