Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(796)

Unified Diff: mojo/common/data_pipe_utils.h

Issue 696543003: Mojo content handler shebang support (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: refactored BlockingPeekHelper et al Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/common/data_pipe_utils.h
diff --git a/mojo/common/data_pipe_utils.h b/mojo/common/data_pipe_utils.h
index dc2197b6e07fd14a7d1f08ec4da610e852367a5c..5952d9a03ba510dbf84a4f45c0f46c5c8e50d6d6 100644
--- a/mojo/common/data_pipe_utils.h
+++ b/mojo/common/data_pipe_utils.h
@@ -35,6 +35,23 @@ bool MOJO_COMMON_EXPORT BlockingCopyToString(
ScopedDataPipeConsumerHandle source,
std::string* contents);
+// Return true and the first newline terminated line from source. Return false
+// if more than max_line_length bytes are scanned without seeing a newline, or
+// if the timeout is exceeded.
+bool MOJO_COMMON_EXPORT BlockingPeekLine(
+ DataPipeConsumerHandle source,
+ std::string* line,
+ size_t max_line_length,
+ MojoDeadline timeout);
+
+// Return true and the first bytes_length bytes from source. Return false
+// if the timeout is exceeded.
+bool MOJO_COMMON_EXPORT BlockingPeekNBytes(
+ DataPipeConsumerHandle source,
+ std::string* bytes,
+ size_t bytes_length,
+ MojoDeadline timeout);
+
} // namespace common
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698