Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: Source/core/inspector/InspectorProfilerAgent.cpp

Issue 325143002: Oilpan: Prepare moving inspector script related classes to oilpan. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 .setHead(scriptProfile.buildInspectorObjectForHead()) 58 .setHead(scriptProfile.buildInspectorObjectForHead())
59 .setStartTime(scriptProfile.startTime()) 59 .setStartTime(scriptProfile.startTime())
60 .setEndTime(scriptProfile.endTime()); 60 .setEndTime(scriptProfile.endTime());
61 profile->setSamples(scriptProfile.buildInspectorObjectForSamples()); 61 profile->setSamples(scriptProfile.buildInspectorObjectForSamples());
62 profile->setTimestamps(scriptProfile.buildInspectorObjectForTimestamps()); 62 profile->setTimestamps(scriptProfile.buildInspectorObjectForTimestamps());
63 return profile.release(); 63 return profile.release();
64 } 64 }
65 65
66 static PassRefPtr<TypeBuilder::Debugger::Location> currentDebugLocation(ScriptSt ate* scriptState) 66 static PassRefPtr<TypeBuilder::Debugger::Location> currentDebugLocation(ScriptSt ate* scriptState)
67 { 67 {
68 RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole(scriptStat e, 1)); 68 RefPtrWillBeRawPtr<ScriptCallStack> callStack(createScriptCallStackForConsol e(scriptState, 1));
69 const ScriptCallFrame& lastCaller = callStack->at(0); 69 const ScriptCallFrame& lastCaller = callStack->at(0);
70 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo cation::create() 70 RefPtr<TypeBuilder::Debugger::Location> location = TypeBuilder::Debugger::Lo cation::create()
71 .setScriptId(lastCaller.scriptId()) 71 .setScriptId(lastCaller.scriptId())
72 .setLineNumber(lastCaller.lineNumber()); 72 .setLineNumber(lastCaller.lineNumber());
73 location->setColumnNumber(lastCaller.columnNumber()); 73 location->setColumnNumber(lastCaller.columnNumber());
74 return location.release(); 74 return location.release();
75 } 75 }
76 76
77 class InspectorProfilerAgent::ProfileDescriptor { 77 class InspectorProfilerAgent::ProfileDescriptor {
78 public: 78 public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (m_startedProfiles[i].m_title == title) { 129 if (m_startedProfiles[i].m_title == title) {
130 resolvedTitle = title; 130 resolvedTitle = title;
131 id = m_startedProfiles[i].m_id; 131 id = m_startedProfiles[i].m_id;
132 m_startedProfiles.remove(i); 132 m_startedProfiles.remove(i);
133 break; 133 break;
134 } 134 }
135 } 135 }
136 if (id.isEmpty()) 136 if (id.isEmpty())
137 return; 137 return;
138 } 138 }
139 RefPtr<ScriptProfile> profile = ScriptProfiler::stop(id); 139 RefPtrWillBeRawPtr<ScriptProfile> profile = ScriptProfiler::stop(id);
140 if (!profile) 140 if (!profile)
141 return; 141 return;
142 RefPtr<TypeBuilder::Debugger::Location> location = currentDebugLocation(scri ptState); 142 RefPtr<TypeBuilder::Debugger::Location> location = currentDebugLocation(scri ptState);
143 m_frontend->consoleProfileFinished(id, location, createCPUProfile(*profile), resolvedTitle.isNull() ? 0 : &resolvedTitle); 143 m_frontend->consoleProfileFinished(id, location, createCPUProfile(*profile), resolvedTitle.isNull() ? 0 : &resolvedTitle);
144 } 144 }
145 145
146 void InspectorProfilerAgent::enable(ErrorString*) 146 void InspectorProfilerAgent::enable(ErrorString*)
147 { 147 {
148 m_state->setBoolean(ProfilerAgentState::profilerEnabled, true); 148 m_state->setBoolean(ProfilerAgentState::profilerEnabled, true);
149 doEnable(); 149 doEnable();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Profiler::CPUProfile>* profile) 229 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Profiler::CPUProfile>* profile)
230 { 230 {
231 if (!m_recordingCPUProfile) { 231 if (!m_recordingCPUProfile) {
232 if (errorString) 232 if (errorString)
233 *errorString = "No recording profiles found"; 233 *errorString = "No recording profiles found";
234 return; 234 return;
235 } 235 }
236 m_recordingCPUProfile = false; 236 m_recordingCPUProfile = false;
237 if (m_overlay) 237 if (m_overlay)
238 m_overlay->finishedRecordingProfile(); 238 m_overlay->finishedRecordingProfile();
239 RefPtr<ScriptProfile> scriptProfile = ScriptProfiler::stop(m_frontendInitiat edProfileId); 239 RefPtrWillBeRawPtr<ScriptProfile> scriptProfile = ScriptProfiler::stop(m_fro ntendInitiatedProfileId);
240 m_frontendInitiatedProfileId = String(); 240 m_frontendInitiatedProfileId = String();
241 if (scriptProfile && profile) 241 if (scriptProfile && profile)
242 *profile = createCPUProfile(*scriptProfile); 242 *profile = createCPUProfile(*scriptProfile);
243 else if (errorString) 243 else if (errorString)
244 *errorString = "Profile wasn't found"; 244 *errorString = "Profile wasn't found";
245 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); 245 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
246 } 246 }
247 247
248 String InspectorProfilerAgent::nextProfileId() 248 String InspectorProfilerAgent::nextProfileId()
249 { 249 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 idleStarted(); 290 idleStarted();
291 } 291 }
292 292
293 void InspectorProfilerAgent::didLeaveNestedRunLoop() 293 void InspectorProfilerAgent::didLeaveNestedRunLoop()
294 { 294 {
295 idleFinished(); 295 idleFinished();
296 } 296 }
297 297
298 } // namespace WebCore 298 } // namespace WebCore
299 299
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInstrumentation.idl ('k') | Source/core/inspector/InspectorResourceAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698