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

Unified Diff: chrome/browser/task_profiler/task_profiler_data_serializer.cc

Issue 9702014: [UMA] Use proper C++ objects to serialize tracked_objects across process boundaries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
Index: chrome/browser/task_profiler/task_profiler_data_serializer.cc
diff --git a/chrome/browser/task_profiler/task_profiler_data_serializer.cc b/chrome/browser/task_profiler/task_profiler_data_serializer.cc
index fd767418a5ce7f0eab1b2f2f002c6b4aa2c9b8c8..4a8fdb0361b794d81944afd539495f9335877a13 100644
--- a/chrome/browser/task_profiler/task_profiler_data_serializer.cc
+++ b/chrome/browser/task_profiler/task_profiler_data_serializer.cc
@@ -10,11 +10,13 @@
#include "base/time.h"
#include "base/tracked_objects.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/process_type.h"
+#include "content/public/common/serialized_profiler_data.h"
#include "googleurl/src/gurl.h"
namespace task_profiler {
-bool TaskProfilerDataSerializer::WriteToFile(const FilePath &path) {
+bool TaskProfilerDataSerializer::WriteToFile(const FilePath& path) {
std::string output;
JSONStringValueSerializer serializer(&output);
serializer.set_pretty_print(true);
@@ -29,10 +31,16 @@ bool TaskProfilerDataSerializer::WriteToFile(const FilePath &path) {
root->SetString("userAgent", content::GetUserAgent(GURL()));
// TODO(ramant): Collect data from other processes, then add that data to the
- // 'per_process_data' array here.
- base::DictionaryValue* this_process_data =
- tracked_objects::ThreadData::ToValue(false);
- per_process_data->Append(this_process_data);
+ // 'per_process_data' array here. Should leverage the TrackingSynchronizer
+ // class to implement this.
+ content::SerializedProfilerData this_process_data(
+ content::PROCESS_TYPE_BROWSER);
+ tracked_objects::ThreadData::ToSerializedProcessData(false,
+ &this_process_data);
+ scoped_ptr<base::DictionaryValue> this_process_data_value(
+ new base::DictionaryValue);
+ this_process_data.ToValue(this_process_data_value.get());
+ per_process_data->Append(this_process_data_value.release());
shutdown_snapshot->SetInteger(
"timestamp",

Powered by Google App Engine
This is Rietveld 408576698