| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chromeos/dbus/debug_daemon_client.h" | 5 #include "chromeos/dbus/debug_daemon_client.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // A self-deleting object that wraps the pipe reader operations for reading the | 49 // A self-deleting object that wraps the pipe reader operations for reading the |
| 50 // big feedback logs. It will delete itself once the pipe stream has been | 50 // big feedback logs. It will delete itself once the pipe stream has been |
| 51 // terminated. Once the data has been completely read from the pipe, it invokes | 51 // terminated. Once the data has been completely read from the pipe, it invokes |
| 52 // the GetLogsCallback |callback| passing the deserialized logs data back to | 52 // the GetLogsCallback |callback| passing the deserialized logs data back to |
| 53 // the requester. | 53 // the requester. |
| 54 class PipeReaderWrapper : public base::SupportsWeakPtr<PipeReaderWrapper> { | 54 class PipeReaderWrapper : public base::SupportsWeakPtr<PipeReaderWrapper> { |
| 55 public: | 55 public: |
| 56 explicit PipeReaderWrapper(const DebugDaemonClient::GetLogsCallback& callback) | 56 explicit PipeReaderWrapper(const DebugDaemonClient::GetLogsCallback& callback) |
| 57 : pipe_reader_(base::CreateTaskRunnerWithTraits( | 57 : pipe_reader_(base::CreateTaskRunnerWithTraits( |
| 58 base::TaskTraits().MayBlock().WithShutdownBehavior( | 58 {base::MayBlock(), |
| 59 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)), | 59 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}), |
| 60 base::Bind(&PipeReaderWrapper::OnIOComplete, AsWeakPtr())), | 60 base::Bind(&PipeReaderWrapper::OnIOComplete, AsWeakPtr())), |
| 61 callback_(callback) {} | 61 callback_(callback) {} |
| 62 | 62 |
| 63 base::ScopedFD Initialize() { return pipe_reader_.StartIO(); } | 63 base::ScopedFD Initialize() { return pipe_reader_.StartIO(); } |
| 64 | 64 |
| 65 void OnIOComplete() { | 65 void OnIOComplete() { |
| 66 std::string pipe_data; | 66 std::string pipe_data; |
| 67 pipe_reader_.GetData(&pipe_data); | 67 pipe_reader_.GetData(&pipe_data); |
| 68 JSONStringValueDeserializer json_reader(pipe_data); | 68 JSONStringValueDeserializer json_reader(pipe_data); |
| 69 | 69 |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 DebugDaemonClient::EmptyStopAgentTracingCallback() { | 775 DebugDaemonClient::EmptyStopAgentTracingCallback() { |
| 776 return base::Bind(&EmptyStopAgentTracingCallbackBody); | 776 return base::Bind(&EmptyStopAgentTracingCallbackBody); |
| 777 } | 777 } |
| 778 | 778 |
| 779 // static | 779 // static |
| 780 DebugDaemonClient* DebugDaemonClient::Create() { | 780 DebugDaemonClient* DebugDaemonClient::Create() { |
| 781 return new DebugDaemonClientImpl(); | 781 return new DebugDaemonClientImpl(); |
| 782 } | 782 } |
| 783 | 783 |
| 784 } // namespace chromeos | 784 } // namespace chromeos |
| OLD | NEW |