| 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 CONTENT_BROWSER_BAD_MESSAGE_H_ | 5 #ifndef CONTENT_BROWSER_BAD_MESSAGE_H_ |
| 6 #define CONTENT_BROWSER_BAD_MESSAGE_H_ | 6 #define CONTENT_BROWSER_BAD_MESSAGE_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" |
| 9 |
| 8 namespace content { | 10 namespace content { |
| 9 class BrowserMessageFilter; | 11 class BrowserMessageFilter; |
| 10 class RenderProcessHost; | 12 class RenderProcessHost; |
| 11 | 13 |
| 12 namespace bad_message { | 14 namespace bad_message { |
| 13 | 15 |
| 14 // 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 |
| 15 // a bad IPC message. The reasons are tracked for metrics. | 17 // a bad IPC message. The reasons are tracked for metrics. |
| 16 // | 18 // |
| 17 // Content embedders should implement their own bad message statistics but | 19 // Content embedders should implement their own bad message statistics but |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // "python tools/metrics/histograms/update_bad_message_reasons.py" | 203 // "python tools/metrics/histograms/update_bad_message_reasons.py" |
| 202 BAD_MESSAGE_MAX | 204 BAD_MESSAGE_MAX |
| 203 }; | 205 }; |
| 204 | 206 |
| 205 // Called when the browser receives a bad IPC message from a renderer process on | 207 // Called when the browser receives a bad IPC message from a renderer process on |
| 206 // the UI thread. Logs the event, records a histogram metric for the |reason|, | 208 // the UI thread. Logs the event, records a histogram metric for the |reason|, |
| 207 // and terminates the process for |host|. | 209 // and terminates the process for |host|. |
| 208 void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason); | 210 void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason); |
| 209 | 211 |
| 210 // Equivalent to the above, but callable from any thread. | 212 // Equivalent to the above, but callable from any thread. |
| 211 void ReceivedBadMessage(int render_process_id, BadMessageReason reason); | 213 CONTENT_EXPORT void ReceivedBadMessage(int render_process_id, |
| 214 BadMessageReason reason); |
| 212 | 215 |
| 213 // Called when a browser message filter receives a bad IPC message from a | 216 // Called when a browser message filter receives a bad IPC message from a |
| 214 // renderer or other child process. Logs the event, records a histogram metric | 217 // renderer or other child process. Logs the event, records a histogram metric |
| 215 // for the |reason|, and terminates the process for |filter|. | 218 // for the |reason|, and terminates the process for |filter|. |
| 216 void ReceivedBadMessage(BrowserMessageFilter* filter, BadMessageReason reason); | 219 void ReceivedBadMessage(BrowserMessageFilter* filter, BadMessageReason reason); |
| 217 | 220 |
| 218 } // namespace bad_message | 221 } // namespace bad_message |
| 219 } // namespace content | 222 } // namespace content |
| 220 | 223 |
| 221 #endif // CONTENT_BROWSER_BAD_MESSAGE_H_ | 224 #endif // CONTENT_BROWSER_BAD_MESSAGE_H_ |
| OLD | NEW |