diff options
author | Hidehiko Abe <hidehiko@google.com> | 2018-04-23 19:57:41 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-04-23 19:57:41 -0700 |
commit | 0ab20ac2283987e63b0e7c1318db2a5cf7c668d2 (patch) | |
tree | bd2d04362f66c36d4279f7a9735ba21ea3a2a021 /mojo/edk/system/ports/port.h | |
parent | e389a13ad8648d89ac670ca06f68c9b32976351c (diff) | |
parent | b268b43ac6fdbc4f3a2ed1429b99ace424906090 (diff) | |
download | libchrome-0ab20ac2283987e63b0e7c1318db2a5cf7c668d2.tar.gz |
Migrate libmojo repository into libchrome, part 2.
am: b268b43ac6
Change-Id: I7b2c3d7cfed03673c33eb497be20e238bd0aac33
Diffstat (limited to 'mojo/edk/system/ports/port.h')
-rw-r--r-- | mojo/edk/system/ports/port.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/mojo/edk/system/ports/port.h b/mojo/edk/system/ports/port.h new file mode 100644 index 0000000000..ea53d43b5f --- /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 <memory> +#include <queue> +#include <utility> +#include <vector> + +#include "base/macros.h" +#include "base/memory/ref_counted.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; + std::unique_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_ |