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

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

Issue 779503003: Extract Awakable from Waiter (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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/awakable.h
diff --git a/mojo/edk/system/awakable.h b/mojo/edk/system/awakable.h
new file mode 100644
index 0000000000000000000000000000000000000000..d0cc889fd38062f479f454b0898a3cf97e76bf9e
--- /dev/null
+++ b/mojo/edk/system/awakable.h
@@ -0,0 +1,29 @@
+// 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_AWAKABLE_H_
+#define MOJO_EDK_SYSTEM_AWAKABLE_H_
+
+#include <stdint.h>
+
+#include "mojo/public/c/system/types.h"
+
+namespace mojo {
+namespace system {
+
+// Awakable is a callback that is called by AwakableList.
viettrungluu 2014/12/03 21:18:13 nit: For consistency with the rest of the director
Hajime Morrita 2014/12/03 21:44:09 Done.
+// The Awake() callback must satisfy following contract:
viettrungluu 2014/12/03 21:18:13 Put this comment above |Awake()|. You can rewrite
Hajime Morrita 2014/12/03 21:44:09 Done.
+//
+// * As it is called from any thread, the callback must be thread-safe.
viettrungluu 2014/12/03 21:18:13 "it" -> "this", "the callback" -> "this"
Hajime Morrita 2014/12/03 21:44:09 Done.
+// * As it is called inside a lock, the callback must not call API that
viettrungluu 2014/12/03 21:18:13 "it" -> "this", "the callback" -> "this" More sig
Hajime Morrita 2014/12/03 21:44:09 That is right. "any lock" is unnecessarily restric
+// does lock any Mojo-related objects.
+class Awakable {
+ public:
+ virtual void Awake(MojoResult result, uintptr_t context) = 0;
+};
+
+} // namespace system
+} // namespace mojo
+
+#endif // MOJO_EDK_SYSTEM_AWAKABLE_H_

Powered by Google App Engine
This is Rietveld 408576698