OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IPC_ATTACHMENT_BROKER_H_ | 5 #ifndef IPC_ATTACHMENT_BROKER_H_ |
6 #define IPC_ATTACHMENT_BROKER_H_ | 6 #define IPC_ATTACHMENT_BROKER_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 class IPC_EXPORT AttachmentBroker : public Listener { | 43 class IPC_EXPORT AttachmentBroker : public Listener { |
44 public: | 44 public: |
45 // A standard observer interface that allows consumers of the AttachmentBroker | 45 // A standard observer interface that allows consumers of the AttachmentBroker |
46 // to be notified when a new attachment has been received. | 46 // to be notified when a new attachment has been received. |
47 class Observer { | 47 class Observer { |
48 public: | 48 public: |
49 virtual void ReceivedBrokerableAttachmentWithId( | 49 virtual void ReceivedBrokerableAttachmentWithId( |
50 const BrokerableAttachment::AttachmentId& id) = 0; | 50 const BrokerableAttachment::AttachmentId& id) = 0; |
51 }; | 51 }; |
52 | 52 |
53 // Each process has at most one attachment broker. The process is responsible | |
54 // for ensuring that |broker| stays alive for the life time of the process. | |
Tom Sepez
2015/09/11 15:58:30
nit: lifetime
erikchen
2015/09/11 20:16:02
I updated the comment to say:
"""
Each process has
| |
55 static void SetGlobal(AttachmentBroker* broker); | |
56 static AttachmentBroker* GetGlobal(); | |
57 | |
53 AttachmentBroker(); | 58 AttachmentBroker(); |
54 ~AttachmentBroker() override; | 59 ~AttachmentBroker() override; |
55 | 60 |
56 // Sends |attachment| to |destination_process|. The implementation uses an | 61 // Sends |attachment| to |destination_process|. The implementation uses an |
57 // IPC::Channel to communicate with the broker process. This may be the same | 62 // IPC::Channel to communicate with the broker process. This may be the same |
58 // IPC::Channel that is requesting the brokering of an attachment. | 63 // IPC::Channel that is requesting the brokering of an attachment. |
59 // Returns true on success and false otherwise. | 64 // Returns true on success and false otherwise. |
60 virtual bool SendAttachmentToProcess(const BrokerableAttachment* attachment, | 65 virtual bool SendAttachmentToProcess(const BrokerableAttachment* attachment, |
61 base::ProcessId destination_process) = 0; | 66 base::ProcessId destination_process) = 0; |
62 | 67 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 // better performance. | 102 // better performance. |
98 AttachmentVector attachments_; | 103 AttachmentVector attachments_; |
99 | 104 |
100 std::vector<Observer*> observers_; | 105 std::vector<Observer*> observers_; |
101 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); | 106 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); |
102 }; | 107 }; |
103 | 108 |
104 } // namespace IPC | 109 } // namespace IPC |
105 | 110 |
106 #endif // IPC_ATTACHMENT_BROKER_H_ | 111 #endif // IPC_ATTACHMENT_BROKER_H_ |
OLD | NEW |