Chromium Code Reviews| Index: chrome/browser/metrics/perf/perf_output.cc |
| diff --git a/chrome/browser/metrics/perf/perf_output.cc b/chrome/browser/metrics/perf/perf_output.cc |
| index c9c1d37a646ddd773bfd8514c2dfddb6a3924d57..f4d84af26bc455db4c8a0a75c47cc3d448510b64 100644 |
| --- a/chrome/browser/metrics/perf/perf_output.cc |
| +++ b/chrome/browser/metrics/perf/perf_output.cc |
| @@ -4,26 +4,10 @@ |
| #include "chrome/browser/metrics/perf/perf_output.h" |
| -#include <memory> |
| - |
| #include "base/bind.h" |
| -#include "base/location.h" |
| -#include "base/task_runner_util.h" |
| #include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/dbus/debug_daemon_client.h" |
| -namespace { |
| - |
| -// Create a dbus::FileDescriptor from a base::File. |
| -dbus::ScopedFileDescriptor CreateFileDescriptor(base::File pipe_write_end) { |
| - dbus::ScopedFileDescriptor file_descriptor(new dbus::FileDescriptor); |
| - file_descriptor->PutValue(pipe_write_end.TakePlatformFile()); |
| - file_descriptor->CheckValidity(); |
| - return file_descriptor; |
| -} |
| - |
| -} // namespace |
| - |
| PerfOutputCall::PerfOutputCall( |
| scoped_refptr<base::TaskRunner> blocking_task_runner, |
| base::TimeDelta duration, |
| @@ -41,28 +25,17 @@ PerfOutputCall::PerfOutputCall( |
| base::Bind(&PerfOutputCall::OnIOComplete, weak_factory_.GetWeakPtr()))); |
| base::File pipe_write_end = perf_data_pipe_reader_->StartIO(); |
| - base::PostTaskAndReplyWithResult( |
| - blocking_task_runner_.get(), FROM_HERE, |
| - base::Bind(&CreateFileDescriptor, base::Passed(&pipe_write_end)), |
| - base::Bind(&PerfOutputCall::OnFileDescriptorCreated, |
| - weak_factory_.GetWeakPtr())); |
| -} |
| - |
| -PerfOutputCall::~PerfOutputCall() {} |
| - |
| -void PerfOutputCall::OnFileDescriptorCreated( |
| - dbus::ScopedFileDescriptor file_descriptor) { |
| - DCHECK(thread_checker_.CalledOnValidThread()); |
| - DCHECK(file_descriptor); |
| chromeos::DebugDaemonClient* client = |
| chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); |
| - client->GetPerfOutput(duration_, perf_args_, std::move(file_descriptor), |
| + client->GetPerfOutput(duration_, perf_args_, pipe_write_end.GetPlatformFile(), |
| base::Bind(&PerfOutputCall::OnGetPerfOutputError, |
| weak_factory_.GetWeakPtr())); |
| } |
|
satorux1
2016/08/23 04:43:37
|pipe_write_end| is deleted here hence closed? is
hashimoto
2016/08/23 06:38:50
Closing a pipe FD doesn't result in disk IO so it
satorux1
2016/08/23 07:02:02
Ah OK. I thought it'd be caught by AssertIOAllowed
hashimoto
2016/08/23 07:41:27
Good point.
This actually would cause a DCHECK fai
|
| +PerfOutputCall::~PerfOutputCall() {} |
| + |
| void PerfOutputCall::OnIOComplete() { |
| DCHECK(thread_checker_.CalledOnValidThread()); |