| 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_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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // If there is no global attachment broker, makes a new | 36 // If there is no global attachment broker, makes a new |
| 37 // AttachmentBrokerPrivileged and sets it as the global attachment broker. | 37 // AttachmentBrokerPrivileged and sets it as the global attachment broker. |
| 38 // This method is thread safe. | 38 // This method is thread safe. |
| 39 #if defined(OS_MACOSX) && !defined(OS_IOS) | 39 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 40 static void CreateBrokerIfNeeded(base::PortProvider* provider); | 40 static void CreateBrokerIfNeeded(base::PortProvider* provider); |
| 41 #else | 41 #else |
| 42 static void CreateBrokerIfNeeded(); | 42 static void CreateBrokerIfNeeded(); |
| 43 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 43 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 44 | 44 |
| 45 // Similar to CreateBrokerIfNeeded(), but useful for single process unit tests |
| 46 // that don't need real attachment brokering, and don't want to deal with |
| 47 // setting up a fake PortProvider. |
| 48 static void CreateBrokerForSingleProcessTests(); |
| 49 |
| 45 // AttachmentBroker overrides. | 50 // AttachmentBroker overrides. |
| 46 void RegisterCommunicationChannel(Endpoint* endpoint) override; | 51 void RegisterCommunicationChannel(Endpoint* endpoint) override; |
| 47 void DeregisterCommunicationChannel(Endpoint* endpoint) override; | 52 void DeregisterCommunicationChannel(Endpoint* endpoint) override; |
| 48 | 53 |
| 49 protected: | 54 protected: |
| 50 // Returns the sender whose peer's process id is |id|. | 55 // Returns the sender whose peer's process id is |id|. |
| 51 // Returns nullptr if no sender is found. | 56 // Returns nullptr if no sender is found. |
| 52 // The lock returned by get_lock() must already be acquired before calling | 57 // The lock returned by get_lock() must already be acquired before calling |
| 53 // this method. The return value is only guaranteed to be valid while the lock | 58 // this method. The return value is only guaranteed to be valid while the lock |
| 54 // is held. | 59 // is held. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void LogError(UMAError error); | 104 void LogError(UMAError error); |
| 100 | 105 |
| 101 private: | 106 private: |
| 102 std::vector<Endpoint*> endpoints_; | 107 std::vector<Endpoint*> endpoints_; |
| 103 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); | 108 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); |
| 104 }; | 109 }; |
| 105 | 110 |
| 106 } // namespace IPC | 111 } // namespace IPC |
| 107 | 112 |
| 108 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 113 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
| OLD | NEW |