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

Unified Diff: trunk/src/chrome/test/automation/automation_proxy.cc

Issue 89753004: Revert 237280 "Remove TraceController" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 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 | « trunk/src/chrome/common/automation_messages_internal.h ('k') | trunk/src/chrome/test/base/tracing.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/test/automation/automation_proxy.cc
===================================================================
--- trunk/src/chrome/test/automation/automation_proxy.cc (revision 237451)
+++ trunk/src/chrome/test/automation/automation_proxy.cc (working copy)
@@ -7,7 +7,7 @@
#include <sstream>
#include "base/basictypes.h"
-#include "base/file_util.h"
+#include "base/debug/trace_event.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/waitable_event.h"
@@ -410,13 +410,31 @@
bool AutomationProxy::EndTracing(std::string* json_trace_output) {
bool success = false;
- base::FilePath path;
- if (!Send(new AutomationMsg_EndTracing(&path, &success)) || !success)
+ size_t num_trace_chunks = 0;
+ if (!Send(new AutomationMsg_EndTracing(&num_trace_chunks, &success)) ||
+ !success)
return false;
- bool ok = base::ReadFileToString(path, json_trace_output);
- DCHECK(ok);
- base::DeleteFile(path, false);
+ std::string chunk;
+ base::debug::TraceResultBuffer buffer;
+ base::debug::TraceResultBuffer::SimpleOutput output;
+ buffer.SetOutputCallback(output.GetCallback());
+
+ // TODO(jbates): See bug 100255, IPC send fails if message is too big. This
+ // code can be simplified if that limitation is fixed.
+ // Workaround IPC payload size limitation by getting chunks.
+ buffer.Start();
+ for (size_t i = 0; i < num_trace_chunks; ++i) {
+ // The broswer side AutomationProvider resets state at BeginTracing,
+ // so it can recover even after this fails mid-way.
+ if (!Send(new AutomationMsg_GetTracingOutput(&chunk, &success)) ||
+ !success)
+ return false;
+ buffer.AddFragment(chunk);
+ }
+ buffer.Finish();
+
+ *json_trace_output = output.json_output;
return true;
}
« no previous file with comments | « trunk/src/chrome/common/automation_messages_internal.h ('k') | trunk/src/chrome/test/base/tracing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698