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

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

Issue 9702014: [UMA] Use proper C++ objects to serialize tracked_objects across process boundaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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/tracked_objects.h"
10 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
11 #include "content/public/browser/profiler_controller.h" 10 #include "content/public/browser/profiler_controller.h"
12 11
13 namespace content { 12 namespace content {
14 13
14 struct SerializedProfilerData;
15
15 // ProfilerController's implementation. 16 // ProfilerController's implementation.
16 class CONTENT_EXPORT ProfilerControllerImpl : public ProfilerController { 17 class ProfilerControllerImpl : public ProfilerController {
17 public: 18 public:
18 static ProfilerControllerImpl* GetInstance(); 19 static ProfilerControllerImpl* GetInstance();
19 20
20 // Normally instantiated when the child process is launched. Only one instance 21 // Normally instantiated when the child process is launched. Only one instance
21 // should be created per process. 22 // should be created per process.
22 ProfilerControllerImpl(); 23 ProfilerControllerImpl();
23 virtual ~ProfilerControllerImpl(); 24 virtual ~ProfilerControllerImpl();
24 25
25 // Send number of pending processes to subscriber_. |end| is set to true if it 26 // Send the number of |pending_processes| to |subscriber_|. |end| is set to
26 // is the last time. This is called on UI thread. 27 // true if it is the last time. This is called on the UI thread.
27 void OnPendingProcesses(int sequence_number, int pending_processes, bool end); 28 void OnPendingProcesses(int sequence_number, int pending_processes, bool end);
28 29
29 // Send profiler_data back to subscriber_. subscriber_ assumes the ownership 30 // Send the |profiler_data| back to the |subscriber_|.
30 // of profiler_data. This is called on UI thread. 31 // This is called on the UI thread.
31 void OnProfilerDataCollected(int sequence_number, 32 void OnProfilerDataCollected(int sequence_number,
32 base::DictionaryValue* profiler_data); 33 const SerializedProfilerData& profiler_data);
33 34
34 // ProfilerController implementation: 35 // ProfilerController implementation:
35 virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE; 36 virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE;
36 virtual void Unregister(ProfilerSubscriber* subscriber) OVERRIDE; 37 virtual void Unregister(const ProfilerSubscriber* subscriber) OVERRIDE;
37 virtual void GetProfilerData(int sequence_number) OVERRIDE; 38 virtual void GetProfilerData(int sequence_number) OVERRIDE;
38 virtual void SetProfilerStatus(
39 tracked_objects::ThreadData::Status status) OVERRIDE;
40 39
41 private: 40 private:
42 friend struct DefaultSingletonTraits<ProfilerControllerImpl>; 41 friend struct DefaultSingletonTraits<ProfilerControllerImpl>;
43 42
44 // Contact child processes and get their profiler data. 43 // Contact child processes and get their profiler data.
45 void GetProfilerDataFromChildProcesses(int sequence_number); 44 void GetProfilerDataFromChildProcesses(int sequence_number);
46 45
47 // Contact child processes and set profiler status to |enable|.
48 void SetProfilerStatusInChildProcesses(
49 tracked_objects::ThreadData::Status status);
50
51 ProfilerSubscriber* subscriber_; 46 ProfilerSubscriber* subscriber_;
52 47
53 DISALLOW_COPY_AND_ASSIGN(ProfilerControllerImpl); 48 DISALLOW_COPY_AND_ASSIGN(ProfilerControllerImpl);
54 }; 49 };
55 50
56 } // namespace content 51 } // namespace content
57 52
58 #endif // CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ 53 #endif // CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_
59
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698