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