ApplicationImpl cleanup, part 1:
[chromium-blink-merge.git] / content / public / browser / profiler_controller.h
blob34ac03f231b585abca8bd4bfe7a94a14776f42a7
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_PROFILER_CONTROLLER_H_
6 #define CONTENT_PUBLIC_BROWSER_PROFILER_CONTROLLER_H_
8 #include <set>
9 #include <string>
11 #include "base/tracked_objects.h"
12 #include "content/common/content_export.h"
15 namespace base {
16 class DictionaryValue;
19 namespace content {
21 class ProfilerSubscriber;
23 // ProfilerController is used on the browser process to collect profiler data.
24 // Only the browser UI thread is allowed to interact with the ProfilerController
25 // object.
26 class CONTENT_EXPORT ProfilerController {
27 public:
28 // Returns the ProfilerController object for the current process, or nullptr
29 // if none.
30 static ProfilerController* GetInstance();
32 virtual ~ProfilerController() {}
34 // Register the subscriber so that it will be called when for example
35 // OnProfilerDataCollected is returning profiler data from a child process.
36 // This is called on UI thread.
37 virtual void Register(ProfilerSubscriber* subscriber) = 0;
39 // Unregister the subscriber so that it will not be called when for example
40 // OnProfilerDataCollected is returning profiler data from a child process.
41 // Safe to call even if caller is not the current subscriber.
42 virtual void Unregister(const ProfilerSubscriber* subscriber) = 0;
44 // Contact all processes and get their profiler data.
45 // |current_profiling_phase| is the 0-indexed identifier of the current
46 // profiling phase.
47 virtual void GetProfilerData(int sequence_number,
48 int current_profiling_phase) = 0;
50 // Contact child processes and notify them that the |profiling_phase| has
51 // completed.
52 virtual void OnProfilingPhaseCompleted(int profiling_phase) = 0;
55 } // namespace content
57 #endif // CONTENT_PUBLIC_BROWSER_PROFILER_CONTROLLER_H_