Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1816)

Unified Diff: chrome/browser/metrics/tracking_synchronizer.h

Issue 10077001: [UMA] Use proper C++ objects to serialize tracked_objects across process boundaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix yet another IWYU in the chromeos/ code... Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/tracked_objects_unittest.cc ('k') | chrome/browser/metrics/tracking_synchronizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/tracking_synchronizer.h
diff --git a/chrome/browser/metrics/tracking_synchronizer.h b/chrome/browser/metrics/tracking_synchronizer.h
index 75fe3c9d29e8f66ede7cb1f3e642eb37e56449d9..0b818a317d76a50272d88a811460744a8ef4d663 100644
--- a/chrome/browser/metrics/tracking_synchronizer.h
+++ b/chrome/browser/metrics/tracking_synchronizer.h
@@ -14,8 +14,6 @@
#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/values.h"
-#include "chrome/browser/ui/webui/profiler_ui.h"
#include "content/public/browser/profiler_subscriber.h"
// This class maintains state that is used to upload profiler data from the
@@ -35,7 +33,7 @@
namespace chrome_browser_metrics {
-class RequestContext;
+class TrackingSynchronizerObserver;
class TrackingSynchronizer
: public content::ProfilerSubscriber,
@@ -52,7 +50,7 @@ class TrackingSynchronizer
// the data received from each sub-process.
// This method is accessible on UI thread.
static void FetchProfilerDataAsynchronously(
- const base::WeakPtr<ProfilerUI>& callback_object);
+ const base::WeakPtr<TrackingSynchronizerObserver>& callback_object);
// ------------------------------------------------------
// ProfilerSubscriber methods for browser child processes
@@ -64,32 +62,28 @@ class TrackingSynchronizer
int pending_processes,
bool end) 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
- // given sequence number. This method is accessible on UI thread.
- virtual void OnProfilerDataCollected(
- int sequence_number,
- base::DictionaryValue* profiler_data) OVERRIDE;
-
private:
friend class base::RefCountedThreadSafe<TrackingSynchronizer>;
- friend class RequestContext;
+
+ class RequestContext;
virtual ~TrackingSynchronizer();
- // Send profiler_data back to callback_object_. It records that we are waiting
+ // 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
// given sequence number. This method is accessible on UI thread.
- void OnProfilerDataCollectedOnUI(int sequence_number,
- base::DictionaryValue* profiler_data);
+ virtual void OnProfilerDataCollected(
+ int sequence_number,
+ const tracked_objects::ProcessDataSnapshot& profiler_data,
+ content::ProcessType process_type) OVERRIDE;
// Establish a new sequence_number_, and use it to notify all the processes of
// the need to supply, to the browser, their tracking data. It also registers
// |callback_object| in |outstanding_requests_| map. Return the
// sequence_number_ that was used. This method is accessible on UI thread.
int RegisterAndNotifyAllProcesses(
- const base::WeakPtr<ProfilerUI>& callback_object);
+ const base::WeakPtr<TrackingSynchronizerObserver>& callback_object);
// It finds the RequestContext for the given |sequence_number| and notifies
// the RequestContext's |callback_object_| about the |value|. This is called
@@ -98,18 +92,15 @@ class TrackingSynchronizer
// sequence number. If we have received a response from all renderers and
// browser processes, then it calls RequestContext's DeleteIfAllDone to delete
// the entry for sequence_number. This method is accessible on UI thread.
- void DecrementPendingProcessesAndSendData(int sequence_number,
- base::DictionaryValue* value);
+ void DecrementPendingProcessesAndSendData(
+ int sequence_number,
+ const tracked_objects::ProcessDataSnapshot& profiler_data,
+ content::ProcessType process_type);
// Get a new sequence number to be sent to processes from browser process.
// This method is accessible on UI thread.
int GetNextAvailableSequenceNumber();
- // Return pointer to the singleton instance, which is allocated and
- // deallocated on the main UI thread (during system startup and teardown).
- // This method is accessible on UI thread.
- static TrackingSynchronizer* CurrentSynchronizer();
-
// We don't track the actual processes that are contacted for an update, only
// the count of the number of processes, and we can sometimes time-out and
// give up on a "slow to respond" process. We use a sequence_number to be
@@ -119,13 +110,6 @@ class TrackingSynchronizer
// reuse for a long time).
int last_used_sequence_number_;
- // This singleton instance should be started during the single threaded
- // portion of main(). It initializes globals to provide support for all future
- // calls. This object is created on the UI thread, and it is destroyed after
- // all the other threads have gone away. As a result, it is ok to call it
- // from the UI thread, or for about:profiler.
- static TrackingSynchronizer* tracking_synchronizer_;
-
DISALLOW_COPY_AND_ASSIGN(TrackingSynchronizer);
};
« no previous file with comments | « base/tracked_objects_unittest.cc ('k') | chrome/browser/metrics/tracking_synchronizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698