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 #include "extensions/browser/bad_message.h" | 5 #include "extensions/browser/bad_message.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "content/public/browser/browser_message_filter.h" | 9 #include "content/public/browser/browser_message_filter.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 namespace bad_message { | 13 namespace bad_message { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 void LogBadMessage(BadMessageReason reason) { | 17 void LogBadMessage(BadMessageReason reason) { |
18 // EFD_BAD_MESSAGE uses different logging and UMA. | |
19 // See callers of ReceivedBadMessage() in ExtensionFunctionDispatcher. | |
20 if (reason == EFD_BAD_MESSAGE) | |
Charlie Reis
2017/01/13 21:22:25
It feels unfortunate to bake knowledge about parti
lazyboy
2017/01/14 01:04:43
SG, Done.
| |
21 return; | |
22 | |
23 // TODO(creis): We should call SetCrashKeyValue("bad_message_reason") similar | |
24 // to the content/ implementation, so the generated crash reports are | |
25 // easier to search. Not straightforward because | |
26 // extensions::bad_message::BadMessageReason and | |
27 // content::bad_message::BadMessageReason enum values overlap. | |
Charlie Reis
2017/01/13 21:22:25
The crash key only helps if there are multiple Rec
lazyboy
2017/01/14 01:04:43
Interesting.
Although I feel you meant different s
Charlie Reis
2017/01/15 18:08:51
Right! Sorry about the typo. :)
| |
18 LOG(ERROR) << "Terminating extension renderer for bad IPC message, reason " | 28 LOG(ERROR) << "Terminating extension renderer for bad IPC message, reason " |
19 << reason; | 29 << reason; |
20 UMA_HISTOGRAM_SPARSE_SLOWLY("Stability.BadMessageTerminated.Extensions", | 30 UMA_HISTOGRAM_SPARSE_SLOWLY("Stability.BadMessageTerminated.Extensions", |
21 reason); | 31 reason); |
22 } | 32 } |
23 | 33 |
24 } // namespace | 34 } // namespace |
25 | 35 |
26 void ReceivedBadMessage(content::RenderProcessHost* host, | 36 void ReceivedBadMessage(content::RenderProcessHost* host, |
27 BadMessageReason reason) { | 37 BadMessageReason reason) { |
28 LogBadMessage(reason); | 38 LogBadMessage(reason); |
29 host->ShutdownForBadMessage( | 39 host->ShutdownForBadMessage( |
30 content::RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); | 40 content::RenderProcessHost::CrashReportMode::GENERATE_CRASH_DUMP); |
31 } | 41 } |
32 | 42 |
33 void ReceivedBadMessage(content::BrowserMessageFilter* filter, | 43 void ReceivedBadMessage(content::BrowserMessageFilter* filter, |
34 BadMessageReason reason) { | 44 BadMessageReason reason) { |
35 LogBadMessage(reason); | 45 LogBadMessage(reason); |
36 filter->ShutdownForBadMessage(); | 46 filter->ShutdownForBadMessage(); |
37 } | 47 } |
38 | 48 |
39 } // namespace bad_message | 49 } // namespace bad_message |
40 } // namespace extensions | 50 } // namespace extensions |
OLD | NEW |