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

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

Issue 1315283002: [DevTools] Reverse dependencies between InspectorOverlay and agents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: more compile Created 5 years, 3 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 17 matching lines...) Expand all
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/inspector/InspectorProfilerAgent.h" 31 #include "core/inspector/InspectorProfilerAgent.h"
32 32
33 #include "bindings/core/v8/ScriptCallStackFactory.h" 33 #include "bindings/core/v8/ScriptCallStackFactory.h"
34 #include "bindings/core/v8/V8Binding.h" 34 #include "bindings/core/v8/V8Binding.h"
35 #include "core/frame/UseCounter.h" 35 #include "core/frame/UseCounter.h"
36 #include "core/inspector/InjectedScript.h" 36 #include "core/inspector/InjectedScript.h"
37 #include "core/inspector/InjectedScriptHost.h" 37 #include "core/inspector/InjectedScriptHost.h"
38 #include "core/inspector/InspectorOverlay.h"
39 #include "core/inspector/InspectorState.h" 38 #include "core/inspector/InspectorState.h"
40 #include "core/inspector/InstrumentingAgents.h" 39 #include "core/inspector/InstrumentingAgents.h"
41 #include "core/inspector/ScriptCallStack.h" 40 #include "core/inspector/ScriptCallStack.h"
42 #include <v8-profiler.h> 41 #include <v8-profiler.h>
43 42
44 namespace blink { 43 namespace blink {
45 44
46 namespace ProfilerAgentState { 45 namespace ProfilerAgentState {
47 static const char samplingInterval[] = "samplingInterval"; 46 static const char samplingInterval[] = "samplingInterval";
48 static const char userInitiatedProfiling[] = "userInitiatedProfiling"; 47 static const char userInitiatedProfiling[] = "userInitiatedProfiling";
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 143
145 class InspectorProfilerAgent::ProfileDescriptor { 144 class InspectorProfilerAgent::ProfileDescriptor {
146 public: 145 public:
147 ProfileDescriptor(const String& id, const String& title) 146 ProfileDescriptor(const String& id, const String& title)
148 : m_id(id) 147 : m_id(id)
149 , m_title(title) { } 148 , m_title(title) { }
150 String m_id; 149 String m_id;
151 String m_title; 150 String m_title;
152 }; 151 };
153 152
154 PassOwnPtrWillBeRawPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(v8 ::Isolate* isolate, InjectedScriptManager* injectedScriptManager, InspectorOverl ay* overlay) 153 PassOwnPtrWillBeRawPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(v8 ::Isolate* isolate, InjectedScriptManager* injectedScriptManager, Client* client )
155 { 154 {
156 return adoptPtrWillBeNoop(new InspectorProfilerAgent(isolate, injectedScript Manager, overlay)); 155 return adoptPtrWillBeNoop(new InspectorProfilerAgent(isolate, injectedScript Manager, client));
157 } 156 }
158 157
159 InspectorProfilerAgent::InspectorProfilerAgent(v8::Isolate* isolate, InjectedScr iptManager* injectedScriptManager, InspectorOverlay* overlay) 158 InspectorProfilerAgent::InspectorProfilerAgent(v8::Isolate* isolate, InjectedScr iptManager* injectedScriptManager, Client* client)
160 : InspectorBaseAgent<InspectorProfilerAgent, InspectorFrontend::Profiler>("P rofiler") 159 : InspectorBaseAgent<InspectorProfilerAgent, InspectorFrontend::Profiler>("P rofiler")
161 , m_isolate(isolate) 160 , m_isolate(isolate)
162 , m_injectedScriptManager(injectedScriptManager) 161 , m_injectedScriptManager(injectedScriptManager)
163 , m_recordingCPUProfile(false) 162 , m_recordingCPUProfile(false)
164 , m_overlay(overlay) 163 , m_client(client)
165 { 164 {
166 } 165 }
167 166
168 InspectorProfilerAgent::~InspectorProfilerAgent() 167 InspectorProfilerAgent::~InspectorProfilerAgent()
169 { 168 {
170 } 169 }
171 170
172 void InspectorProfilerAgent::consoleProfile(ExecutionContext* context, const Str ing& title) 171 void InspectorProfilerAgent::consoleProfile(ExecutionContext* context, const Str ing& title)
173 { 172 {
174 UseCounter::count(context, UseCounter::DevToolsConsoleProfile); 173 UseCounter::count(context, UseCounter::DevToolsConsoleProfile);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 259
261 void InspectorProfilerAgent::start(ErrorString* error) 260 void InspectorProfilerAgent::start(ErrorString* error)
262 { 261 {
263 if (m_recordingCPUProfile) 262 if (m_recordingCPUProfile)
264 return; 263 return;
265 if (!enabled()) { 264 if (!enabled()) {
266 *error = "Profiler is not enabled"; 265 *error = "Profiler is not enabled";
267 return; 266 return;
268 } 267 }
269 m_recordingCPUProfile = true; 268 m_recordingCPUProfile = true;
270 if (m_overlay) 269 if (m_client)
271 m_overlay->suspendUpdates(); 270 m_client->profilingStarted();
272 m_frontendInitiatedProfileId = nextProfileId(); 271 m_frontendInitiatedProfileId = nextProfileId();
273 startProfiling(m_frontendInitiatedProfileId); 272 startProfiling(m_frontendInitiatedProfileId);
274 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true); 273 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
275 } 274 }
276 275
277 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Profiler::CPUProfile>& profile) 276 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Profiler::CPUProfile>& profile)
278 { 277 {
279 stop(errorString, &profile); 278 stop(errorString, &profile);
280 } 279 }
281 280
282 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Profiler::CPUProfile>* profile) 281 void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: Profiler::CPUProfile>* profile)
283 { 282 {
284 if (!m_recordingCPUProfile) { 283 if (!m_recordingCPUProfile) {
285 if (errorString) 284 if (errorString)
286 *errorString = "No recording profiles found"; 285 *errorString = "No recording profiles found";
287 return; 286 return;
288 } 287 }
289 m_recordingCPUProfile = false; 288 m_recordingCPUProfile = false;
290 if (m_overlay) 289 if (m_client)
291 m_overlay->resumeUpdates(); 290 m_client->profilingStopped();
292 RefPtr<TypeBuilder::Profiler::CPUProfile> cpuProfile = stopProfiling(m_front endInitiatedProfileId, !!profile); 291 RefPtr<TypeBuilder::Profiler::CPUProfile> cpuProfile = stopProfiling(m_front endInitiatedProfileId, !!profile);
293 if (profile) { 292 if (profile) {
294 *profile = cpuProfile; 293 *profile = cpuProfile;
295 if (!cpuProfile && errorString) 294 if (!cpuProfile && errorString)
296 *errorString = "Profile wasn't found"; 295 *errorString = "Profile wasn't found";
297 } 296 }
298 m_frontendInitiatedProfileId = String(); 297 m_frontendInitiatedProfileId = String();
299 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); 298 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
300 } 299 }
301 300
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 359 }
361 360
362 void InspectorProfilerAgent::didLeaveNestedRunLoop() 361 void InspectorProfilerAgent::didLeaveNestedRunLoop()
363 { 362 {
364 idleFinished(); 363 idleFinished();
365 } 364 }
366 365
367 DEFINE_TRACE(InspectorProfilerAgent) 366 DEFINE_TRACE(InspectorProfilerAgent)
368 { 367 {
369 visitor->trace(m_injectedScriptManager); 368 visitor->trace(m_injectedScriptManager);
370 visitor->trace(m_overlay);
371 InspectorBaseAgent::trace(visitor); 369 InspectorBaseAgent::trace(visitor);
372 } 370 }
373 371
374 } // namespace blink 372 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorProfilerAgent.h ('k') | Source/core/inspector/InspectorResourceAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698