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

Side by Side Diff: ipc/attachment_broker_privileged.h

Issue 1414603003: ipc: Move AttachmentBrokerPrivileged singleton logic into ipc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
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_PRIVILEGED_H_ 5 #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_H_
6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ 6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ipc/attachment_broker.h" 11 #include "ipc/attachment_broker.h"
12 #include "ipc/ipc_export.h" 12 #include "ipc/ipc_export.h"
13 13
14 namespace IPC { 14 namespace IPC {
15 15
16 class Endpoint; 16 class Endpoint;
17 class Sender; 17 class Sender;
18 18
19 // This abstract subclass of AttachmentBroker is intended for use in a 19 // This abstract subclass of AttachmentBroker is intended for use in a
20 // privileged process . When unprivileged processes want to send attachments, 20 // privileged process . When unprivileged processes want to send attachments,
21 // the attachments get routed through the privileged process, and more 21 // the attachments get routed through the privileged process, and more
22 // specifically, an instance of this class. 22 // specifically, an instance of this class.
23 class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker { 23 class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker {
24 public: 24 public:
25 AttachmentBrokerPrivileged(); 25 AttachmentBrokerPrivileged();
26 ~AttachmentBrokerPrivileged() override; 26 ~AttachmentBrokerPrivileged() override;
27 27
28 // On platforms that support attachment brokering, returns a new instance of 28 // If there is no global attachment broker, makes a new
29 // a platform-specific attachment broker. Otherwise returns |nullptr|. 29 // AttachmentBrokerPrivileged and sets it as the global attachment broker.
30 // The caller takes ownership of the newly created instance, and is 30 // This method is thread safe.
31 // responsible for ensuring that the attachment broker lives longer than 31 static void CreateBrokerIfNeeded();
32 // every IPC::Channel. The new instance automatically registers itself as the
33 // global attachment broker.
34 static scoped_ptr<AttachmentBrokerPrivileged> CreateBroker();
35 32
36 // AttachmentBroker overrides. 33 // AttachmentBroker overrides.
37 void RegisterCommunicationChannel(Endpoint* endpoint) override; 34 void RegisterCommunicationChannel(Endpoint* endpoint) override;
38 void DeregisterCommunicationChannel(Endpoint* endpoint) override; 35 void DeregisterCommunicationChannel(Endpoint* endpoint) override;
39 36
40 protected: 37 protected:
41 // Returns the sender whose peer's process id is |id|. 38 // Returns the sender whose peer's process id is |id|.
42 // Returns nullptr if no sender is found. 39 // Returns nullptr if no sender is found.
43 Sender* GetSenderWithProcessId(base::ProcessId id); 40 Sender* GetSenderWithProcessId(base::ProcessId id);
44 41
(...skipping 16 matching lines...) Expand all
61 void LogError(UMAError error); 58 void LogError(UMAError error);
62 59
63 private: 60 private:
64 std::vector<Endpoint*> endpoints_; 61 std::vector<Endpoint*> endpoints_;
65 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); 62 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged);
66 }; 63 };
67 64
68 } // namespace IPC 65 } // namespace IPC
69 66
70 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ 67 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698