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

Side by Side Diff: ipc/attachment_broker.h

Issue 1414503009: IPC: Remove unnecessary conversions of BrokerableAttachment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from tsepez. Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | ipc/attachment_broker_mac_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/memory/ref_counted.h"
10 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
11 #include "ipc/brokerable_attachment.h" 12 #include "ipc/brokerable_attachment.h"
12 #include "ipc/ipc_export.h" 13 #include "ipc/ipc_export.h"
13 #include "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
14 15
15 // If the platform has no attachments that need brokering, then it shouldn't 16 // If the platform has no attachments that need brokering, then it shouldn't
16 // compile any code that calls member functions of AttachmentBroker. This 17 // compile any code that calls member functions of AttachmentBroker. This
17 // prevents symbols only used by AttachmentBroker and its subclasses from 18 // prevents symbols only used by AttachmentBroker and its subclasses from
18 // making it into the binary. 19 // making it into the binary.
19 #if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS)) 20 #if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS))
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 static void SetGlobal(AttachmentBroker* broker); 59 static void SetGlobal(AttachmentBroker* broker);
59 static AttachmentBroker* GetGlobal(); 60 static AttachmentBroker* GetGlobal();
60 61
61 AttachmentBroker(); 62 AttachmentBroker();
62 ~AttachmentBroker() override; 63 ~AttachmentBroker() override;
63 64
64 // Sends |attachment| to |destination_process|. The implementation uses an 65 // Sends |attachment| to |destination_process|. The implementation uses an
65 // IPC::Channel to communicate with the broker process. This may be the same 66 // IPC::Channel to communicate with the broker process. This may be the same
66 // IPC::Channel that is requesting the brokering of an attachment. 67 // IPC::Channel that is requesting the brokering of an attachment.
67 // Returns true on success and false otherwise. 68 // Returns true on success and false otherwise.
68 virtual bool SendAttachmentToProcess(BrokerableAttachment* attachment, 69 virtual bool SendAttachmentToProcess(
69 base::ProcessId destination_process) = 0; 70 const scoped_refptr<BrokerableAttachment>& attachment,
71 base::ProcessId destination_process) = 0;
70 72
71 // Returns whether the attachment was available. If the attachment was 73 // Returns whether the attachment was available. If the attachment was
72 // available, populates the output parameter |attachment|. 74 // available, populates the output parameter |attachment|.
73 bool GetAttachmentWithId(BrokerableAttachment::AttachmentId id, 75 bool GetAttachmentWithId(BrokerableAttachment::AttachmentId id,
74 scoped_refptr<BrokerableAttachment>* attachment); 76 scoped_refptr<BrokerableAttachment>* attachment);
75 77
76 // Any given observer should only ever add itself once to the observer list. 78 // Any given observer should only ever add itself once to the observer list.
77 void AddObserver(Observer* observer); 79 void AddObserver(Observer* observer);
78 void RemoveObserver(Observer* observer); 80 void RemoveObserver(Observer* observer);
79 81
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // better performance. 116 // better performance.
115 AttachmentVector attachments_; 117 AttachmentVector attachments_;
116 118
117 std::vector<Observer*> observers_; 119 std::vector<Observer*> observers_;
118 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); 120 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker);
119 }; 121 };
120 122
121 } // namespace IPC 123 } // namespace IPC
122 124
123 #endif // IPC_ATTACHMENT_BROKER_H_ 125 #endif // IPC_ATTACHMENT_BROKER_H_
OLDNEW
« no previous file with comments | « no previous file | ipc/attachment_broker_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698