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

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

Issue 7377010: This change will split the result codes between content and chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually rename the files Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/logging.h" 7 #include "base/logging.h"
8 #include "base/process.h" 8 #include "base/process.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "content/browser/user_metrics.h" 10 #include "content/browser/user_metrics.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 "Must handle messages that were dispatched to another thread!"; 85 "Must handle messages that were dispatched to another thread!";
86 if (!message_was_ok) { 86 if (!message_was_ok) {
87 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BMF")); 87 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BMF"));
88 BadMessageReceived(); 88 BadMessageReceived();
89 } 89 }
90 90
91 return rv; 91 return rv;
92 } 92 }
93 93
94 void BrowserMessageFilter::BadMessageReceived() { 94 void BrowserMessageFilter::BadMessageReceived() {
95 base::KillProcess(peer_handle(), ResultCodes::KILLED_BAD_MESSAGE, false); 95 base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE,
96 false);
96 } 97 }
97 98
98 bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message, 99 bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message,
99 IPC::Message::Sender* sender) { 100 IPC::Message::Sender* sender) {
100 #if defined(OS_WIN) 101 #if defined(OS_WIN)
101 // On Windows there's a potential deadlock with sync messsages going in 102 // On Windows there's a potential deadlock with sync messsages going in
102 // a circle from browser -> plugin -> renderer -> browser. 103 // a circle from browser -> plugin -> renderer -> browser.
103 // On Linux we can avoid this by avoiding sync messages from browser->plugin. 104 // On Linux we can avoid this by avoiding sync messages from browser->plugin.
104 // On Mac we avoid this by not supporting windowed plugins. 105 // On Mac we avoid this by not supporting windowed plugins.
105 if (message.is_sync() && !message.is_caller_pumping_messages()) { 106 if (message.is_sync() && !message.is_caller_pumping_messages()) {
106 // NOTE: IF YOU HIT THIS ASSERT, THE SOLUTION IS ALMOST NEVER TO RUN A 107 // NOTE: IF YOU HIT THIS ASSERT, THE SOLUTION IS ALMOST NEVER TO RUN A
107 // NESTED MESSAGE LOOP IN THE RENDERER!!! 108 // NESTED MESSAGE LOOP IN THE RENDERER!!!
108 // That introduces reentrancy which causes hard to track bugs. You should 109 // That introduces reentrancy which causes hard to track bugs. You should
109 // find a way to either turn this into an asynchronous message, or one 110 // find a way to either turn this into an asynchronous message, or one
110 // that can be answered on the IO thread. 111 // that can be answered on the IO thread.
111 NOTREACHED() << "Can't send sync messages to UI thread without pumping " 112 NOTREACHED() << "Can't send sync messages to UI thread without pumping "
112 "messages in the renderer or else deadlocks can occur if the page " 113 "messages in the renderer or else deadlocks can occur if the page "
113 "has windowed plugins! (message type " << message.type() << ")"; 114 "has windowed plugins! (message type " << message.type() << ")";
114 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); 115 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message);
115 reply->set_reply_error(); 116 reply->set_reply_error();
116 sender->Send(reply); 117 sender->Send(reply);
117 return false; 118 return false;
118 } 119 }
119 #endif 120 #endif
120 return true; 121 return true;
121 } 122 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698