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

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

Issue 799113004: Update mojo sdk to rev 59145288bae55b0fce4276b017df6a1117bcf00f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add mojo's ply to checklicenses whitelist 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
« no previous file with comments | « mojo/edk/system/channel_unittest.cc ('k') | mojo/edk/system/incoming_endpoint.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/incoming_endpoint.h
diff --git a/mojo/edk/system/incoming_endpoint.h b/mojo/edk/system/incoming_endpoint.h
new file mode 100644
index 0000000000000000000000000000000000000000..cee34f000e3756b6b6b1db453d8eed7a8e54d5b7
--- /dev/null
+++ b/mojo/edk/system/incoming_endpoint.h
@@ -0,0 +1,54 @@
+// Copyright 2014 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_INCOMING_ENDPOINT_H_
+#define MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_
+
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/system/channel_endpoint_client.h"
+#include "mojo/edk/system/message_in_transit_queue.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace system {
+
+class ChannelEndpoint;
+class MessagePipe;
+
+// This is a simple |ChannelEndpointClient| that only receives messages. It's
+// used for endpoints that are "received" by |Channel|, but not yet turned into
+// |MessagePipe|s.
+class MOJO_SYSTEM_IMPL_EXPORT IncomingEndpoint : public ChannelEndpointClient {
+ public:
+ IncomingEndpoint();
+
+ // Must be called before any other method.
+ scoped_refptr<ChannelEndpoint> Init();
+
+ scoped_refptr<MessagePipe> ConvertToMessagePipe();
+
+ // Must be called before destroying this object if |ConvertToMessagePipe()|
+ // wasn't called (but |Init()| was).
+ void Close();
+
+ // |ChannelEndpointClient| methods:
+ bool OnReadMessage(unsigned port, MessageInTransit* message) override;
+ void OnDetachFromChannel(unsigned port) override;
+
+ private:
+ virtual ~IncomingEndpoint();
+
+ base::Lock lock_; // Protects the following members.
+ scoped_refptr<ChannelEndpoint> endpoint_;
+ MessageInTransitQueue message_queue_;
+
+ DISALLOW_COPY_AND_ASSIGN(IncomingEndpoint);
+};
+
+} // namespace system
+} // namespace mojo
+
+#endif // MOJO_EDK_SYSTEM_INCOMING_ENDPOINT_H_
« no previous file with comments | « mojo/edk/system/channel_unittest.cc ('k') | mojo/edk/system/incoming_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698