| 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 <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // The lock returned by get_lock() must already be acquired before calling | 64 // The lock returned by get_lock() must already be acquired before calling |
| 65 // this method. The return value is only guaranteed to be valid while the lock | 65 // this method. The return value is only guaranteed to be valid while the lock |
| 66 // is held. | 66 // is held. |
| 67 EndpointRunnerPair GetSenderWithProcessId(base::ProcessId id); | 67 EndpointRunnerPair GetSenderWithProcessId(base::ProcessId id); |
| 68 | 68 |
| 69 // Sends a message to the endpoint, dispatching onto another thread if | 69 // Sends a message to the endpoint, dispatching onto another thread if |
| 70 // necessary. | 70 // necessary. |
| 71 void SendMessageToEndpoint(EndpointRunnerPair pair, Message* message); | 71 void SendMessageToEndpoint(EndpointRunnerPair pair, Message* message); |
| 72 | 72 |
| 73 // Errors that can be reported by subclasses. | 73 // Errors that can be reported by subclasses. |
| 74 // These match tools/metrics/histograms.xml. | 74 // These match tools/metrics/histograms/histograms.xml. |
| 75 // This enum is append-only. | 75 // This enum is append-only. |
| 76 enum UMAError { | 76 enum UMAError { |
| 77 // The brokerable attachment had a valid destination. This is the success | 77 // The brokerable attachment had a valid destination. This is the success |
| 78 // case. | 78 // case. |
| 79 DESTINATION_FOUND = 0, | 79 DESTINATION_FOUND = 0, |
| 80 // The brokerable attachment had a destination, but the broker did not have | 80 // The brokerable attachment had a destination, but the broker did not have |
| 81 // a channel of communication with that process. | 81 // a channel of communication with that process. |
| 82 DESTINATION_NOT_FOUND = 1, | 82 DESTINATION_NOT_FOUND = 1, |
| 83 // The brokerable attachment did not have a destination process. | 83 // The brokerable attachment did not have a destination process. |
| 84 NO_DESTINATION = 2, | 84 NO_DESTINATION = 2, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 101 // Couldn't extract a right from the source. | 101 // Couldn't extract a right from the source. |
| 102 ERROR_EXTRACT_SOURCE_RIGHT = 11, | 102 ERROR_EXTRACT_SOURCE_RIGHT = 11, |
| 103 // The broker did not have a channel of communication with the source | 103 // The broker did not have a channel of communication with the source |
| 104 // process. | 104 // process. |
| 105 ERROR_SOURCE_NOT_FOUND = 12, | 105 ERROR_SOURCE_NOT_FOUND = 12, |
| 106 // The broker could not open the source or destination process with extra | 106 // The broker could not open the source or destination process with extra |
| 107 // privileges. | 107 // privileges. |
| 108 ERROR_COULD_NOT_OPEN_SOURCE_OR_DEST = 13, | 108 ERROR_COULD_NOT_OPEN_SOURCE_OR_DEST = 13, |
| 109 // The broker was asked to transfer a HANDLE with invalid permissions. | 109 // The broker was asked to transfer a HANDLE with invalid permissions. |
| 110 ERROR_INVALID_PERMISSIONS = 14, | 110 ERROR_INVALID_PERMISSIONS = 14, |
| 111 // The broker was not immediately able to send an attachment. |
| 112 DELAYED = 15, |
| 113 // The broker successfully sent a delayed attachment. |
| 114 DELAYED_SEND = 16, |
| 111 ERROR_MAX | 115 ERROR_MAX |
| 112 }; | 116 }; |
| 113 | 117 |
| 114 // Emits an UMA metric. | 118 // Emits an UMA metric. |
| 115 void LogError(UMAError error); | 119 void LogError(UMAError error); |
| 116 | 120 |
| 117 private: | 121 private: |
| 118 // A vector of Endpoints, and the SingleThreadTaskRunner that should be used | 122 // A vector of Endpoints, and the SingleThreadTaskRunner that should be used |
| 119 // to invoke Send() on each Endpoint. | 123 // to invoke Send() on each Endpoint. |
| 120 std::vector<EndpointRunnerPair> endpoints_; | 124 std::vector<EndpointRunnerPair> endpoints_; |
| 121 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); | 125 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); |
| 122 }; | 126 }; |
| 123 | 127 |
| 124 } // namespace IPC | 128 } // namespace IPC |
| 125 | 129 |
| 126 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 130 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
| OLD | NEW |