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

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..b42a1e795ffa556d3f60a22efd6b0da167b194ff 100644
--- a/content/browser/tracing/tracing_ui.cc
+++ b/content/browser/tracing/tracing_ui.cc
@@ -88,7 +88,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 +121,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 +259,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 +327,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 +348,24 @@ void TracingMessageHandler::LoadTraceFileComplete(string16* contents) {
javascript += contents->substr(i, kMaxSize) + suffix;
rvh->ExecuteJavascriptInWebFrame(string16(), javascript);
}
+
+ std::string escaped_path;
+ size_t size = path.value().size();
+ escaped_path.reserve(size);
+ for (size_t i = 0; i < size; ++i) {
+ char c = path.value()[i];
+ if (c < ' ') {
+ escaped_path += base::StringPrintf("\\u%04x", c);
+ continue;
+ }
+ if (c == '\\' || c == '\'')
+ escaped_path.push_back('\\');
+ escaped_path.push_back(c);
+ }
+
nduca 2013/05/13 19:43:46 i think if we switch from ExecuteJavascriptInWebFr
rvh->ExecuteJavascriptInWebFrame(string16(), UTF8ToUTF16(
- "tracingController.onLoadTraceFileComplete(window.traceData);"
+ "tracingController.onLoadTraceFileComplete(window.traceData,'" +
+ escaped_path + "');" +
"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