blob: bef0c712b388f95f45cf4666a2301b08b1dde0fc [file] [log] [blame]
jamescookda2505812015-03-20 18:01:181// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef EXTENSIONS_BROWSER_BAD_MESSAGE_H_
6#define EXTENSIONS_BROWSER_BAD_MESSAGE_H_
7
8namespace content {
9class RenderProcessHost;
10}
11
12namespace extensions {
13namespace bad_message {
14
15// The browser process often chooses to terminate a renderer if it receives
16// a bad IPC message. The reasons are tracked for metrics.
17//
18// See also content/browser/bad_message.h.
19//
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
nickd8ec87b2015-07-17 00:42:5222// values in histograms.
jamescookda2505812015-03-20 18:01:1823enum BadMessageReason {
24 EOG_BAD_ORIGIN = 0,
creisee45bf42015-05-12 17:59:5525 EVG_BAD_ORIGIN = 1,
26 BH_BLOB_NOT_OWNED = 2,
27 EH_BAD_EVENT_ID = 3,
ekaramad725a6ca2015-07-07 22:15:0128 AVG_BAD_INST_ID = 4,
29 AVG_BAD_EXT_ID = 5,
30 AVG_NULL_AVG = 6,
jamescookda2505812015-03-20 18:01:1831 // Please add new elements here. The naming convention is abbreviated class
32 // name (e.g. ExtensionHost becomes EH) plus a unique description of the
nickd8ec87b2015-07-17 00:42:5233 // reason. After making changes, you MUST update histograms.xml by running:
34 // "python tools/metrics/histograms/update_bad_message_reasons.py"
jamescookda2505812015-03-20 18:01:1835 BAD_MESSAGE_MAX
36};
37
38// Called when the browser receives a bad IPC message from an extension process.
39// Logs the event, records a histogram metric for the |reason|, and terminates
40// the process for |host|.
41void ReceivedBadMessage(content::RenderProcessHost* host,
42 BadMessageReason reason);
43
nick16794822015-06-02 23:23:3144} // namespace bad_message
jamescookda2505812015-03-20 18:01:1845} // namespace extensions
46
47#endif // EXTENSIONS_BROWSER_BAD_MESSAGE_H_