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

Side by Side Diff: content/browser/profiler_controller_impl.h

Issue 10041017: Show gpu process stats in about:tcmalloc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address nits, call OnStatsForChildProcess directly from IO thread instead of posting to UI Created 8 years, 8 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_
6 #define CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ 6 #define CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_
7 7
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/process.h"
9 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
10 #include "content/public/browser/profiler_controller.h" 11 #include "content/public/browser/profiler_controller.h"
11 #include "content/public/common/process_type.h" 12 #include "content/public/common/process_type.h"
12 13
13 namespace tracked_objects { 14 namespace tracked_objects {
14 struct ProcessDataSnapshot; 15 struct ProcessDataSnapshot;
15 } 16 }
16 17
17 namespace content { 18 namespace content {
18 19
19 // ProfilerController's implementation. 20 // ProfilerController's implementation.
20 class ProfilerControllerImpl : public ProfilerController { 21 class ProfilerControllerImpl : public ProfilerController {
21 public: 22 public:
22 static ProfilerControllerImpl* GetInstance(); 23 static ProfilerControllerImpl* GetInstance();
23 24
24 // Normally instantiated when the child process is launched. Only one instance 25 // Normally instantiated when the child process is launched. Only one instance
25 // should be created per process. 26 // should be created per process.
26 ProfilerControllerImpl(); 27 ProfilerControllerImpl();
27 virtual ~ProfilerControllerImpl(); 28 virtual ~ProfilerControllerImpl();
28 29
29 // Notify the |subscriber_| that it should expect at least |pending_processes| 30 // Notify the |subscriber_| that it should expect at least |pending_processes|
30 // additional calls to OnProfilerDataCollected(). OnPendingProcess() may be 31 // additional calls to OnProfilerDataCollected(). OnPendingProcess() may be
31 // called repeatedly; the last call will have |end| set to true, indicating 32 // called repeatedly; the last call will have |end| set to true, indicating
32 // that there is no longer a possibility for the count of pending processes to 33 // that there is no longer a possibility for the count of pending processes to
33 // increase. This is called on the UI thread. 34 // increase. This is called on the UI thread.
34 void OnPendingProcesses(int sequence_number, int pending_processes, bool end); 35 void OnPendingProcesses(int sequence_number, int pending_processes, bool end);
35 36
36 // Send the |profiler_data| back to the |subscriber_|. 37 // Send the |profiler_data| back to the |subscriber_|.
37 // This is called on the UI thread. 38 // This can be called from any thread.
38 void OnProfilerDataCollected( 39 void OnProfilerDataCollected(
39 int sequence_number, 40 int sequence_number,
40 const tracked_objects::ProcessDataSnapshot& profiler_data, 41 const tracked_objects::ProcessDataSnapshot& profiler_data,
41 content::ProcessType process_type); 42 content::ProcessType process_type);
42 43
43 // ProfilerController implementation: 44 // ProfilerController implementation:
44 virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE; 45 virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE;
45 virtual void Unregister(const ProfilerSubscriber* subscriber) OVERRIDE; 46 virtual void Unregister(const ProfilerSubscriber* subscriber) OVERRIDE;
46 virtual void GetProfilerData(int sequence_number) OVERRIDE; 47 virtual void GetProfilerData(int sequence_number) OVERRIDE;
47 48
48 private: 49 private:
49 friend struct DefaultSingletonTraits<ProfilerControllerImpl>; 50 friend struct DefaultSingletonTraits<ProfilerControllerImpl>;
50 51
51 // Contact child processes and get their profiler data. 52 // Contact child processes and get their profiler data.
52 void GetProfilerDataFromChildProcesses(int sequence_number); 53 void GetProfilerDataFromChildProcesses(int sequence_number);
53 54
54 ProfilerSubscriber* subscriber_; 55 ProfilerSubscriber* subscriber_;
55 56
56 DISALLOW_COPY_AND_ASSIGN(ProfilerControllerImpl); 57 DISALLOW_COPY_AND_ASSIGN(ProfilerControllerImpl);
57 }; 58 };
58 59
59 } // namespace content 60 } // namespace content
60 61
61 #endif // CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ 62 #endif // CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_process_observer.cc ('k') | content/browser/profiler_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698