Chromium Code Reviews| Index: content/browser/profiler_controller.h |
| =================================================================== |
| --- content/browser/profiler_controller.h (revision 0) |
| +++ content/browser/profiler_controller.h (revision 0) |
| @@ -0,0 +1,69 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_BROWSER_PROFILER_CONTROLLER_H_ |
| +#define CONTENT_BROWSER_PROFILER_CONTROLLER_H_ |
| + |
| +#include <set> |
| +#include <string> |
| + |
| +#include "base/memory/singleton.h" |
| +#include "base/process.h" |
| +#include "content/common/child_process_info.h" |
| +#include "content/common/content_export.h" |
| + |
| +class ProfilerMessageFilter; |
| + |
| +// Objects interested in receiving profiler data derive from ProfilerSubscriber. |
| +// See also: profiler_message_filter.h |
| +// See also: child_profiler_message_filter.h |
| +class CONTENT_EXPORT ProfilerSubscriber { |
|
jam
2011/11/19 23:36:25
nit: please put this in a separate file
ramant (doing other things)
2011/11/25 23:59:48
Done.
|
| + public: |
| + virtual void OnBrowserChildProfilerDataCollected( |
| + int sequence_number, |
| + const std::string& profiler_data) = 0; |
| + |
| + virtual void OnIsProfilerEnabledForChildProcess( |
| + base::ProcessId child_process_id) = 0; |
| + |
| + protected: |
| + virtual ~ProfilerSubscriber(); |
| +}; |
| + |
| +// ProfilerController is used on the browser processes to collect profiler data. |
|
jam
2011/11/19 23:36:25
nit: process not processes, since there's only one
ramant (doing other things)
2011/11/25 23:59:48
Done.
|
| +// Only the browser UI thread is allowed to interact with the ProfilerController |
| +// object. All calls on the ProfilerSubscriber happen on the UI thread. |
| +class CONTENT_EXPORT ProfilerController { |
|
jam
2011/11/19 23:36:25
for this and above, since we're currently working
ramant (doing other things)
2011/11/25 23:59:48
Done.
|
| + public: |
| + static ProfilerController* GetInstance(); |
| + |
| + // Register the subscriber so that it will be called when |
| + // for example OnProfilerDataCollected is returning profiler data from a child |
| + // process. |
| + void RegisterSubscriber(ProfilerSubscriber* subscriber); |
| + |
| + // Cancel the subscriber so that it will not be called when |
| + // for example OnProfilerDataCollected is returning profiler data from a child |
| + // processes. Safe to call even if caller is not the current subscriber. |
| + void CancelSubscriber(ProfilerSubscriber* subscriber); |
|
jam
2011/11/19 23:36:25
nit: the convention is register/unregister
ramant (doing other things)
2011/11/25 23:59:48
Done.
|
| + |
| + private: |
| + friend struct DefaultSingletonTraits<ProfilerController>; |
| + friend class ProfilerMessageFilter; |
| + |
| + ProfilerController(); |
| + ~ProfilerController(); |
| + |
| + void OnProfilerDataCollected(int sequence_number, |
| + const std::string& profiler_data); |
| + |
| + void OnIsProfilerEnabled(base::ProcessId child_process_id); |
| + |
| + ProfilerSubscriber* subscriber_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ProfilerController); |
| +}; |
| + |
| +#endif // CONTENT_BROWSER_PROFILER_CONTROLLER_H_ |
| + |
| Property changes on: content\browser\profiler_controller.h |
| ___________________________________________________________________ |
| Added: svn:executable |
| + * |