OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/data_pipe_utils/data_pipe_utils.h" | 5 #include "mojo/data_pipe_utils/data_pipe_utils.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
11 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "mojo/data_pipe_utils/data_pipe_utils_internal.h" | 13 #include "mojo/data_pipe_utils/data_pipe_utils_internal.h" |
| 14 #include "mojo/public/cpp/system/wait.h" |
14 | 15 |
15 namespace mojo { | 16 namespace mojo { |
16 namespace common { | 17 namespace common { |
17 | 18 |
18 bool BlockingCopyHelper( | 19 bool BlockingCopyHelper( |
19 ScopedDataPipeConsumerHandle source, | 20 ScopedDataPipeConsumerHandle source, |
20 const base::Callback<size_t(const void*, uint32_t)>& write_bytes) { | 21 const base::Callback<size_t(const void*, uint32_t)>& write_bytes) { |
21 for (;;) { | 22 for (;;) { |
22 const void* buffer = nullptr; | 23 const void* buffer = nullptr; |
23 uint32_t num_bytes = 0; | 24 uint32_t num_bytes = 0; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 107 } |
107 } else { | 108 } else { |
108 // If the consumer handle was closed, then treat as EOF. | 109 // If the consumer handle was closed, then treat as EOF. |
109 return result == MOJO_RESULT_FAILED_PRECONDITION; | 110 return result == MOJO_RESULT_FAILED_PRECONDITION; |
110 } | 111 } |
111 } | 112 } |
112 } | 113 } |
113 | 114 |
114 } // namespace common | 115 } // namespace common |
115 } // namespace mojo | 116 } // namespace mojo |
OLD | NEW |