Chromium Code Reviews| 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 |
|
Charlie Reis
2016/08/10 21:09:50
We haven't started using INVALID_ORIGIN yet as lon
| |
| 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. | 22 // values in histograms. |
| 23 enum BadMessageReason { | 23 enum BadMessageReason { |
| 24 EOG_BAD_ORIGIN = 0, | 24 EOG_BAD_ORIGIN = 0, |
| 25 EVG_BAD_ORIGIN = 1, | 25 EVG_BAD_ORIGIN = 1, |
| 26 BH_BLOB_NOT_OWNED = 2, | 26 BH_BLOB_NOT_OWNED = 2, |
| 27 EH_BAD_EVENT_ID = 3, | 27 EH_BAD_EVENT_ID = 3, |
| 28 AVG_BAD_INST_ID = 4, | 28 AVG_BAD_INST_ID = 4, |
| 29 AVG_BAD_EXT_ID = 5, | 29 AVG_BAD_EXT_ID = 5, |
| 30 AVG_NULL_AVG = 6, | 30 AVG_NULL_AVG = 6, |
| 31 INVALID_ORIGIN = 7, | |
| 32 // Please add new elements here. The naming convention is abbreviated class | 31 // Please add new elements here. The naming convention is abbreviated class |
| 33 // name (e.g. ExtensionHost becomes EH) plus a unique description of the | 32 // name (e.g. ExtensionHost becomes EH) plus a unique description of the |
| 34 // reason. After making changes, you MUST update histograms.xml by running: | 33 // reason. After making changes, you MUST update histograms.xml by running: |
| 35 // "python tools/metrics/histograms/update_bad_message_reasons.py" | 34 // "python tools/metrics/histograms/update_bad_message_reasons.py" |
| 36 BAD_MESSAGE_MAX | 35 BAD_MESSAGE_MAX |
| 37 }; | 36 }; |
| 38 | 37 |
| 39 // Called when the browser receives a bad IPC message from an extension process. | 38 // Called when the browser receives a bad IPC message from an extension process. |
| 40 // Logs the event, records a histogram metric for the |reason|, and terminates | 39 // Logs the event, records a histogram metric for the |reason|, and terminates |
| 41 // the process for |host|. | 40 // the process for |host|. |
| 42 void ReceivedBadMessage(content::RenderProcessHost* host, | 41 void ReceivedBadMessage(content::RenderProcessHost* host, |
| 43 BadMessageReason reason); | 42 BadMessageReason reason); |
| 44 | 43 |
| 45 } // namespace bad_message | 44 } // namespace bad_message |
| 46 } // namespace extensions | 45 } // namespace extensions |
| 47 | 46 |
| 48 #endif // EXTENSIONS_BROWSER_BAD_MESSAGE_H_ | 47 #endif // EXTENSIONS_BROWSER_BAD_MESSAGE_H_ |
| OLD | NEW |