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

Unified Diff: mojo/public/cpp/bindings/binding.h

Issue 1055703002: Gather trace data by waiting on handles with a fixed timeout (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: review feedback Created 5 years, 8 months 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
« no previous file with comments | « mojo/common/trace_controller_impl.cc ('k') | mojo/public/cpp/bindings/lib/connector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/binding.h
diff --git a/mojo/public/cpp/bindings/binding.h b/mojo/public/cpp/bindings/binding.h
index 05a162e6518dfdecb84092389b27e4fab9ca3302..5894df41fb38cb9dc8e360f0ef9ff17497373c03 100644
--- a/mojo/public/cpp/bindings/binding.h
+++ b/mojo/public/cpp/bindings/binding.h
@@ -147,10 +147,12 @@ class Binding : public ErrorHandler {
}
// Blocks the calling thread until either a call arrives on the previously
- // bound message pipe, or an error occurs.
- bool WaitForIncomingMethodCall() {
+ // bound message pipe, the deadline is exceeded, or an error occurs. Returns
+ // true if a method was successfully read and dispatched.
+ bool WaitForIncomingMethodCall(
+ MojoDeadline deadline = MOJO_DEADLINE_INDEFINITE) {
MOJO_DCHECK(internal_router_);
- return internal_router_->WaitForIncomingMessage();
+ return internal_router_->WaitForIncomingMessage(deadline);
}
// Closes the message pipe that was previously bound. Put this object into a
@@ -194,6 +196,15 @@ class Binding : public ErrorHandler {
// pipe has been bound to the implementation).
bool is_bound() const { return !!internal_router_; }
+ // Returns the value of the handle currently bound to this Binding which can
+ // be used to make explicit Wait/WaitMany calls. Requires that the Binding be
+ // bound. Ownership of the handle is retained by the Binding, it is not
+ // transferred to the caller.
+ MessagePipeHandle handle() const {
+ MOJO_DCHECK(is_bound());
+ return internal_router_->handle();
+ }
+
// Exposed for testing, should not generally be used.
internal::Router* internal_router() { return internal_router_; }
« no previous file with comments | « mojo/common/trace_controller_impl.cc ('k') | mojo/public/cpp/bindings/lib/connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698