| OLD | NEW |
| 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 COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ | 5 #ifndef COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ |
| 6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ | 6 #define COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); | 52 const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); |
| 53 | 53 |
| 54 // ------------------------------------------------------ | 54 // ------------------------------------------------------ |
| 55 // ProfilerSubscriber methods for browser child processes | 55 // ProfilerSubscriber methods for browser child processes |
| 56 // ------------------------------------------------------ | 56 // ------------------------------------------------------ |
| 57 | 57 |
| 58 // Update the number of pending processes for the given |sequence_number|. | 58 // Update the number of pending processes for the given |sequence_number|. |
| 59 // This is called on UI thread. | 59 // This is called on UI thread. |
| 60 virtual void OnPendingProcesses(int sequence_number, | 60 virtual void OnPendingProcesses(int sequence_number, |
| 61 int pending_processes, | 61 int pending_processes, |
| 62 bool end) OVERRIDE; | 62 bool end) override; |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 friend class base::RefCountedThreadSafe<TrackingSynchronizer>; | 65 friend class base::RefCountedThreadSafe<TrackingSynchronizer>; |
| 66 | 66 |
| 67 class RequestContext; | 67 class RequestContext; |
| 68 | 68 |
| 69 virtual ~TrackingSynchronizer(); | 69 virtual ~TrackingSynchronizer(); |
| 70 | 70 |
| 71 // Send profiler_data back to callback_object_ by calling | 71 // Send profiler_data back to callback_object_ by calling |
| 72 // DecrementPendingProcessesAndSendData which records that we are waiting | 72 // DecrementPendingProcessesAndSendData which records that we are waiting |
| 73 // for one less profiler data from renderer or browser child process for the | 73 // for one less profiler data from renderer or browser child process for the |
| 74 // given sequence number. This method is accessible on UI thread. | 74 // given sequence number. This method is accessible on UI thread. |
| 75 virtual void OnProfilerDataCollected( | 75 virtual void OnProfilerDataCollected( |
| 76 int sequence_number, | 76 int sequence_number, |
| 77 const tracked_objects::ProcessDataSnapshot& profiler_data, | 77 const tracked_objects::ProcessDataSnapshot& profiler_data, |
| 78 int process_type) OVERRIDE; | 78 int process_type) override; |
| 79 | 79 |
| 80 // Establish a new sequence_number_, and use it to notify all the processes of | 80 // Establish a new sequence_number_, and use it to notify all the processes of |
| 81 // the need to supply, to the browser, their tracking data. It also registers | 81 // the need to supply, to the browser, their tracking data. It also registers |
| 82 // |callback_object| in |outstanding_requests_| map. Return the | 82 // |callback_object| in |outstanding_requests_| map. Return the |
| 83 // sequence_number_ that was used. This method is accessible on UI thread. | 83 // sequence_number_ that was used. This method is accessible on UI thread. |
| 84 int RegisterAndNotifyAllProcesses( | 84 int RegisterAndNotifyAllProcesses( |
| 85 const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); | 85 const base::WeakPtr<TrackingSynchronizerObserver>& callback_object); |
| 86 | 86 |
| 87 // It finds the RequestContext for the given |sequence_number| and notifies | 87 // It finds the RequestContext for the given |sequence_number| and notifies |
| 88 // the RequestContext's |callback_object_| about the |value|. This is called | 88 // the RequestContext's |callback_object_| about the |value|. This is called |
| (...skipping 19 matching lines...) Expand all Loading... |
| 108 // last_used_sequence_number_ is the most recently used number (used to avoid | 108 // last_used_sequence_number_ is the most recently used number (used to avoid |
| 109 // reuse for a long time). | 109 // reuse for a long time). |
| 110 int last_used_sequence_number_; | 110 int last_used_sequence_number_; |
| 111 | 111 |
| 112 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizer); | 112 DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizer); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace metrics | 115 } // namespace metrics |
| 116 | 116 |
| 117 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ | 117 #endif // COMPONENTS_METRICS_PROFILER_TRACKING_SYNCHRONIZER_H_ |
| OLD | NEW |