Index: components/metrics/profiler/tracking_synchronizer.h |
diff --git a/components/metrics/profiler/tracking_synchronizer.h b/components/metrics/profiler/tracking_synchronizer.h |
index 472b45ca311c4b14766104f10cd8024554cfd9fe..01542dc4450b00eb09dd78beabfb0dd1a78e91a3 100644 |
--- a/components/metrics/profiler/tracking_synchronizer.h |
+++ b/components/metrics/profiler/tracking_synchronizer.h |
@@ -54,6 +54,11 @@ class TrackingSynchronizer |
static void FetchProfilerDataAsynchronously( |
const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); |
+ // Called when a profiling phase completes. |profiling_event| is the event |
+ // associated with completing the phase and starting a new one. |
+ static void OnProfilingPhaseCompletion( |
+ ProfilerEventProto::ProfilerEvent profiling_event); |
+ |
// ------------------------------------------------------ |
// ProfilerSubscriber methods for browser child processes |
// ------------------------------------------------------ |
@@ -64,15 +69,28 @@ class TrackingSynchronizer |
int pending_processes, |
bool end) override; |
+ protected: |
+ ~TrackingSynchronizer() override; |
+ |
+ // Update the sequence of completed phases with a new phase completion info. |
+ // |now| is the current time, but can be something else in tests. |
+ void RegisterPhaseCompletion( |
+ ProfilerEventProto::ProfilerEvent profiling_event, |
+ const base::TimeTicks& now); |
+ |
+ // Notify |observer| about |profiler_data| received from process of type |
+ // |process_type|. |now| is the current time, but can be something else in |
+ // tests. |
+ void SendData(const tracked_objects::ProcessDataSnapshot& profiler_data, |
+ content::ProcessType process_type, |
+ const base::TimeTicks& now, |
+ TrackingSynchronizerObserver* observer) const; |
+ |
private: |
friend class base::RefCountedThreadSafe<TrackingSynchronizer>; |
- // TODO(vadimt): Remove friending TrackingSynchronizerTest_ProfilerData_Test. |
- friend class TrackingSynchronizerTest_ProfilerData_Test; |
class RequestContext; |
- ~TrackingSynchronizer() override; |
- |
// Send profiler_data back to callback_object_ by calling |
// DecrementPendingProcessesAndSendData which records that we are waiting |
// for one less profiler data from renderer or browser child process for the |
@@ -89,13 +107,10 @@ class TrackingSynchronizer |
int RegisterAndNotifyAllProcesses( |
const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); |
- // Notify |observer| about |profiler_data| received from process of type |
- // |process_type|. |now| is the current time, but can be something else in |
- // tests. |
- void SendData(const tracked_objects::ProcessDataSnapshot& profiler_data, |
- content::ProcessType process_type, |
- const base::TimeTicks& now, |
- TrackingSynchronizerObserver* observer) const; |
+ // Notifies all processes of a completion of a profiling phase. |
+ // |profiling_event| is the event associated with the phase change. |
+ void NotifyAllProcessesOfProfilingPhaseCompletion( |
+ ProfilerEventProto::ProfilerEvent profiling_event); |
// It finds the RequestContext for the given |sequence_number| and notifies |
// the RequestContext's |callback_object_| about the |value|. This is called |
@@ -127,7 +142,6 @@ class TrackingSynchronizer |
std::vector<ProfilerEventProto::ProfilerEvent> |
phase_completion_events_sequence_; |
- // TODO(vadimt): consider moving 2 fields below to metrics service. |
// Time of the profiling start. Used to calculate times of phase change |
// moments relative to this value. |
const base::TimeTicks start_time_; |