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

Unified Diff: mojo/edk/system/ports/port.h

Issue 1585493002: [mojo] Ports EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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/ports/port.h
diff --git a/mojo/edk/system/ports/port.h b/mojo/edk/system/ports/port.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e28e1294f8cc5242245d0428ca76e5ccde9cb2f
--- /dev/null
+++ b/mojo/edk/system/ports/port.h
@@ -0,0 +1,60 @@
+// Copyright 2016 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_PORTS_PORT_H_
+#define MOJO_EDK_SYSTEM_PORTS_PORT_H_
+
+#include <queue>
+#include <utility>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/system/ports/message_queue.h"
+#include "mojo/edk/system/ports/user_data.h"
+
+namespace mojo {
+namespace edk {
+namespace ports {
+
+class Port : public base::RefCountedThreadSafe<Port> {
+ public:
+ enum State {
+ kUninitialized,
+ kReceiving,
+ kBuffering,
+ kProxying,
+ kClosed
+ };
+
+ base::Lock lock;
+ State state;
+ NodeName peer_node_name;
+ PortName peer_port_name;
+ uint64_t next_sequence_num_to_send;
+ uint64_t last_sequence_num_to_receive;
+ MessageQueue message_queue;
+ scoped_ptr<std::pair<NodeName, ScopedMessage>> send_on_proxy_removal;
+ scoped_refptr<UserData> user_data;
+ bool remove_proxy_on_last_message;
+ bool peer_closed;
+
+ Port(uint64_t next_sequence_num_to_send,
+ uint64_t next_sequence_num_to_receive);
+
+ private:
+ friend class base::RefCountedThreadSafe<Port>;
+
+ ~Port();
+
+ DISALLOW_COPY_AND_ASSIGN(Port);
+};
+
+} // namespace ports
+} // namespace edk
+} // namespace mojo
+
+#endif // MOJO_EDK_SYSTEM_PORTS_PORT_H_

Powered by Google App Engine
This is Rietveld 408576698