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

Side by Side Diff: mojo/public/cpp/bindings/lib/connector.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 unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/lib/connector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
7 7
8 #include "mojo/public/c/environment/async_waiter.h" 8 #include "mojo/public/c/environment/async_waiter.h"
9 #include "mojo/public/cpp/bindings/lib/message_queue.h" 9 #include "mojo/public/cpp/bindings/lib/message_queue.h"
10 #include "mojo/public/cpp/bindings/message.h" 10 #include "mojo/public/cpp/bindings/message.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // quiescent state. 59 // quiescent state.
60 void CloseMessagePipe(); 60 void CloseMessagePipe();
61 61
62 // Releases the pipe, not triggering the error state. Connector is put into 62 // Releases the pipe, not triggering the error state. Connector is put into
63 // a quiescent state. 63 // a quiescent state.
64 ScopedMessagePipeHandle PassMessagePipe(); 64 ScopedMessagePipeHandle PassMessagePipe();
65 65
66 // Is the connector bound to a MessagePipe handle? 66 // Is the connector bound to a MessagePipe handle?
67 bool is_valid() const { return message_pipe_.is_valid(); } 67 bool is_valid() const { return message_pipe_.is_valid(); }
68 68
69 // Waits for the next message on the pipe, blocking until one arrives or an 69 // Waits for the next message on the pipe, blocking until one arrives,
70 // error happens. Returns |true| if a message has been delivered, |false| 70 // |deadline| elapses, or an error happens. Returns |true| if a message has
71 // otherwise. 71 // been delivered, |false| otherwise.
72 bool WaitForIncomingMessage(); 72 bool WaitForIncomingMessage(MojoDeadline deadline);
73 73
74 // MessageReceiver implementation: 74 // MessageReceiver implementation:
75 bool Accept(Message* message) override; 75 bool Accept(Message* message) override;
76 76
77 MessagePipeHandle handle() const { return message_pipe_.get(); }
78
77 private: 79 private:
78 static void CallOnHandleReady(void* closure, MojoResult result); 80 static void CallOnHandleReady(void* closure, MojoResult result);
79 void OnHandleReady(MojoResult result); 81 void OnHandleReady(MojoResult result);
80 82
81 void WaitToReadMore(); 83 void WaitToReadMore();
82 84
83 // Returns false if |this| was destroyed during message dispatch. 85 // Returns false if |this| was destroyed during message dispatch.
84 MOJO_WARN_UNUSED_RESULT bool ReadSingleMessage(MojoResult* read_result); 86 MOJO_WARN_UNUSED_RESULT bool ReadSingleMessage(MojoResult* read_result);
85 87
86 // |this| can be destroyed during message dispatch. 88 // |this| can be destroyed during message dispatch.
(...skipping 20 matching lines...) Expand all
107 // of dispatching an incoming message. 109 // of dispatching an incoming message.
108 bool* destroyed_flag_; 110 bool* destroyed_flag_;
109 111
110 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector); 112 MOJO_DISALLOW_COPY_AND_ASSIGN(Connector);
111 }; 113 };
112 114
113 } // namespace internal 115 } // namespace internal
114 } // namespace mojo 116 } // namespace mojo
115 117
116 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_ 118 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONNECTOR_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/binding.h ('k') | mojo/public/cpp/bindings/lib/connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698