Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / mojo / shell / data_pipe_peek.h
blob0bcf1dd9f29b4e4e40cbf12a4f8f49f8632a75aa
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.
5 #ifndef MOJO_SHELL_DATA_PIPE_PEEK_H_
6 #define MOJO_SHELL_DATA_PIPE_PEEK_H_
8 #include <string>
10 #include "mojo/public/cpp/system/core.h"
12 namespace mojo {
13 namespace shell {
15 // The Peek functions are only intended to be used by the
16 // DyanmicApplicationLoader class for discovering the type of a
17 // URL response. They are a stopgap to be replaced by real support
18 // in the DataPipe classes.
20 // 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
22 // if the timeout is exceeded.
23 bool BlockingPeekLine(DataPipeConsumerHandle source,
24 std::string* line,
25 size_t max_line_length,
26 MojoDeadline timeout);
28 // Return true and the first bytes_length bytes from source. Return false
29 // if the timeout is exceeded.
30 bool BlockingPeekNBytes(DataPipeConsumerHandle source,
31 std::string* bytes,
32 size_t bytes_length,
33 MojoDeadline timeout);
35 } // namespace shell
36 } // namespace mojo
38 #endif // MOJO_SHELL_DATA_PIPE_PEEK_H_