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

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

Issue 541763002: tracing: get rid of files in TracingController interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed android Created 6 years, 3 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: content/browser/tracing/tracing_ui.cc
diff --git a/content/browser/tracing/tracing_ui.cc b/content/browser/tracing/tracing_ui.cc
index 193774a6ea091bba7ef026c9a6ccf0cf488e3a3d..b9374600fe917f9c275f56a26291f24b4133f353 100644
--- a/content/browser/tracing/tracing_ui.cc
+++ b/content/browser/tracing/tracing_ui.cc
@@ -13,7 +13,6 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
-#include "base/file_util.h"
#include "base/format_macros.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
@@ -136,23 +135,6 @@ void OnTraceBufferPercentFullResult(
callback.Run(base::RefCountedString::TakeString(&str));
}
-void ReadRecordingResult(const WebUIDataSource::GotDataCallback& callback,
- const base::FilePath& path) {
- std::string tmp;
- if (!base::ReadFileToString(path, &tmp))
- LOG(ERROR) << "Failed to read file " << path.value();
- base::DeleteFile(path, false);
- callback.Run(base::RefCountedString::TakeString(&tmp));
-}
-
-void BeginReadingRecordingResult(
- const WebUIDataSource::GotDataCallback& callback,
- const base::FilePath& path) {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(ReadRecordingResult, callback, path));
-}
-
void OnMonitoringEnabledAck(const WebUIDataSource::GotDataCallback& callback);
bool EnableMonitoring(const std::string& data64,
@@ -205,23 +187,6 @@ void GetMonitoringStatus(const WebUIDataSource::GotDataCallback& callback) {
callback.Run(monitoring_options_base64);
}
-void ReadMonitoringSnapshot(const WebUIDataSource::GotDataCallback& callback,
- const base::FilePath& path) {
- std::string tmp;
- if (!base::ReadFileToString(path, &tmp))
- LOG(ERROR) << "Failed to read file " << path.value();
- base::DeleteFile(path, false);
- callback.Run(base::RefCountedString::TakeString(&tmp));
-}
-
-void OnMonitoringSnapshotCaptured(
- const WebUIDataSource::GotDataCallback& callback,
- const base::FilePath& path) {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(ReadMonitoringSnapshot, callback, path));
-}
-
bool OnBeginJSONRequest(const std::string& path,
const WebUIDataSource::GotDataCallback& callback) {
if (path == "json/categories") {
@@ -240,7 +205,7 @@ bool OnBeginJSONRequest(const std::string& path,
}
if (path == "json/end_recording") {
return TracingController::GetInstance()->DisableRecording(
- base::FilePath(), base::Bind(BeginReadingRecordingResult, callback));
+ TracingControllerImpl::CreateStringSink(callback));
}
const char* enableMonitoringPath = "json/begin_monitoring?";
@@ -254,7 +219,7 @@ bool OnBeginJSONRequest(const std::string& path,
}
if (path == "json/capture_monitoring") {
TracingController::GetInstance()->CaptureMonitoringSnapshot(
- base::FilePath(), base::Bind(OnMonitoringSnapshotCaptured, callback));
+ TracingControllerImpl::CreateStringSink(callback));
return true;
}
if (path == "json/get_monitoring_status") {

Powered by Google App Engine
This is Rietveld 408576698