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

Side by Side Diff: mojo/public/bindings/lib/bindings_support.h

Issue 69283002: Revert "Mojo: Add BindingsSupportImpl on top of HandleWatcher" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/public/bindings/lib/connector.h » ('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_BINDINGS_LIB_BINDINGS_SUPPORT_H_ 5 #ifndef MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_
6 #define MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_ 6 #define MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_
7 7
8 #include "mojo/public/system/core.h" 8 #include "mojo/public/system/core.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 11
12 // An embedder of the bindings library MUST implement BindingsSupport and call 12 // An embedder of the bindings library MUST implement BindingsSupport and call
13 // BindingsSupport::Set prior to using the library. 13 // BindingsSupport::Set prior to using the library.
14 class BindingsSupport { 14 class BindingsSupport {
15 public: 15 public:
16 class AsyncWaitCallback { 16 class AsyncWaitCallback {
17 public: 17 public:
18 virtual ~AsyncWaitCallback() {}
19 virtual void OnHandleReady(MojoResult result) = 0; 18 virtual void OnHandleReady(MojoResult result) = 0;
20 }; 19 };
21 20
22 typedef void* AsyncWaitID; 21 // Asynchronously call MojoWait on a background thread, and return the result
22 // to the current thread via the given AsyncWaitCallback.
23 virtual bool AsyncWait(Handle handle,
24 MojoWaitFlags flags,
25 MojoDeadline deadline,
26 AsyncWaitCallback* callback) = 0;
27
28 // Cancel an existing call to AsyncWait with the given callback. The
29 // callback's OnHandleReady method should not be called in this case.
30 virtual void CancelWait(AsyncWaitCallback* callback) = 0;
23 31
24 static void Set(BindingsSupport* support); 32 static void Set(BindingsSupport* support);
25 static BindingsSupport* Get(); 33 static BindingsSupport* Get();
26
27 // Asynchronously call MojoWait on a background thread, and pass the result
28 // of MojoWait to the given AsyncWaitCallback on the current thread. Returns
29 // an AsyncWaitID that can be used with CancelWait to stop waiting. This
30 // identifier becomes invalid once the callback runs.
31 virtual AsyncWaitID AsyncWait(Handle handle,
32 MojoWaitFlags flags,
33 AsyncWaitCallback* callback) = 0;
34
35 // Cancel an existing call to AsyncWait with the given AsyncWaitID. The
36 // corresponding AsyncWaitCallback's OnHandleReady method will not be called
37 // in this case.
38 virtual void CancelWait(AsyncWaitID id) = 0;
39
40 protected:
41 virtual ~BindingsSupport() {}
42 }; 34 };
43 35
44 } // namespace mojo 36 } // namespace mojo
45 37
46 #endif // MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_ 38 #endif // MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_
OLDNEW
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/public/bindings/lib/connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698