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 "shell/application_manager/data_pipe_peek.h" | 5 #include "shell/application_manager/data_pipe_peek.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "mojo/public/cpp/system/wait.h" |
11 | 12 |
12 namespace shell { | 13 namespace shell { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Sleep for as long as max_sleep_micros if the deadline hasn't been reached | 17 // Sleep for as long as max_sleep_micros if the deadline hasn't been reached |
17 // and the number of bytes read is still increasing. Returns true if sleep | 18 // and the number of bytes read is still increasing. Returns true if sleep |
18 // was actually called. | 19 // was actually called. |
19 // | 20 // |
20 // This class is a substitute for being able to wait until N bytes are available | 21 // This class is a substitute for being able to wait until N bytes are available |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 bool BlockingPeekLine(mojo::DataPipeConsumerHandle source, | 151 bool BlockingPeekLine(mojo::DataPipeConsumerHandle source, |
151 std::string* line, | 152 std::string* line, |
152 size_t max_line_length, | 153 size_t max_line_length, |
153 MojoDeadline timeout) { | 154 MojoDeadline timeout) { |
154 PeekFunc peek_line = base::Bind(PeekLine, max_line_length); | 155 PeekFunc peek_line = base::Bind(PeekLine, max_line_length); |
155 return BlockingPeekHelper(source, line, timeout, peek_line); | 156 return BlockingPeekHelper(source, line, timeout, peek_line); |
156 } | 157 } |
157 | 158 |
158 } // namespace shell | 159 } // namespace shell |
OLD | NEW |