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

Unified Diff: mojo/edk/system/async_waiter.h

Issue 798993003: Add embedder::AsyncWait() (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Updated Created 6 years 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/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..316ac811d42a233bbce2d68a57d2742578953353
--- /dev/null
+++ b/mojo/edk/system/async_waiter.h
@@ -0,0 +1,38 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
viettrungluu 2014/12/12 23:03:52 nit: 2014
gmorrita 2014/12/12 23:08:49 Done.
+// 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 "mojo/edk/system/awakable.h"
+#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 final : public Awakable {
+ public:
+ typedef base::Callback<void(MojoResult)> AwakeCallback;
+
+ // |callback| must satisfy the same contract as |Awakable::Awake()|.
+ explicit AsyncWaiter(AwakeCallback callback);
+ virtual ~AsyncWaiter();
+
+ 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_

Powered by Google App Engine
This is Rietveld 408576698