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

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

Issue 14672019: Add the filename to the loaded trace file information. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | 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 5b7e359651ddce5ca2c4108664168dc3383380e9..13f553db51d34e62eaf40a34c382b28208fa0c18 100644
--- a/content/browser/tracing/tracing_ui.cc
+++ b/content/browser/tracing/tracing_ui.cc
@@ -11,6 +11,7 @@
#include "base/command_line.h"
#include "base/debug/trace_event.h"
#include "base/file_util.h"
+#include "base/json/string_escape.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
@@ -88,7 +89,8 @@ class TracingMessageHandler
void OnGetKnownCategories(const base::ListValue* list);
// Callbacks.
- void LoadTraceFileComplete(string16* file_contents);
+ void LoadTraceFileComplete(string16* file_contents,
+ const base::FilePath &path);
void SaveTraceFileComplete();
private:
@@ -120,9 +122,10 @@ class TaskProxy : public base::RefCountedThreadSafe<TaskProxy> {
public:
explicit TaskProxy(const base::WeakPtr<TracingMessageHandler>& handler)
: handler_(handler) {}
- void LoadTraceFileCompleteProxy(string16* file_contents) {
+ void LoadTraceFileCompleteProxy(string16* file_contents,
+ const base::FilePath& path) {
if (handler_)
- handler_->LoadTraceFileComplete(file_contents);
+ handler_->LoadTraceFileComplete(file_contents, path);
delete file_contents;
}
@@ -257,7 +260,8 @@ void ReadTraceFileCallback(TaskProxy* proxy, const base::FilePath& path) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&TaskProxy::LoadTraceFileCompleteProxy, proxy,
- contents16.release()));
+ contents16.release(),
+ path));
}
// A callback used for asynchronously writing a file from a string. Calls the
@@ -324,7 +328,8 @@ void TracingMessageHandler::OnLoadTraceFile(const base::ListValue* list) {
NULL);
}
-void TracingMessageHandler::LoadTraceFileComplete(string16* contents) {
+void TracingMessageHandler::LoadTraceFileComplete(string16* contents,
+ const base::FilePath& path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// We need to pass contents to tracingController.onLoadTraceFileComplete, but
@@ -344,8 +349,12 @@ void TracingMessageHandler::LoadTraceFileComplete(string16* contents) {
javascript += contents->substr(i, kMaxSize) + suffix;
rvh->ExecuteJavascriptInWebFrame(string16(), javascript);
}
+
+ // The CallJavascriptFunction is not used because we need to pass
+ // the first param |window.traceData| through as an un-quoted string.
rvh->ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(
- "tracingController.onLoadTraceFileComplete(window.traceData);"
+ "tracingController.onLoadTraceFileComplete(window.traceData," +
+ base::GetDoubleQuotedJson(path.value()) + ");" +
nduca 2013/05/17 23:15:12 do you have to call path.reserve(path.lenght*2) li
"delete window.traceData;"));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698