Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: content/browser/bad_message.cc

Issue 2225133002: Revert "Port WebSockets to Mojo IPC" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/bad_message.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/browser/bad_message.h" 5 #include "content/browser/bad_message.h"
6 6
7 #include "base/bind.h"
8 #include "base/debug/crash_logging.h" 7 #include "base/debug/crash_logging.h"
9 #include "base/logging.h" 8 #include "base/logging.h"
10 #include "base/metrics/sparse_histogram.h" 9 #include "base/metrics/sparse_histogram.h"
11 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
12 #include "content/public/browser/browser_message_filter.h" 11 #include "content/public/browser/browser_message_filter.h"
13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/render_process_host.h" 12 #include "content/public/browser/render_process_host.h"
15 13
16 namespace content { 14 namespace content {
17 namespace bad_message { 15 namespace bad_message {
18 16
19 namespace { 17 namespace {
20 18
21 void LogBadMessage(BadMessageReason reason) { 19 void LogBadMessage(BadMessageReason reason) {
22 LOG(ERROR) << "Terminating renderer for bad IPC message, reason " << reason; 20 LOG(ERROR) << "Terminating renderer for bad IPC message, reason " << reason;
23 UMA_HISTOGRAM_SPARSE_SLOWLY("Stability.BadMessageTerminated.Content", reason); 21 UMA_HISTOGRAM_SPARSE_SLOWLY("Stability.BadMessageTerminated.Content", reason);
24 base::debug::SetCrashKeyValue("bad_message_reason", 22 base::debug::SetCrashKeyValue("bad_message_reason",
25 base::IntToString(reason)); 23 base::IntToString(reason));
26 } 24 }
27 25
28 void ReceivedBadMessageOnUIThread(int render_process_id,
29 BadMessageReason reason) {
30 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
31 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id);
32 if (host)
33 ReceivedBadMessage(host, reason);
34 }
35
36 } // namespace 26 } // namespace
37 27
38 void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason) { 28 void ReceivedBadMessage(RenderProcessHost* host, BadMessageReason reason) {
39 LogBadMessage(reason); 29 LogBadMessage(reason);
40 host->ShutdownForBadMessage(); 30 host->ShutdownForBadMessage();
41 } 31 }
42 32
43 void ReceivedBadMessage(int render_process_id, BadMessageReason reason) {
44 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
45 BrowserThread::PostTask(
46 BrowserThread::UI,
47 FROM_HERE,
48 base::Bind(&ReceivedBadMessageOnUIThread, render_process_id, reason));
49 return;
50 }
51 ReceivedBadMessageOnUIThread(render_process_id, reason);
52 }
53
54 void ReceivedBadMessage(BrowserMessageFilter* filter, BadMessageReason reason) { 33 void ReceivedBadMessage(BrowserMessageFilter* filter, BadMessageReason reason) {
55 LogBadMessage(reason); 34 LogBadMessage(reason);
56 filter->ShutdownForBadMessage(); 35 filter->ShutdownForBadMessage();
57 } 36 }
58 37
59 } // namespace bad_message 38 } // namespace bad_message
60 } // namespace content 39 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bad_message.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698