summaryrefslogtreecommitdiffstats
path: root/mojo/edk/system/awakable.h
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2015-10-02 14:01:28 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-02 21:02:13 +0000
commit76bcf0c21e332c08ee7a1601d0c878d1c75541a0 (patch)
tree9a1070172b98a5c0775967858a07d55585751839 /mojo/edk/system/awakable.h
parentbe81c48e3a52a050a6d07d0eb558a41c02594e6e (diff)
downloadchromium_src-76bcf0c21e332c08ee7a1601d0c878d1c75541a0.zip
chromium_src-76bcf0c21e332c08ee7a1601d0c878d1c75541a0.tar.gz
chromium_src-76bcf0c21e332c08ee7a1601d0c878d1c75541a0.tar.bz2
Add a Mojo EDK for Chrome that uses one OS pipe per message pipe.
TODOs in future cls: -POSIX -use shared memory for MessagePipeDispatcher serialization -work in Windows sandbox (using master.mojom which is implemented but not hooked up in this change) -XP BUG=478251 NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1350023003 Cr-Commit-Position: refs/heads/master@{#352123}
Diffstat (limited to 'mojo/edk/system/awakable.h')
-rw-r--r--mojo/edk/system/awakable.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/mojo/edk/system/awakable.h b/mojo/edk/system/awakable.h
new file mode 100644
index 0000000..2cb10f5
--- /dev/null
+++ b/mojo/edk/system/awakable.h
@@ -0,0 +1,34 @@
+// 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/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+
+namespace mojo {
+namespace edk {
+
+// An interface that may be waited on |AwakableList|.
+class MOJO_SYSTEM_IMPL_EXPORT Awakable {
+ public:
+ // |Awake()| must satisfy the following contract:
+ // * As this is called from any thread, this must be thread-safe.
+ // * As this is called inside a lock, this must not call anything that takes
+ // "non-terminal" locks, i.e., those which are always safe to take.
+ // This should return false if this must not be called again for the same
+ // reason (e.g., for the same call to |AwakableList::Add()|).
+ virtual bool Awake(MojoResult result, uintptr_t context) = 0;
+
+ protected:
+ Awakable() {}
+};
+
+} // namespace edk
+} // namespace mojo
+
+#endif // MOJO_EDK_SYSTEM_AWAKABLE_H_