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

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 87f2f9363168866d9ed392a637d8a7549b9226b9..062d6da35f236c996237fef1242686624b531ecd 100644
--- a/content/browser/tracing/tracing_ui.cc
+++ b/content/browser/tracing/tracing_ui.cc
@@ -89,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:
@@ -121,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;
}
@@ -258,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
@@ -325,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
@@ -345,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()) + ");" +
"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