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/renderer_host/render_view_host.h" | 5 #include "content/browser/renderer_host/render_view_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/net/url_request_context_getter.h" | 26 #include "chrome/common/net/url_request_context_getter.h" |
27 #include "chrome/common/render_messages.h" | 27 #include "chrome/common/render_messages.h" |
28 #include "chrome/common/print_messages.h" | 28 #include "chrome/common/print_messages.h" |
29 #include "chrome/common/safebrowsing_messages.h" | 29 #include "chrome/common/safebrowsing_messages.h" |
30 #include "chrome/common/spellcheck_messages.h" | 30 #include "chrome/common/spellcheck_messages.h" |
31 #include "chrome/common/translate_errors.h" | 31 #include "chrome/common/translate_errors.h" |
32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
33 #include "chrome/common/web_apps.h" | 33 #include "chrome/common/web_apps.h" |
34 #include "content/browser/browser_message_filter.h" | |
35 #include "content/browser/child_process_security_policy.h" | 34 #include "content/browser/child_process_security_policy.h" |
36 #include "content/browser/cross_site_request_manager.h" | 35 #include "content/browser/cross_site_request_manager.h" |
37 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 36 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
38 #include "content/browser/renderer_host/render_process_host.h" | 37 #include "content/browser/renderer_host/render_process_host.h" |
39 #include "content/browser/renderer_host/render_view_host_delegate.h" | 38 #include "content/browser/renderer_host/render_view_host_delegate.h" |
40 #include "content/browser/renderer_host/render_widget_host.h" | 39 #include "content/browser/renderer_host/render_widget_host.h" |
41 #include "content/browser/renderer_host/render_widget_host_view.h" | 40 #include "content/browser/renderer_host/render_widget_host_view.h" |
42 #include "content/browser/site_instance.h" | 41 #include "content/browser/site_instance.h" |
43 #include "content/common/drag_messages.h" | 42 #include "content/common/drag_messages.h" |
44 #include "content/common/native_web_keyboard_event.h" | 43 #include "content/common/native_web_keyboard_event.h" |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 } | 692 } |
694 | 693 |
695 bool RenderViewHost::SuddenTerminationAllowed() const { | 694 bool RenderViewHost::SuddenTerminationAllowed() const { |
696 return sudden_termination_allowed_ || process()->sudden_termination_allowed(); | 695 return sudden_termination_allowed_ || process()->sudden_termination_allowed(); |
697 } | 696 } |
698 | 697 |
699 /////////////////////////////////////////////////////////////////////////////// | 698 /////////////////////////////////////////////////////////////////////////////// |
700 // RenderViewHost, IPC message handlers: | 699 // RenderViewHost, IPC message handlers: |
701 | 700 |
702 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { | 701 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { |
703 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) | 702 #if defined(OS_WIN) |
| 703 // On Windows there's a potential deadlock with sync messsages going in |
| 704 // a circle from browser -> plugin -> renderer -> browser. |
| 705 // On Linux we can avoid this by avoiding sync messages from browser->plugin. |
| 706 // On Mac we avoid this by not supporting windowed plugins. |
| 707 if (msg.is_sync() && !msg.is_caller_pumping_messages()) { |
| 708 // NOTE: IF YOU HIT THIS ASSERT, THE SOLUTION IS ALMOST NEVER TO RUN A |
| 709 // NESTED MESSAGE LOOP IN THE RENDERER!!! |
| 710 // That introduces reentrancy which causes hard to track bugs. You should |
| 711 // find a way to either turn this into an asynchronous message, or one |
| 712 // that can be answered on the IO thread. |
| 713 NOTREACHED() << "Can't send sync messages to UI thread without pumping " |
| 714 "messages in the renderer or else deadlocks can occur if the page " |
| 715 "has windowed plugins! (message type " << msg.type() << ")"; |
| 716 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |
| 717 reply->set_reply_error(); |
| 718 Send(reply); |
704 return true; | 719 return true; |
| 720 } |
| 721 #endif |
705 | 722 |
706 if (delegate_->OnMessageReceived(msg)) | 723 if (delegate_->OnMessageReceived(msg)) |
707 return true; | 724 return true; |
708 | 725 |
709 bool handled = true; | 726 bool handled = true; |
710 bool msg_is_ok = true; | 727 bool msg_is_ok = true; |
711 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) | 728 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) |
712 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 729 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |
713 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 730 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |
714 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 731 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1611 LOG(DFATAL) << "Invalid checked state " << checked_state; | 1628 LOG(DFATAL) << "Invalid checked state " << checked_state; |
1612 return; | 1629 return; |
1613 } | 1630 } |
1614 | 1631 |
1615 CommandState state; | 1632 CommandState state; |
1616 state.is_enabled = is_enabled; | 1633 state.is_enabled = is_enabled; |
1617 state.checked_state = | 1634 state.checked_state = |
1618 static_cast<RenderViewCommandCheckedState>(checked_state); | 1635 static_cast<RenderViewCommandCheckedState>(checked_state); |
1619 command_states_[static_cast<RenderViewCommand>(command)] = state; | 1636 command_states_[static_cast<RenderViewCommand>(command)] = state; |
1620 } | 1637 } |
OLD | NEW |