bad_message.h 1.6 KB

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