OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 void ConsoleBase::assertCondition(ScriptState* scriptState, PassRefPtrWillBeRawP tr<ScriptArguments> arguments, bool condition) | 96 void ConsoleBase::assertCondition(ScriptState* scriptState, PassRefPtrWillBeRawP tr<ScriptArguments> arguments, bool condition) |
97 { | 97 { |
98 if (condition) | 98 if (condition) |
99 return; | 99 return; |
100 | 100 |
101 internalAddMessage(AssertMessageType, ErrorMessageLevel, scriptState, argume nts, true); | 101 internalAddMessage(AssertMessageType, ErrorMessageLevel, scriptState, argume nts, true); |
102 } | 102 } |
103 | 103 |
104 void ConsoleBase::count(ScriptState* scriptState, PassRefPtrWillBeRawPtr<ScriptA rguments> arguments) | 104 void ConsoleBase::count(ScriptState* scriptState, PassRefPtrWillBeRawPtr<ScriptA rguments> arguments) |
105 { | 105 { |
106 RefPtrWillBeRawPtr<ScriptCallStack> callStack(createScriptCallStack(1)); | 106 RefPtrWillBeRawPtr<ScriptCallStack> callStack(createScriptCallStackForConsol e(1)); |
kozyatinskiy1
2014/09/15 12:57:25
createScriptCallStack(1) is equivalent createScrip
sof
2014/09/15 13:09:32
Let me answer that with a question :) Why do you n
kozyatinskiy1
2014/09/15 13:31:29
Because in internalAddMessage in case of tracing m
sof
2014/09/15 13:44:18
I don't understand why you want to optimize this.
kozyatinskiy1
2014/09/15 14:18:21
We discussed this with @vsevik in patch: https://c
| |
107 const ScriptCallFrame& lastCaller = callStack->at(0); | 107 const ScriptCallFrame& lastCaller = callStack->at(0); |
108 // Follow Firebug's behavior of counting with null and undefined title in | 108 // Follow Firebug's behavior of counting with null and undefined title in |
109 // the same bucket as no argument | 109 // the same bucket as no argument |
110 String title; | 110 String title; |
111 arguments->getFirstArgumentAsString(title); | 111 arguments->getFirstArgumentAsString(title); |
112 String identifier = title.isEmpty() ? String(lastCaller.sourceURL() + ':' + String::number(lastCaller.lineNumber())) | 112 String identifier = title.isEmpty() ? String(lastCaller.sourceURL() + ':' + String::number(lastCaller.lineNumber())) |
113 : String(title + '@'); | 113 : String(title + '@'); |
114 | 114 |
115 HashCountedSet<String>::AddResult result = m_counts.add(identifier); | 115 HashCountedSet<String>::AddResult result = m_counts.add(identifier); |
116 String message = title + ": " + String::number(result.storedValue->value); | 116 String message = title + ": " + String::number(result.storedValue->value); |
117 | 117 |
118 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(C onsoleAPIMessageSource, DebugMessageLevel, message); | 118 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(C onsoleAPIMessageSource, DebugMessageLevel, message); |
119 consoleMessage->setType(CountMessageType); | 119 consoleMessage->setType(CountMessageType); |
120 consoleMessage->setScriptState(scriptState); | 120 consoleMessage->setScriptState(scriptState); |
121 consoleMessage->setCallStack(callStack.release()); | |
121 reportMessageToConsole(consoleMessage.release()); | 122 reportMessageToConsole(consoleMessage.release()); |
122 } | 123 } |
123 | 124 |
124 void ConsoleBase::markTimeline(const String& title) | 125 void ConsoleBase::markTimeline(const String& title) |
125 { | 126 { |
126 timeStamp(title); | 127 timeStamp(title); |
127 } | 128 } |
128 | 129 |
129 void ConsoleBase::profile(const String& title) | 130 void ConsoleBase::profile(const String& title) |
130 { | 131 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 164 |
164 double startTime = it->value; | 165 double startTime = it->value; |
165 m_times.remove(it); | 166 m_times.remove(it); |
166 | 167 |
167 double elapsed = monotonicallyIncreasingTime() - startTime; | 168 double elapsed = monotonicallyIncreasingTime() - startTime; |
168 String message = title + String::format(": %.3fms", elapsed * 1000); | 169 String message = title + String::format(": %.3fms", elapsed * 1000); |
169 | 170 |
170 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(C onsoleAPIMessageSource, DebugMessageLevel, message); | 171 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(C onsoleAPIMessageSource, DebugMessageLevel, message); |
171 consoleMessage->setType(TimeEndMessageType); | 172 consoleMessage->setType(TimeEndMessageType); |
172 consoleMessage->setScriptState(scriptState); | 173 consoleMessage->setScriptState(scriptState); |
174 consoleMessage->setCallStack(createScriptCallStackForConsole(1)); | |
kozyatinskiy1
2014/09/15 12:57:25
I suppose we can replace createScriptCallStackForC
| |
173 reportMessageToConsole(consoleMessage.release()); | 175 reportMessageToConsole(consoleMessage.release()); |
174 } | 176 } |
175 | 177 |
176 void ConsoleBase::timeStamp(const String& title) | 178 void ConsoleBase::timeStamp(const String& title) |
177 { | 179 { |
178 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimeSt amp", "data", InspectorTimeStampEvent::data(context(), title)); | 180 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimeSt amp", "data", InspectorTimeStampEvent::data(context(), title)); |
179 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. | 181 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. |
180 InspectorInstrumentation::consoleTimeStamp(context(), title); | 182 InspectorInstrumentation::consoleTimeStamp(context(), title); |
181 } | 183 } |
182 | 184 |
(...skipping 30 matching lines...) Expand all Loading... | |
213 | 215 |
214 String message; | 216 String message; |
215 bool gotStringMessage = arguments ? arguments->getFirstArgumentAsString(mess age) : false; | 217 bool gotStringMessage = arguments ? arguments->getFirstArgumentAsString(mess age) : false; |
216 | 218 |
217 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(C onsoleAPIMessageSource, level, gotStringMessage? message : String()); | 219 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(C onsoleAPIMessageSource, level, gotStringMessage? message : String()); |
218 consoleMessage->setType(type); | 220 consoleMessage->setType(type); |
219 consoleMessage->setScriptState(scriptState); | 221 consoleMessage->setScriptState(scriptState); |
220 consoleMessage->setScriptArguments(arguments); | 222 consoleMessage->setScriptArguments(arguments); |
221 | 223 |
222 size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1; | 224 size_t stackSize = printTrace ? ScriptCallStack::maxCallStackSizeToCapture : 1; |
223 RefPtrWillBeRawPtr<ScriptCallStack> callStack(createScriptCallStackForConsol e(stackSize)); | 225 consoleMessage->setCallStack(createScriptCallStackForConsole(stackSize)); |
224 consoleMessage->setCallStack(callStack); | |
225 | |
226 reportMessageToConsole(consoleMessage.release()); | 226 reportMessageToConsole(consoleMessage.release()); |
227 } | 227 } |
228 | 228 |
229 } // namespace blink | 229 } // namespace blink |
OLD | NEW |