1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_BAD_MESSAGE_H_
6 #define CHROME_BROWSER_BAD_MESSAGE_H_
9 class BrowserMessageFilter;
10 class RenderProcessHost;
13 namespace bad_message {
15 // The browser process often chooses to terminate a renderer if it receives
16 // a bad IPC message. The reasons are tracked for metrics.
18 // See also content/browser/bad_message.h.
20 // 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
22 // values in histograms.
23 enum BadMessageReason {
24 WRLHH_LOGGING_STOPPED_BAD_STATE = 0,
25 PPH_EXTRA_PREVIEW_MESSAGE = 1,
26 PMF_INVALID_INITIATOR_ORIGIN = 2,
27 RFH_INVALID_WEB_UI_CONTROLLER = 3,
28 RFH_DISPLAY_CAPTURE_PERMISSION_MISSING = 4,
29 MSFD_MULTIPLE_CLOSURES_OF_FOCUSABILITY_WINDOW = 5,
30 MSFD_MULTIPLE_EXPLICIT_CALLS_TO_FOCUS = 6,
31 PVM_SCRIPTED_PRINT_FENCED_FRAME = 7,
32 PVMB_SCRIPTED_PRINT_FENCED_FRAME = 8,
33 SSI_CREATE_FENCED_FRAME = 9,
35 // Please add new elements here. The naming convention is abbreviated class
36 // name (e.g. RenderFrameHost becomes RFH) plus a unique description of the
37 // reason. After making changes, you MUST update histograms.xml by running:
38 // "python tools/metrics/histograms/update_bad_message_reasons.py"
42 // Called when the browser receives a bad IPC message from a renderer process on
43 // the UI thread. Logs the event, records a histogram metric for the |reason|,
44 // and terminates the process for |host|.
45 void ReceivedBadMessage(content::RenderProcessHost* host,
46 BadMessageReason reason);
48 // Called when a browser message filter receives a bad IPC message from a
49 // renderer or other child process. Logs the event, records a histogram metric
50 // for the |reason|, and terminates the process for |filter|.
51 void ReceivedBadMessage(content::BrowserMessageFilter* filter,
52 BadMessageReason reason);
54 } // namespace bad_message
56 #endif // CHROME_BROWSER_BAD_MESSAGE_H_