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

Unified Diff: mojo/public/bindings/lib/connector.h

Issue 134253004: Mojo: AsyncWaiter and mojo/public/environment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing files Created 6 years, 11 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
Index: mojo/public/bindings/lib/connector.h
diff --git a/mojo/public/bindings/lib/connector.h b/mojo/public/bindings/lib/connector.h
index 35e62939dd5bae0d4401427d9f63e07e861adbba..c90979e56453a15492fe00e755619c815d145ef9 100644
--- a/mojo/public/bindings/lib/connector.h
+++ b/mojo/public/bindings/lib/connector.h
@@ -5,9 +5,9 @@
#ifndef MOJO_PUBLIC_BINDINGS_LIB_CONNECTOR_H_
#define MOJO_PUBLIC_BINDINGS_LIB_CONNECTOR_H_
-#include "mojo/public/bindings/lib/bindings_support.h"
#include "mojo/public/bindings/lib/message.h"
#include "mojo/public/bindings/lib/message_queue.h"
+#include "mojo/public/environment/default_async_waiter.h"
#include "mojo/public/system/core_cpp.h"
namespace mojo {
@@ -23,7 +23,8 @@ namespace internal {
class Connector : public MessageReceiver {
public:
// The Connector takes ownership of |message_pipe|.
- explicit Connector(ScopedMessagePipeHandle message_pipe);
+ explicit Connector(ScopedMessagePipeHandle message_pipe,
+ MojoAsyncWaiter* waiter = GetDefaultAsyncWaiter());
virtual ~Connector();
// Sets the receiver to handle messages read from the message pipe. The
@@ -39,29 +40,33 @@ class Connector : public MessageReceiver {
virtual bool Accept(Message* message) MOJO_OVERRIDE;
private:
- class Callback : public BindingsSupport::AsyncWaitCallback {
+ class Callback {
public:
Callback();
- virtual ~Callback();
+ ~Callback();
void SetOwnerToNotify(Connector* owner);
- void SetAsyncWaitID(BindingsSupport::AsyncWaitID async_wait_id);
+ void SetAsyncWaitID(MojoAsyncWaitID async_wait_id);
- virtual void OnHandleReady(MojoResult result) MOJO_OVERRIDE;
+ static void OnHandleReady(void* closure, MojoResult result);
private:
Connector* owner_;
- BindingsSupport::AsyncWaitID async_wait_id_;
+ MojoAsyncWaitID async_wait_id_;
};
friend class Callback;
void OnHandleReady(Callback* callback, MojoResult result);
void WaitToReadMore();
void WaitToWriteMore();
+ void CallAsyncWait(MojoWaitFlags flags, Callback* callback);
+ void CallCancelWait(MojoAsyncWaitID async_wait_id);
void ReadMore();
void WriteMore();
void WriteOne(Message* message, bool* wait_to_write);
+ MojoAsyncWaiter* waiter_;
+
ScopedMessagePipeHandle message_pipe_;
MessageReceiver* incoming_receiver_;
MessageQueue write_queue_;

Powered by Google App Engine
This is Rietveld 408576698