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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 return; | 104 return; |
105 | 105 |
106 internalAddMessage(AssertMessageType, ErrorMessageLevel, state, arguments, t
rue); | 106 internalAddMessage(AssertMessageType, ErrorMessageLevel, state, arguments, t
rue); |
107 } | 107 } |
108 | 108 |
109 void ConsoleBase::count(ScriptState* state, PassRefPtr<ScriptArguments> argument
s) | 109 void ConsoleBase::count(ScriptState* state, PassRefPtr<ScriptArguments> argument
s) |
110 { | 110 { |
111 InspectorInstrumentation::consoleCount(context(), state, arguments); | 111 InspectorInstrumentation::consoleCount(context(), state, arguments); |
112 } | 112 } |
113 | 113 |
114 void ConsoleBase::markTimeline(PassRefPtr<ScriptArguments> arguments) | 114 void ConsoleBase::markTimeline(const String& title) |
115 { | 115 { |
116 InspectorInstrumentation::consoleTimeStamp(context(), arguments); | 116 InspectorInstrumentation::consoleTimeStamp(context(), title); |
117 } | 117 } |
118 | 118 |
119 void ConsoleBase::profile(ScriptState* state, const String& title) | 119 void ConsoleBase::profile(ScriptState* state, const String& title) |
120 { | 120 { |
121 ScriptExecutionContext* context = this->context(); | 121 ScriptExecutionContext* context = this->context(); |
122 if (!context) | 122 if (!context) |
123 return; | 123 return; |
124 | 124 |
125 // FIXME: log a console message when profiling is disabled. | 125 // FIXME: log a console message when profiling is disabled. |
126 if (!profilerEnabled()) | 126 if (!profilerEnabled()) |
127 return; | 127 return; |
128 | 128 |
129 String resolvedTitle = title; | 129 String resolvedTitle = title; |
130 if (title.isNull()) // no title so give it the next user initiated profile t
itle. | 130 if (title.isNull()) // no title so give it the next user initiated profile t
itle. |
131 resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfile
Name(context, true); | 131 resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfile
Name(context, true); |
132 | 132 |
133 ScriptProfiler::start(resolvedTitle); | 133 ScriptProfiler::start(resolvedTitle); |
134 | 134 InspectorInstrumentation::addMessageToConsole(context, ConsoleAPIMessageSour
ce, ProfileMessageType, DebugMessageLevel, resolvedTitle, String(), 0, 0, state)
; |
135 RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1)); | |
136 const ScriptCallFrame& lastCaller = callStack->at(0); | |
137 InspectorInstrumentation::addStartProfilingMessageToConsole(context, resolve
dTitle, lastCaller.lineNumber(), lastCaller.sourceURL()); | |
138 } | 135 } |
139 | 136 |
140 void ConsoleBase::profileEnd(ScriptState* state, const String& title) | 137 void ConsoleBase::profileEnd(ScriptState* state, const String& title) |
141 { | 138 { |
142 ScriptExecutionContext* context = this->context(); | 139 ScriptExecutionContext* context = this->context(); |
143 if (!context) | 140 if (!context) |
144 return; | 141 return; |
145 | 142 |
146 if (!profilerEnabled()) | 143 if (!profilerEnabled()) |
147 return; | 144 return; |
148 | 145 |
149 RefPtr<ScriptProfile> profile = ScriptProfiler::stop(title); | 146 RefPtr<ScriptProfile> profile = ScriptProfiler::stop(title); |
150 if (!profile) | 147 if (!profile) |
151 return; | 148 return; |
152 | 149 |
153 RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1)); | 150 RefPtr<ScriptCallStack> callStack(createScriptCallStack(state, 1)); |
154 InspectorInstrumentation::addProfile(context, profile, callStack); | 151 InspectorInstrumentation::addProfile(context, profile, callStack); |
155 } | 152 } |
156 | 153 |
157 | |
158 void ConsoleBase::time(const String& title) | 154 void ConsoleBase::time(const String& title) |
159 { | 155 { |
160 InspectorInstrumentation::startConsoleTiming(context(), title); | 156 InspectorInstrumentation::consoleTime(context(), title); |
161 TRACE_EVENT_COPY_ASYNC_BEGIN0("webkit.console", title.utf8().data(), this); | 157 TRACE_EVENT_COPY_ASYNC_BEGIN0("webkit.console", title.utf8().data(), this); |
162 } | 158 } |
163 | 159 |
164 void ConsoleBase::timeEnd(ScriptState* state, const String& title) | 160 void ConsoleBase::timeEnd(ScriptState* state, const String& title) |
165 { | 161 { |
166 TRACE_EVENT_COPY_ASYNC_END0("webkit.console", title.utf8().data(), this); | 162 TRACE_EVENT_COPY_ASYNC_END0("webkit.console", title.utf8().data(), this); |
167 RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(state)); | 163 InspectorInstrumentation::consoleTimeEnd(context(), title, state); |
168 InspectorInstrumentation::stopConsoleTiming(context(), title, callStack.rele
ase()); | |
169 } | 164 } |
170 | 165 |
171 void ConsoleBase::timeStamp(PassRefPtr<ScriptArguments> arguments) | 166 void ConsoleBase::timeStamp(const String& title) |
172 { | 167 { |
173 InspectorInstrumentation::consoleTimeStamp(context(), arguments); | 168 InspectorInstrumentation::consoleTimeStamp(context(), title); |
| 169 } |
| 170 |
| 171 void ConsoleBase::timeline(ScriptState* state, const String& title) |
| 172 { |
| 173 InspectorInstrumentation::consoleTimeline(context(), title, state); |
| 174 } |
| 175 |
| 176 void ConsoleBase::timelineEnd(ScriptState* state, const String& title) |
| 177 { |
| 178 InspectorInstrumentation::consoleTimelineEnd(context(), title, state); |
174 } | 179 } |
175 | 180 |
176 void ConsoleBase::group(ScriptState* state, PassRefPtr<ScriptArguments> argument
s) | 181 void ConsoleBase::group(ScriptState* state, PassRefPtr<ScriptArguments> argument
s) |
177 { | 182 { |
178 InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSo
urce, StartGroupMessageType, LogMessageLevel, String(), state, arguments); | 183 InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSo
urce, StartGroupMessageType, LogMessageLevel, String(), state, arguments); |
179 } | 184 } |
180 | 185 |
181 void ConsoleBase::groupCollapsed(ScriptState* state, PassRefPtr<ScriptArguments>
arguments) | 186 void ConsoleBase::groupCollapsed(ScriptState* state, PassRefPtr<ScriptArguments>
arguments) |
182 { | 187 { |
183 InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSo
urce, StartGroupCollapsedMessageType, LogMessageLevel, String(), state, argument
s); | 188 InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSo
urce, StartGroupCollapsedMessageType, LogMessageLevel, String(), state, argument
s); |
(...skipping 18 matching lines...) Expand all Loading... |
202 const ScriptCallFrame& lastCaller = callStack->at(0); | 207 const ScriptCallFrame& lastCaller = callStack->at(0); |
203 | 208 |
204 String message; | 209 String message; |
205 bool gotStringMessage = arguments->getFirstArgumentAsString(message); | 210 bool gotStringMessage = arguments->getFirstArgumentAsString(message); |
206 InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSo
urce, type, level, message, state, arguments); | 211 InspectorInstrumentation::addMessageToConsole(context(), ConsoleAPIMessageSo
urce, type, level, message, state, arguments); |
207 if (gotStringMessage) | 212 if (gotStringMessage) |
208 reportMessageToClient(level, message, callStack); | 213 reportMessageToClient(level, message, callStack); |
209 } | 214 } |
210 | 215 |
211 } // namespace WebCore | 216 } // namespace WebCore |
OLD | NEW |