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