Chromium Code Reviews| Index: mojo/edk/system/async_waiter.h |
| diff --git a/mojo/edk/system/async_waiter.h b/mojo/edk/system/async_waiter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1cfb9f03c97c775dbc45a63ba352eb89bf7beaa5 |
| --- /dev/null |
| +++ b/mojo/edk/system/async_waiter.h |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_EDK_SYSTEM_ASYNC_WAITER_H_ |
| +#define MOJO_EDK_SYSTEM_ASYNC_WAITER_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
|
viettrungluu
2014/12/12 21:39:30
Don't need this include.
gmorrita
2014/12/12 22:56:27
Done.
|
| +#include "mojo/edk/system/awakable.h" |
| +#include "mojo/edk/system/dispatcher.h" |
|
viettrungluu
2014/12/12 21:39:31
Nor this.
gmorrita
2014/12/12 22:56:27
Done.
|
| +#include "mojo/edk/system/handle_signals_state.h" |
|
viettrungluu
2014/12/12 21:39:31
"
gmorrita
2014/12/12 22:56:27
Done.
|
| +#include "mojo/edk/system/system_impl_export.h" |
| +#include "mojo/public/c/system/types.h" |
| + |
| +namespace mojo { |
| +namespace system { |
| + |
| +// An |Awakable| implementation that just calls a given callback object. |
| +class MOJO_SYSTEM_IMPL_EXPORT AsyncWaiter : public Awakable { |
| + public: |
| + typedef base::Callback<void(MojoResult)> AwakeCallback; |
| + |
| + // |callback| must satisfy the same contract as |Awakable::Awake()|. |
| + AsyncWaiter(AwakeCallback callback); |
|
viettrungluu
2014/12/12 21:39:31
explicit
gmorrita
2014/12/12 22:56:28
Done.
|
| + virtual ~AsyncWaiter(); |
|
viettrungluu
2014/12/12 21:39:31
This doesn't need to be virtual. (Possibly, you sh
gmorrita
2014/12/12 22:56:27
Our clang plugin complains about this :-/
|
| + |
| + private: |
| + // |Awakable| implementation: |
| + bool Awake(MojoResult result, uintptr_t context) override; |
| + |
| + AwakeCallback callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AsyncWaiter); |
| +}; |
| + |
| +} // namespace system |
| +} // namespace mojo |
| + |
| +#endif // MOJO_EDK_SYSTEM_ASYNC_WAITER_H_ |