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

Side by Side Diff: mojo/edk/system/async_waiter.h

Issue 1420533012: EDK: Make mojo::embedder::AsyncWait (etc.) take an std::function instead of a base::Callback. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/system/async_waiter.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_EDK_SYSTEM_ASYNC_WAITER_H_ 5 #ifndef MOJO_EDK_SYSTEM_ASYNC_WAITER_H_
6 #define MOJO_EDK_SYSTEM_ASYNC_WAITER_H_ 6 #define MOJO_EDK_SYSTEM_ASYNC_WAITER_H_
7 7
8 #include "base/callback.h" 8 #include <functional>
9
9 #include "mojo/edk/system/awakable.h" 10 #include "mojo/edk/system/awakable.h"
10 #include "mojo/public/c/system/types.h" 11 #include "mojo/public/c/system/types.h"
11 #include "mojo/public/cpp/system/macros.h" 12 #include "mojo/public/cpp/system/macros.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 namespace system { 15 namespace system {
15 16
16 // An |Awakable| implementation that just calls a given callback object. 17 // An |Awakable| implementation that just calls a given callback object.
17 class AsyncWaiter final : public Awakable { 18 class AsyncWaiter final : public Awakable {
18 public: 19 public:
19 using AwakeCallback = base::Callback<void(MojoResult)>; 20 using AwakeCallback = std::function<void(MojoResult)>;
20 21
21 // |callback| must satisfy the same contract as |Awakable::Awake()|. 22 // |callback| must satisfy the same contract as |Awakable::Awake()|.
22 explicit AsyncWaiter(const AwakeCallback& callback); 23 explicit AsyncWaiter(const AwakeCallback& callback);
23 ~AsyncWaiter() override; 24 ~AsyncWaiter() override;
24 25
25 private: 26 private:
26 // |Awakable| implementation: 27 // |Awakable| implementation:
27 bool Awake(MojoResult result, uintptr_t context) override; 28 bool Awake(MojoResult result, uintptr_t context) override;
28 29
29 AwakeCallback callback_; 30 AwakeCallback callback_;
30 31
31 MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiter); 32 MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiter);
32 }; 33 };
33 34
34 } // namespace system 35 } // namespace system
35 } // namespace mojo 36 } // namespace mojo
36 37
37 #endif // MOJO_EDK_SYSTEM_ASYNC_WAITER_H_ 38 #endif // MOJO_EDK_SYSTEM_ASYNC_WAITER_H_
OLDNEW
« no previous file with comments | « mojo/edk/embedder/embedder_unittest.cc ('k') | mojo/edk/system/async_waiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698