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

Unified Diff: chrome/browser/ui/webui/profiler_ui.cc

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 | « chrome/browser/ui/webui/profiler_ui.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/profiler_ui.cc
diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc
index a9951601db016700d06aadf2dcd346e6173d8a77..eeeefa17c0889048a630db02d40a3b69b679b6a1 100644
--- a/chrome/browser/ui/webui/profiler_ui.cc
+++ b/chrome/browser/ui/webui/profiler_ui.cc
@@ -14,9 +14,12 @@
//#define USE_SOURCE_FILES_DIRECTLY
#include "base/bind.h"
+#include "base/memory/scoped_ptr.h"
#include "base/tracked_objects.h"
+#include "base/values.h"
#include "chrome/browser/metrics/tracking_synchronizer.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/task_profiler/task_profiler_data_serializer.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -127,7 +130,7 @@ void ProfilerMessageHandler::RegisterMessages() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
web_ui()->RegisterMessageCallback("getData",
- base::Bind(&ProfilerMessageHandler::OnGetData,base::Unretained(this)));
+ base::Bind(&ProfilerMessageHandler::OnGetData, base::Unretained(this)));
web_ui()->RegisterMessageCallback("resetData",
base::Bind(&ProfilerMessageHandler::OnResetData,
base::Unretained(this)));
@@ -144,10 +147,9 @@ void ProfilerMessageHandler::OnResetData(const ListValue* list) {
} // namespace
-ProfilerUI::ProfilerUI(content::WebUI* web_ui) : WebUIController(web_ui) {
- ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<ProfilerUI>(this));
- ui_weak_ptr_ = ui_weak_ptr_factory_->GetWeakPtr();
-
+ProfilerUI::ProfilerUI(content::WebUI* web_ui)
+ : WebUIController(web_ui),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
web_ui->AddMessageHandler(new ProfilerMessageHandler());
// Set up the chrome://profiler/ source.
@@ -159,13 +161,19 @@ ProfilerUI::~ProfilerUI() {
}
void ProfilerUI::GetData() {
- TrackingSynchronizer::FetchProfilerDataAsynchronously(ui_weak_ptr_);
+ TrackingSynchronizer::FetchProfilerDataAsynchronously(
+ weak_ptr_factory_.GetWeakPtr());
}
-void ProfilerUI::ReceivedData(base::Value* value) {
+void ProfilerUI::ReceivedProfilerData(
+ const tracked_objects::ProcessDataSnapshot& profiler_data,
+ content::ProcessType process_type) {
+ // Serialize the data to JSON.
+ DictionaryValue json_data;
+ task_profiler::TaskProfilerDataSerializer::ToValue(profiler_data,
+ process_type,
+ &json_data);
+
// Send the data to the renderer.
- scoped_ptr<Value> data_values(value);
- web_ui()->CallJavascriptFunction(
- "g_browserBridge.receivedData", *data_values.get());
+ web_ui()->CallJavascriptFunction("g_browserBridge.receivedData", json_data);
}
-
« no previous file with comments | « chrome/browser/ui/webui/profiler_ui.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698