diff options
author | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 00:47:55 +0000 |
---|---|---|
committer | tonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-27 00:47:55 +0000 |
commit | 6aa58b8599840160df945afa89e7482d14d1c4d4 (patch) | |
tree | 7da568401c9497ac63894493ca5dd2e68230e35f /chrome/test/automation | |
parent | 7b05498220a28e7a351c28e75ce1dc68abc746f3 (diff) | |
download | chromium_src-6aa58b8599840160df945afa89e7482d14d1c4d4.zip chromium_src-6aa58b8599840160df945afa89e7482d14d1c4d4.tar.gz chromium_src-6aa58b8599840160df945afa89e7482d14d1c4d4.tar.bz2 |
Revert 237280 "Remove TraceController"
Seems to have broken trace-based telemetry benchmarks on android.
BUG=323749
> Remove TraceController
>
> TraceController is obsoleted by TracingController.
> Changed all remaining clients to use TracingController.
>
> BUG=none
>
> Review URL: https://codereview.chromium.org/67683003
TBR=wangxianzhu@chromium.org
Review URL: https://codereview.chromium.org/89753004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index aae6691..1c8cdb2 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -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::BeginTracing(const std::string& category_patterns) { 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; } |