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