| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 namespace WebCore { | 47 namespace WebCore { |
| 48 | 48 |
| 49 namespace ProfilerAgentState { | 49 namespace ProfilerAgentState { |
| 50 static const char samplingInterval[] = "samplingInterval"; | 50 static const char samplingInterval[] = "samplingInterval"; |
| 51 static const char userInitiatedProfiling[] = "userInitiatedProfiling"; | 51 static const char userInitiatedProfiling[] = "userInitiatedProfiling"; |
| 52 static const char profilerEnabled[] = "profilerEnabled"; | 52 static const char profilerEnabled[] = "profilerEnabled"; |
| 53 static const char profileHeadersRequested[] = "profileHeadersRequested"; | 53 static const char profileHeadersRequested[] = "profileHeadersRequested"; |
| 54 } | 54 } |
| 55 | 55 |
| 56 static const char* const userInitiatedProfileName = "org.webkit.profiles.user-in
itiated"; | |
| 57 static const char* const CPUProfileType = "CPU"; | 56 static const char* const CPUProfileType = "CPU"; |
| 58 | 57 |
| 59 PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingA
gents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, InspectorCompos
iteState* inspectorState, InjectedScriptManager* injectedScriptManager) | 58 PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingA
gents* instrumentingAgents, InspectorConsoleAgent* consoleAgent, InspectorCompos
iteState* inspectorState, InjectedScriptManager* injectedScriptManager) |
| 60 { | 59 { |
| 61 return adoptPtr(new InspectorProfilerAgent(instrumentingAgents, consoleAgent
, inspectorState, injectedScriptManager)); | 60 return adoptPtr(new InspectorProfilerAgent(instrumentingAgents, consoleAgent
, inspectorState, injectedScriptManager)); |
| 62 } | 61 } |
| 63 | 62 |
| 64 InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentin
gAgents, InspectorConsoleAgent* consoleAgent, InspectorCompositeState* inspector
State, InjectedScriptManager* injectedScriptManager) | 63 InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentin
gAgents, InspectorConsoleAgent* consoleAgent, InspectorCompositeState* inspector
State, InjectedScriptManager* injectedScriptManager) |
| 65 : InspectorBaseAgent<InspectorProfilerAgent>("Profiler", instrumentingAgents
, inspectorState) | 64 : InspectorBaseAgent<InspectorProfilerAgent>("Profiler", instrumentingAgents
, inspectorState) |
| 66 , m_consoleAgent(consoleAgent) | 65 , m_consoleAgent(consoleAgent) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 135 } |
| 137 m_state->setLong(ProfilerAgentState::samplingInterval, interval); | 136 m_state->setLong(ProfilerAgentState::samplingInterval, interval); |
| 138 ScriptProfiler::setSamplingInterval(interval); | 137 ScriptProfiler::setSamplingInterval(interval); |
| 139 } | 138 } |
| 140 | 139 |
| 141 String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool increment
ProfileNumber) | 140 String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool increment
ProfileNumber) |
| 142 { | 141 { |
| 143 if (incrementProfileNumber) | 142 if (incrementProfileNumber) |
| 144 m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++
; | 143 m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++
; |
| 145 | 144 |
| 146 return String(userInitiatedProfileName) + "." + String::number(m_currentUser
InitiatedProfileNumber); | 145 return "Profile " + String::number(m_currentUserInitiatedProfileNumber); |
| 147 } | 146 } |
| 148 | 147 |
| 149 void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder:
:Array<TypeBuilder::Profiler::ProfileHeader> >& headers) | 148 void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder:
:Array<TypeBuilder::Profiler::ProfileHeader> >& headers) |
| 150 { | 149 { |
| 151 m_state->setBoolean(ProfilerAgentState::profileHeadersRequested, true); | 150 m_state->setBoolean(ProfilerAgentState::profileHeadersRequested, true); |
| 152 headers = TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader>::create()
; | 151 headers = TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader>::create()
; |
| 153 | 152 |
| 154 ProfilesMap::iterator profilesEnd = m_profiles.end(); | 153 ProfilesMap::iterator profilesEnd = m_profiles.end(); |
| 155 for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it) | 154 for (ProfilesMap::iterator it = m_profiles.begin(); it != profilesEnd; ++it) |
| 156 headers->addItem(createProfileHeader(*it->value)); | 155 headers->addItem(createProfileHeader(*it->value)); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 idleStarted(); | 306 idleStarted(); |
| 308 } | 307 } |
| 309 | 308 |
| 310 void InspectorProfilerAgent::didLeaveNestedRunLoop() | 309 void InspectorProfilerAgent::didLeaveNestedRunLoop() |
| 311 { | 310 { |
| 312 idleFinished(); | 311 idleFinished(); |
| 313 } | 312 } |
| 314 | 313 |
| 315 } // namespace WebCore | 314 } // namespace WebCore |
| 316 | 315 |
| OLD | NEW |