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