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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_message_filter.h" 5 #include "content/browser/browser_message_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/process.h" 10 #include "base/process.h"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "content/browser/user_metrics.h" 12 #include "content/public/browser/user_metrics.h"
13 #include "content/public/common/result_codes.h" 13 #include "content/public/common/result_codes.h"
14 #include "ipc/ipc_sync_message.h" 14 #include "ipc/ipc_sync_message.h"
15 15
16 using content::BrowserThread; 16 using content::BrowserThread;
17 using content::UserMetricsAction;
17 18
18 BrowserMessageFilter::BrowserMessageFilter() 19 BrowserMessageFilter::BrowserMessageFilter()
19 : channel_(NULL), peer_handle_(base::kNullProcessHandle) { 20 : channel_(NULL), peer_handle_(base::kNullProcessHandle) {
20 } 21 }
21 22
22 BrowserMessageFilter::~BrowserMessageFilter() { 23 BrowserMessageFilter::~BrowserMessageFilter() {
23 base::CloseProcessHandle(peer_handle_); 24 base::CloseProcessHandle(peer_handle_);
24 } 25 }
25 26
26 void BrowserMessageFilter::OnFilterAdded(IPC::Channel* channel) { 27 void BrowserMessageFilter::OnFilterAdded(IPC::Channel* channel) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::Bind(&BrowserMessageFilter::DispatchMessage, this, message))); 83 base::Bind(&BrowserMessageFilter::DispatchMessage, this, message)));
83 return true; 84 return true;
84 } 85 }
85 86
86 bool BrowserMessageFilter::DispatchMessage(const IPC::Message& message) { 87 bool BrowserMessageFilter::DispatchMessage(const IPC::Message& message) {
87 bool message_was_ok = true; 88 bool message_was_ok = true;
88 bool rv = OnMessageReceived(message, &message_was_ok); 89 bool rv = OnMessageReceived(message, &message_was_ok);
89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) << 90 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) <<
90 "Must handle messages that were dispatched to another thread!"; 91 "Must handle messages that were dispatched to another thread!";
91 if (!message_was_ok) { 92 if (!message_was_ok) {
92 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BMF")); 93 content::RecordAction(UserMetricsAction("BadMessageTerminate_BMF"));
93 BadMessageReceived(); 94 BadMessageReceived();
94 } 95 }
95 96
96 return rv; 97 return rv;
97 } 98 }
98 99
99 void BrowserMessageFilter::BadMessageReceived() { 100 void BrowserMessageFilter::BadMessageReceived() {
100 base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE, 101 base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE,
101 false); 102 false);
102 } 103 }
(...skipping 15 matching lines...) Expand all
118 "messages in the renderer or else deadlocks can occur if the page " 119 "messages in the renderer or else deadlocks can occur if the page "
119 "has windowed plugins! (message type " << message.type() << ")"; 120 "has windowed plugins! (message type " << message.type() << ")";
120 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); 121 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message);
121 reply->set_reply_error(); 122 reply->set_reply_error();
122 sender->Send(reply); 123 sender->Send(reply);
123 return false; 124 return false;
124 } 125 }
125 #endif 126 #endif
126 return true; 127 return true;
127 } 128 }
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_dispatcher_host.cc ('k') | content/browser/file_system/file_system_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698