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 "ipc/attachment_broker.h" | 10 #include "ipc/attachment_broker.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // process, these channels must be registered and deregistered with the | 29 // process, these channels must be registered and deregistered with the |
30 // Attachment Broker as they are created and destroyed. | 30 // Attachment Broker as they are created and destroyed. |
31 void RegisterCommunicationChannel(Endpoint* endpoint); | 31 void RegisterCommunicationChannel(Endpoint* endpoint); |
32 void DeregisterCommunicationChannel(Endpoint* endpoint); | 32 void DeregisterCommunicationChannel(Endpoint* endpoint); |
33 | 33 |
34 protected: | 34 protected: |
35 // Returns the sender whose peer's process id is |id|. | 35 // Returns the sender whose peer's process id is |id|. |
36 // Returns nullptr if no sender is found. | 36 // Returns nullptr if no sender is found. |
37 Sender* GetSenderWithProcessId(base::ProcessId id); | 37 Sender* GetSenderWithProcessId(base::ProcessId id); |
38 | 38 |
| 39 // Errors that can be reported by subclasses. |
| 40 // These match tools/metrics/histograms.xml. |
| 41 // This enum is append-only. |
| 42 enum UMAError { |
| 43 // The brokerable attachment had a valid destination. This is the success |
| 44 // case. |
| 45 DESTINATION_FOUND = 0, |
| 46 // The brokerable attachment had a destination, but the broker did not have |
| 47 // a channel of communication with that process. |
| 48 DESTINATION_NOT_FOUND = 1, |
| 49 // The brokerable attachment did not have a destination process. |
| 50 NO_DESTINATION = 2, |
| 51 ERROR_MAX |
| 52 }; |
| 53 |
| 54 // Emits an UMA metric. |
| 55 void LogError(UMAError error); |
| 56 |
39 private: | 57 private: |
40 std::vector<Endpoint*> endpoints_; | 58 std::vector<Endpoint*> endpoints_; |
41 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); | 59 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); |
42 }; | 60 }; |
43 | 61 |
44 } // namespace IPC | 62 } // namespace IPC |
45 | 63 |
46 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 64 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
OLD | NEW |