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