| 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;
|
| }
|
|
|
|
|