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

Unified Diff: content/browser/tracing/tracing_ui.cc

Issue 717083003: Report trace buffer usage as number of events, not only percentage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « content/browser/tracing/tracing_controller_impl.cc ('k') | content/public/browser/tracing_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/tracing_ui.cc
diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc
index 95e3ab92cdec6ce18a5c966dbbcfad86ce97e4e6..bb04de079be1cc24c83c90a7eda17801080bb8c4 100644
--- a/content/browser/tracing/tracing_ui.cc
+++ b/content/browser/tracing/tracing_ui.cc
@@ -129,12 +129,28 @@ void OnRecordingEnabledAck(const WebUIDataSource::GotDataCallback& callback) {
callback.Run(res);
}
-void OnTraceBufferPercentFullResult(
- const WebUIDataSource::GotDataCallback& callback, float result) {
- std::string str = base::DoubleToString(result);
+void OnTraceBufferUsageResult(const WebUIDataSource::GotDataCallback& callback,
+ float percent_full,
+ size_t approximate_event_count) {
+ std::string str = base::DoubleToString(percent_full);
callback.Run(base::RefCountedString::TakeString(&str));
}
+void OnTraceBufferStatusResult(const WebUIDataSource::GotDataCallback& callback,
+ float percent_full,
+ size_t approximate_event_count) {
+ scoped_ptr<base::DictionaryValue> status(new base::DictionaryValue());
+ status->SetDouble("percentFull", percent_full);
+ status->SetInteger("approximateEventCount", approximate_event_count);
+
+ std::string status_json;
+ base::JSONWriter::Write(status.get(), &status_json);
+
+ base::RefCountedString* status_base64 = new base::RefCountedString();
+ base::Base64Encode(status_json, &status_base64->data());
+ callback.Run(status_base64);
+}
+
void OnMonitoringEnabledAck(const WebUIDataSource::GotDataCallback& callback);
bool EnableMonitoring(const std::string& data64,
@@ -205,8 +221,12 @@ bool OnBeginJSONRequest(const std::string& path,
return BeginRecording(data, callback);
}
if (path == "json/get_buffer_percent_full") {
- return TracingController::GetInstance()->GetTraceBufferPercentFull(
- base::Bind(OnTraceBufferPercentFullResult, callback));
+ return TracingController::GetInstance()->GetTraceBufferUsage(
+ base::Bind(OnTraceBufferUsageResult, callback));
+ }
+ if (path == "json/get_buffer_status") {
+ return TracingController::GetInstance()->GetTraceBufferUsage(
+ base::Bind(OnTraceBufferStatusResult, callback));
}
if (path == "json/end_recording") {
return TracingController::GetInstance()->DisableRecording(
« no previous file with comments | « content/browser/tracing/tracing_controller_impl.cc ('k') | content/public/browser/tracing_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698