OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IPC_IPC_ENDPOINT_H_ |
| 6 #define IPC_IPC_ENDPOINT_H_ |
| 7 |
| 8 #include "base/process/process_handle.h" |
| 9 #include "ipc/ipc_export.h" |
| 10 #include "ipc/ipc_sender.h" |
| 11 |
| 12 namespace IPC { |
| 13 |
| 14 // An Endpoint is an abstract base class whose interface provides sending |
| 15 // functionality, and some receiving functionality. It mostly exists to provide |
| 16 // a common interface to Channel and ProxyChannel. |
| 17 class IPC_EXPORT Endpoint : public Sender { |
| 18 public: |
| 19 Endpoint(); |
| 20 ~Endpoint() override {} |
| 21 |
| 22 // Get the process ID for the connected peer. |
| 23 // |
| 24 // Returns base::kNullProcessId if the peer is not connected yet. Watch out |
| 25 // for race conditions. You can easily get a channel to another process, but |
| 26 // if your process has not yet processed the "hello" message from the remote |
| 27 // side, this will fail. You should either make sure calling this is either |
| 28 // in response to a message from the remote side (which guarantees that it's |
| 29 // been connected), or you wait for the "connected" notification on the |
| 30 // listener. |
| 31 virtual base::ProcessId GetPeerPID() const = 0; |
| 32 |
| 33 // A callback that indicates that is_attachment_broker_endpoint() has been |
| 34 // changed. |
| 35 virtual void OnSetAttachmentBrokerEndpoint(){}; |
| 36 |
| 37 // Whether this channel is used as an endpoint for sending and receiving |
| 38 // brokerable attachment messages to/from the broker process. |
| 39 void SetAttachmentBrokerEndpoint(bool is_endpoint); |
| 40 |
| 41 protected: |
| 42 bool is_attachment_broker_endpoint() { return attachment_broker_endpoint_; } |
| 43 |
| 44 private: |
| 45 // Whether this channel is used as an endpoint for sending and receiving |
| 46 // brokerable attachment messages to/from the broker process. |
| 47 bool attachment_broker_endpoint_; |
| 48 }; |
| 49 |
| 50 } // namespace IPC |
| 51 |
| 52 #endif // IPC_IPC_ENDPOINT_H_ |
OLD | NEW |