OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_SHELL_DATA_PIPE_PEEK_H_ | |
6 #define MOJO_SHELL_DATA_PIPE_PEEK_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include <string> | |
11 | |
12 #include "mojo/public/cpp/system/core.h" | |
13 | |
14 namespace mojo { | |
15 namespace shell { | |
16 | |
17 // The Peek functions are only intended to be used by the | |
18 // DyanmicApplicationLoader class for discovering the type of a | |
19 // URL response. They are a stopgap to be replaced by real support | |
20 // in the DataPipe classes. | |
21 | |
22 // Return true and the first newline terminated line from source. Return false | |
23 // if more than max_line_length bytes are scanned without seeing a newline, or | |
24 // if the timeout is exceeded. | |
25 bool BlockingPeekLine(DataPipeConsumerHandle source, | |
26 std::string* line, | |
27 size_t max_line_length, | |
28 MojoDeadline timeout); | |
29 | |
30 // Return true and the first bytes_length bytes from source. Return false | |
31 // if the timeout is exceeded. | |
32 bool BlockingPeekNBytes(DataPipeConsumerHandle source, | |
33 std::string* bytes, | |
34 size_t bytes_length, | |
35 MojoDeadline timeout); | |
36 | |
37 } // namespace shell | |
38 } // namespace mojo | |
39 | |
40 #endif // MOJO_SHELL_DATA_PIPE_PEEK_H_ | |
OLD | NEW |