OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ |
| 7 |
| 8 #include "base/memory/singleton.h" |
| 9 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/profiler_controller.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // ProfilerController's implementation. |
| 15 class CONTENT_EXPORT ProfilerControllerImpl : public ProfilerController { |
| 16 public: |
| 17 static ProfilerControllerImpl* GetInstance(); |
| 18 |
| 19 // Normally instantiated when the child process is launched. Only one instance |
| 20 // should be created per process. |
| 21 ProfilerControllerImpl(); |
| 22 virtual ~ProfilerControllerImpl(); |
| 23 |
| 24 // Send number of pending processes to subscriber_. |end| is set to true if it |
| 25 // is the last time. This is called on UI thread. |
| 26 void OnPendingProcesses(int sequence_number, int pending_processes, bool end); |
| 27 |
| 28 // Send profiler_data back to subscriber_. subscriber_ assumes the ownership |
| 29 // of profiler_data. This is called on UI thread. |
| 30 void OnProfilerDataCollected(int sequence_number, |
| 31 base::DictionaryValue* profiler_data); |
| 32 |
| 33 // ProfilerController implementation: |
| 34 virtual void Register(ProfilerSubscriber* subscriber) OVERRIDE; |
| 35 virtual void Unregister(ProfilerSubscriber* subscriber) OVERRIDE; |
| 36 virtual void GetProfilerData(int sequence_number) OVERRIDE; |
| 37 virtual void SetProfilerStatus(bool enable) OVERRIDE; |
| 38 |
| 39 private: |
| 40 friend struct DefaultSingletonTraits<ProfilerControllerImpl>; |
| 41 |
| 42 // Contact child processes and get their profiler data. |
| 43 void GetProfilerDataFromChildProcesses(int sequence_number); |
| 44 |
| 45 // Contact child processes and set profiler status to |enable|. |
| 46 void SetProfilerStatusInChildProcesses(bool enable); |
| 47 |
| 48 ProfilerSubscriber* subscriber_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ProfilerControllerImpl); |
| 51 }; |
| 52 |
| 53 } // namespace content |
| 54 |
| 55 #endif // CONTENT_BROWSER_PROFILER_CONTROLLER_IMPL_H_ |
| 56 |
OLD | NEW |