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

Unified Diff: ipc/ipc_endpoint.h

Issue 1270683002: ipc: Make a common subclass for Channel and ProxyChannel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More rebase errors. Created 5 years, 4 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
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_endpoint.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_endpoint.h
diff --git a/ipc/ipc_endpoint.h b/ipc/ipc_endpoint.h
new file mode 100644
index 0000000000000000000000000000000000000000..2ace1fe999c946ace33079e70747adb2d736623e
--- /dev/null
+++ b/ipc/ipc_endpoint.h
@@ -0,0 +1,52 @@
+// Copyright 2015 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 IPC_IPC_ENDPOINT_H_
+#define IPC_IPC_ENDPOINT_H_
+
+#include "base/process/process_handle.h"
+#include "ipc/ipc_export.h"
+#include "ipc/ipc_sender.h"
+
+namespace IPC {
+
+// An Endpoint is an abstract base class whose interface provides sending
+// functionality, and some receiving functionality. It mostly exists to provide
+// a common interface to Channel and ProxyChannel.
+class IPC_EXPORT Endpoint : public Sender {
+ public:
+ Endpoint();
+ ~Endpoint() override {}
+
+ // Get the process ID for the connected peer.
+ //
+ // Returns base::kNullProcessId if the peer is not connected yet. Watch out
+ // for race conditions. You can easily get a channel to another process, but
+ // if your process has not yet processed the "hello" message from the remote
+ // side, this will fail. You should either make sure calling this is either
+ // in response to a message from the remote side (which guarantees that it's
+ // been connected), or you wait for the "connected" notification on the
+ // listener.
+ virtual base::ProcessId GetPeerPID() const = 0;
+
+ // A callback that indicates that is_attachment_broker_endpoint() has been
+ // changed.
+ virtual void OnSetAttachmentBrokerEndpoint(){};
+
+ // Whether this channel is used as an endpoint for sending and receiving
+ // brokerable attachment messages to/from the broker process.
+ void SetAttachmentBrokerEndpoint(bool is_endpoint);
+
+ protected:
+ bool is_attachment_broker_endpoint() { return attachment_broker_endpoint_; }
+
+ private:
+ // Whether this channel is used as an endpoint for sending and receiving
+ // brokerable attachment messages to/from the broker process.
+ bool attachment_broker_endpoint_;
+};
+
+} // namespace IPC
+
+#endif // IPC_IPC_ENDPOINT_H_
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_endpoint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698