OLD | NEW |
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/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 return rv; | 93 return rv; |
94 } | 94 } |
95 | 95 |
96 void BrowserMessageFilter::BadMessageReceived() { | 96 void BrowserMessageFilter::BadMessageReceived() { |
97 base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE, | 97 base::KillProcess(peer_handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE, |
98 false); | 98 false); |
99 } | 99 } |
100 | 100 |
101 bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message, | 101 bool BrowserMessageFilter::CheckCanDispatchOnUI(const IPC::Message& message, |
102 IPC::Message::Sender* sender) { | 102 IPC::Message::Sender* sender) { |
103 #if defined(OS_WIN) | 103 #if defined(OS_WIN) && !defined(USE_AURA) |
104 // On Windows there's a potential deadlock with sync messsages going in | 104 // On Windows there's a potential deadlock with sync messsages going in |
105 // a circle from browser -> plugin -> renderer -> browser. | 105 // a circle from browser -> plugin -> renderer -> browser. |
106 // On Linux we can avoid this by avoiding sync messages from browser->plugin. | 106 // On Linux we can avoid this by avoiding sync messages from browser->plugin. |
107 // On Mac we avoid this by not supporting windowed plugins. | 107 // On Mac we avoid this by not supporting windowed plugins. |
108 if (message.is_sync() && !message.is_caller_pumping_messages()) { | 108 if (message.is_sync() && !message.is_caller_pumping_messages()) { |
109 // NOTE: IF YOU HIT THIS ASSERT, THE SOLUTION IS ALMOST NEVER TO RUN A | 109 // NOTE: IF YOU HIT THIS ASSERT, THE SOLUTION IS ALMOST NEVER TO RUN A |
110 // NESTED MESSAGE LOOP IN THE RENDERER!!! | 110 // NESTED MESSAGE LOOP IN THE RENDERER!!! |
111 // That introduces reentrancy which causes hard to track bugs. You should | 111 // That introduces reentrancy which causes hard to track bugs. You should |
112 // find a way to either turn this into an asynchronous message, or one | 112 // find a way to either turn this into an asynchronous message, or one |
113 // that can be answered on the IO thread. | 113 // that can be answered on the IO thread. |
114 NOTREACHED() << "Can't send sync messages to UI thread without pumping " | 114 NOTREACHED() << "Can't send sync messages to UI thread without pumping " |
115 "messages in the renderer or else deadlocks can occur if the page " | 115 "messages in the renderer or else deadlocks can occur if the page " |
116 "has windowed plugins! (message type " << message.type() << ")"; | 116 "has windowed plugins! (message type " << message.type() << ")"; |
117 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); | 117 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); |
118 reply->set_reply_error(); | 118 reply->set_reply_error(); |
119 sender->Send(reply); | 119 sender->Send(reply); |
120 return false; | 120 return false; |
121 } | 121 } |
122 #endif | 122 #endif |
123 return true; | 123 return true; |
124 } | 124 } |
OLD | NEW |