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

Side by Side Diff: mojo/public/bindings/lib/bindings_support.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_
6 #define MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_
7
8 #include "mojo/public/system/core_cpp.h"
9
10 namespace mojo {
11 class Buffer;
12
13 // An embedder of the bindings library MUST implement BindingsSupport and call
14 // BindingsSupport::Set prior to using the library.
15 class BindingsSupport {
16 public:
17 class AsyncWaitCallback {
18 public:
19 virtual ~AsyncWaitCallback() {}
20 virtual void OnHandleReady(MojoResult result) = 0;
21 };
22
23 typedef void* AsyncWaitID;
24
25 static void Set(BindingsSupport* support);
26 static BindingsSupport* Get();
27
28 // Get/set the current thread's Buffer pointer. SetCurrentBuffer returns the
29 // previously current Buffer.
30 virtual Buffer* GetCurrentBuffer() = 0;
31 virtual Buffer* SetCurrentBuffer(Buffer* buf) = 0;
32
33 // Asynchronously call MojoWait on a background thread, and pass the result
34 // of MojoWait to the given AsyncWaitCallback on the current thread. Returns
35 // an AsyncWaitID that can be used with CancelWait to stop waiting. This
36 // identifier becomes invalid once the callback runs.
37 virtual AsyncWaitID AsyncWait(const Handle& handle,
38 MojoWaitFlags flags,
39 AsyncWaitCallback* callback) = 0;
40
41 // Cancel an existing call to AsyncWait with the given AsyncWaitID. The
42 // corresponding AsyncWaitCallback's OnHandleReady method will not be called
43 // in this case.
44 virtual void CancelWait(AsyncWaitID id) = 0;
45
46 protected:
47 virtual ~BindingsSupport() {}
48 };
49
50 } // namespace mojo
51
52 #endif // MOJO_PUBLIC_BINDINGS_LIB_BINDINGS_SUPPORT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698