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

Unified Diff: chrome/browser/ui/webui/profiler_ui.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/ui/webui/profiler_ui.cc
diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc
index 218cea89d6c85697c433cee6621db35a60458d9d..5954c42c2ae7942e6d5efbcff10b8e474effd7d2 100644
--- a/chrome/browser/ui/webui/profiler_ui.cc
+++ b/chrome/browser/ui/webui/profiler_ui.cc
@@ -14,7 +14,9 @@
//#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/ui/webui/chrome_web_ui_data_source.h"
@@ -128,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)));
@@ -145,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.
@@ -160,13 +161,14 @@ 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 content::SerializedProfilerData& data) {
// Send the data to the renderer.
- scoped_ptr<Value> data_values(value);
- web_ui()->CallJavascriptFunction(
- "g_browserBridge.receivedData", *data_values.get());
+ DictionaryValue data_values;
+ data.ToValue(&data_values);
+ web_ui()->CallJavascriptFunction("g_browserBridge.receivedData", data_values);
}
-

Powered by Google App Engine
This is Rietveld 408576698