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 EXTENSIONS_BROWSER_BAD_MESSAGE_H_ | 5 #ifndef EXTENSIONS_BROWSER_BAD_MESSAGE_H_ |
6 #define EXTENSIONS_BROWSER_BAD_MESSAGE_H_ | 6 #define EXTENSIONS_BROWSER_BAD_MESSAGE_H_ |
7 | 7 |
8 namespace content { | 8 namespace content { |
9 class RenderProcessHost; | 9 class RenderProcessHost; |
10 } | 10 } |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 namespace bad_message { | 13 namespace bad_message { |
14 | 14 |
15 // The browser process often chooses to terminate a renderer if it receives | 15 // The browser process often chooses to terminate a renderer if it receives |
16 // a bad IPC message. The reasons are tracked for metrics. | 16 // a bad IPC message. The reasons are tracked for metrics. |
17 // | 17 // |
18 // See also content/browser/bad_message.h. | 18 // See also content/browser/bad_message.h. |
19 // | 19 // |
20 // NOTE: Do not remove or reorder elements in this list. Add new entries at the | 20 // NOTE: Do not remove or reorder elements in this list. Add new entries at the |
21 // end. Items may be renamed but do not change the values. We rely on the enum | 21 // end. Items may be renamed but do not change the values. We rely on the enum |
22 // values in histograms. Also update histograms.xml with any new values by | 22 // values in histograms. Also update histograms.xml with any new values by |
23 // running: | 23 // running: |
24 // python tools/metrics/histograms/update_bad_message_reasons.py | 24 // python tools/metrics/histograms/update_bad_message_reasons.py |
25 enum BadMessageReason { | 25 enum BadMessageReason { |
26 EOG_BAD_ORIGIN = 0, | 26 EOG_BAD_ORIGIN = 0, |
27 EVG_BAD_ORIGIN = 1, | 27 EVG_BAD_ORIGIN = 1, |
28 BH_BLOB_NOT_OWNED = 2, | 28 BH_BLOB_NOT_OWNED = 2, |
29 EH_BAD_EVENT_ID = 3, | 29 EH_BAD_EVENT_ID = 3, |
| 30 AVG_BAD_INST_ID = 4, |
| 31 AVG_BAD_EXT_ID = 5, |
| 32 AVG_NULL_AVG = 6, |
30 // Please add new elements here. The naming convention is abbreviated class | 33 // Please add new elements here. The naming convention is abbreviated class |
31 // name (e.g. ExtensionHost becomes EH) plus a unique description of the | 34 // name (e.g. ExtensionHost becomes EH) plus a unique description of the |
32 // reason. | 35 // reason. |
33 BAD_MESSAGE_MAX | 36 BAD_MESSAGE_MAX |
34 }; | 37 }; |
35 | 38 |
36 // Called when the browser receives a bad IPC message from an extension process. | 39 // Called when the browser receives a bad IPC message from an extension process. |
37 // Logs the event, records a histogram metric for the |reason|, and terminates | 40 // Logs the event, records a histogram metric for the |reason|, and terminates |
38 // the process for |host|. | 41 // the process for |host|. |
39 void ReceivedBadMessage(content::RenderProcessHost* host, | 42 void ReceivedBadMessage(content::RenderProcessHost* host, |
40 BadMessageReason reason); | 43 BadMessageReason reason); |
41 | 44 |
42 } // namespace bad_message | 45 } // namespace bad_message |
43 } // namespace extensions | 46 } // namespace extensions |
44 | 47 |
45 #endif // EXTENSIONS_BROWSER_BAD_MESSAGE_H_ | 48 #endif // EXTENSIONS_BROWSER_BAD_MESSAGE_H_ |
OLD | NEW |