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 namespace content { | 8 namespace content { |
9 class RenderProcessHost; | 9 class RenderProcessHost; |
10 | 10 |
11 namespace bad_message { | 11 namespace bad_message { |
12 | 12 |
13 // The browser process often chooses to terminate a renderer if it receives | 13 // The browser process often chooses to terminate a renderer if it receives |
14 // a bad IPC message. The reasons are tracked for metrics. | 14 // a bad IPC message. The reasons are tracked for metrics. |
15 // | 15 // |
16 // Content embedders should implement their own bad message statistics but | 16 // Content embedders should implement their own bad message statistics but |
17 // should use similar histogram names to make analysis easier. | 17 // should use similar histogram names to make analysis easier. |
18 // | 18 // |
19 // NOTE: Do not remove or reorder elements in this list. Add new entries at the | 19 // NOTE: Do not remove or reorder elements in this list. Add new entries at the |
20 // end. Items may be renamed but do not change the values. We rely on the enum | 20 // end. Items may be renamed but do not change the values. We rely on the enum |
21 // values in histograms. | 21 // values in histograms. Also update histograms.xml with any new values. |
22 enum BadMessageReason { | 22 enum BadMessageReason { |
23 NC_IN_PAGE_NAVIGATION = 0, | 23 NC_IN_PAGE_NAVIGATION = 0, |
24 RFH_CAN_COMMIT_URL_BLOCKED, | 24 RFH_CAN_COMMIT_URL_BLOCKED = 1, |
25 RFH_CAN_ACCESS_FILES_OF_PAGE_STATE, | 25 RFH_CAN_ACCESS_FILES_OF_PAGE_STATE = 2, |
26 RFH_SANDBOX_FLAGS, | 26 RFH_SANDBOX_FLAGS = 3, |
27 RFH_NO_PROXY_TO_PARENT, | 27 RFH_NO_PROXY_TO_PARENT = 4, |
28 RPH_DESERIALIZATION_FAILED, | 28 RPH_DESERIALIZATION_FAILED = 5, |
29 RVH_CAN_ACCESS_FILES_OF_PAGE_STATE, | 29 RVH_CAN_ACCESS_FILES_OF_PAGE_STATE = 6, |
30 RVH_FILE_CHOOSER_PATH, | 30 RVH_FILE_CHOOSER_PATH = 7, |
31 RWH_SYNTHETIC_GESTURE, | 31 RWH_SYNTHETIC_GESTURE = 8, |
32 RWH_FOCUS, | 32 RWH_FOCUS = 9, |
33 RWH_BLUR, | 33 RWH_BLUR = 10, |
34 RWH_SHARED_BITMAP, | 34 RWH_SHARED_BITMAP = 11, |
35 RWH_BAD_ACK_MESSAGE, | 35 RWH_BAD_ACK_MESSAGE = 12, |
36 RWHVA_SHARED_MEMORY, | 36 RWHVA_SHARED_MEMORY = 13, |
37 SERVICE_WORKER_BAD_URL, | 37 SERVICE_WORKER_BAD_URL = 14, |
38 WC_INVALID_FRAME_SOURCE, | 38 WC_INVALID_FRAME_SOURCE = 15, |
39 RWHVM_UNEXPECTED_FRAME_TYPE, | 39 RWHVM_UNEXPECTED_FRAME_TYPE = 16, |
40 RFPH_DETACH, | 40 RFPH_DETACH = 17, |
41 DFH_BAD_EMBEDDER_MESSAGE, | 41 DFH_BAD_EMBEDDER_MESSAGE = 18, |
42 NC_AUTO_SUBFRAME, | 42 NC_AUTO_SUBFRAME = 19, |
43 // Please add new elements here. The naming convention is abbreviated class | 43 // Please add new elements here. The naming convention is abbreviated class |
44 // name (e.g. RenderFrameHost becomes RFH) plus a unique description of the | 44 // name (e.g. RenderFrameHost becomes RFH) plus a unique description of the |
45 // reason. | 45 // reason. |
46 BAD_MESSAGE_MAX | 46 BAD_MESSAGE_MAX |
47 }; | 47 }; |
48 | 48 |
49 // Called when the browser receives a bad IPC message from a renderer process. | 49 // Called when the browser receives a bad IPC message from a renderer process. |
50 // Logs the event, records a histogram metric for the |reason|, and terminates | 50 // Logs the event, records a histogram metric for the |reason|, and terminates |
51 // the process for |host|. | 51 // the process for |host|. |
52 void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason); | 52 void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason); |
53 | 53 |
54 } // namespace bad_message | 54 } // namespace bad_message |
55 } // namespace content | 55 } // namespace content |
56 | 56 |
57 #endif // CONTENT_BROWSER_BAD_MESSAGE_H_ | 57 #endif // CONTENT_BROWSER_BAD_MESSAGE_H_ |
OLD | NEW |