OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<Scrip
tProfile> prpProfile, unsigned lineNumber, const String& sourceURL) | 95 void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<Scrip
tProfile> prpProfile, unsigned lineNumber, const String& sourceURL) |
96 { | 96 { |
97 if (!m_frontend) | 97 if (!m_frontend) |
98 return; | 98 return; |
99 RefPtr<ScriptProfile> profile = prpProfile; | 99 RefPtr<ScriptProfile> profile = prpProfile; |
100 String message = profile->title() + "#" + String::number(profile->uid()); | 100 String message = profile->title() + "#" + String::number(profile->uid()); |
101 m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileEndMessa
geType, DebugMessageLevel, message, sourceURL, lineNumber); | 101 m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileEndMessa
geType, DebugMessageLevel, message, sourceURL, lineNumber); |
102 } | 102 } |
103 | 103 |
104 void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& tit
le, unsigned lineNumber, const String& sourceURL) | |
105 { | |
106 if (!m_frontend) | |
107 return; | |
108 m_consoleAgent->addMessageToConsole(ConsoleAPIMessageSource, ProfileMessageT
ype, DebugMessageLevel, title, sourceURL, lineNumber); | |
109 } | |
110 | |
111 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::createP
rofileHeader(const ScriptProfile& profile) | 104 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::createP
rofileHeader(const ScriptProfile& profile) |
112 { | 105 { |
113 return TypeBuilder::Profiler::ProfileHeader::create() | 106 return TypeBuilder::Profiler::ProfileHeader::create() |
114 .setUid(profile.uid()) | 107 .setUid(profile.uid()) |
115 .setTitle(profile.title()) | 108 .setTitle(profile.title()) |
116 .release(); | 109 .release(); |
117 } | 110 } |
118 | 111 |
119 void InspectorProfilerAgent::enable(ErrorString*) | 112 void InspectorProfilerAgent::enable(ErrorString*) |
120 { | 113 { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 { | 213 { |
221 if (m_recordingCPUProfile) | 214 if (m_recordingCPUProfile) |
222 return; | 215 return; |
223 if (!enabled()) { | 216 if (!enabled()) { |
224 ErrorString error; | 217 ErrorString error; |
225 enable(&error); | 218 enable(&error); |
226 } | 219 } |
227 m_recordingCPUProfile = true; | 220 m_recordingCPUProfile = true; |
228 String title = getCurrentUserInitiatedProfileName(true); | 221 String title = getCurrentUserInitiatedProfileName(true); |
229 ScriptProfiler::start(title); | 222 ScriptProfiler::start(title); |
230 addStartProfilingMessageToConsole(title, 0, String()); | |
231 toggleRecordButton(true); | 223 toggleRecordButton(true); |
232 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true); | 224 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true); |
233 } | 225 } |
234 | 226 |
235 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder::
Profiler::ProfileHeader>& header) | 227 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder::
Profiler::ProfileHeader>& header) |
236 { | 228 { |
237 header = stop(errorString); | 229 header = stop(errorString); |
238 } | 230 } |
239 | 231 |
240 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::stop(Er
rorString* errorString) | 232 PassRefPtr<TypeBuilder::Profiler::ProfileHeader> InspectorProfilerAgent::stop(Er
rorString* errorString) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 idleStarted(); | 294 idleStarted(); |
303 } | 295 } |
304 | 296 |
305 void InspectorProfilerAgent::didLeaveNestedRunLoop() | 297 void InspectorProfilerAgent::didLeaveNestedRunLoop() |
306 { | 298 { |
307 idleFinished(); | 299 idleFinished(); |
308 } | 300 } |
309 | 301 |
310 } // namespace WebCore | 302 } // namespace WebCore |
311 | 303 |
OLD | NEW |