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 14 matching lines...) Expand all Loading... |
25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/net/url_request_context_getter.h" | 27 #include "chrome/common/net/url_request_context_getter.h" |
28 #include "chrome/common/render_messages.h" | 28 #include "chrome/common/render_messages.h" |
29 #include "chrome/common/print_messages.h" | 29 #include "chrome/common/print_messages.h" |
30 #include "chrome/common/safebrowsing_messages.h" | 30 #include "chrome/common/safebrowsing_messages.h" |
31 #include "chrome/common/spellcheck_messages.h" | 31 #include "chrome/common/spellcheck_messages.h" |
32 #include "chrome/common/translate_errors.h" | 32 #include "chrome/common/translate_errors.h" |
33 #include "chrome/common/url_constants.h" | 33 #include "chrome/common/url_constants.h" |
34 #include "chrome/common/web_apps.h" | 34 #include "chrome/common/web_apps.h" |
| 35 #include "content/browser/browser_message_filter.h" |
35 #include "content/browser/child_process_security_policy.h" | 36 #include "content/browser/child_process_security_policy.h" |
36 #include "content/browser/cross_site_request_manager.h" | 37 #include "content/browser/cross_site_request_manager.h" |
37 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 38 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
38 #include "content/browser/renderer_host/render_process_host.h" | 39 #include "content/browser/renderer_host/render_process_host.h" |
39 #include "content/browser/renderer_host/render_view_host_delegate.h" | 40 #include "content/browser/renderer_host/render_view_host_delegate.h" |
40 #include "content/browser/renderer_host/render_widget_host.h" | 41 #include "content/browser/renderer_host/render_widget_host.h" |
41 #include "content/browser/renderer_host/render_widget_host_view.h" | 42 #include "content/browser/renderer_host/render_widget_host_view.h" |
42 #include "content/browser/site_instance.h" | 43 #include "content/browser/site_instance.h" |
43 #include "content/common/drag_messages.h" | 44 #include "content/common/drag_messages.h" |
44 #include "content/common/native_web_keyboard_event.h" | 45 #include "content/common/native_web_keyboard_event.h" |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } | 681 } |
681 | 682 |
682 bool RenderViewHost::SuddenTerminationAllowed() const { | 683 bool RenderViewHost::SuddenTerminationAllowed() const { |
683 return sudden_termination_allowed_ || process()->sudden_termination_allowed(); | 684 return sudden_termination_allowed_ || process()->sudden_termination_allowed(); |
684 } | 685 } |
685 | 686 |
686 /////////////////////////////////////////////////////////////////////////////// | 687 /////////////////////////////////////////////////////////////////////////////// |
687 // RenderViewHost, IPC message handlers: | 688 // RenderViewHost, IPC message handlers: |
688 | 689 |
689 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { | 690 bool RenderViewHost::OnMessageReceived(const IPC::Message& msg) { |
690 #if defined(OS_WIN) | 691 if (!BrowserMessageFilter::MessageCanBeDispatchedOnUI(msg, this)) |
691 // On Windows there's a potential deadlock with sync messsages going in | |
692 // a circle from browser -> plugin -> renderer -> browser. | |
693 // On Linux we can avoid this by avoiding sync messages from browser->plugin. | |
694 // On Mac we avoid this by not supporting windowed plugins. | |
695 if (msg.is_sync() && !msg.is_caller_pumping_messages()) { | |
696 // NOTE: IF YOU HIT THIS ASSERT, THE SOLUTION IS ALMOST NEVER TO RUN A | |
697 // NESTED MESSAGE LOOP IN THE RENDERER!!! | |
698 // That introduces reentrancy which causes hard to track bugs. You should | |
699 // find a way to either turn this into an asynchronous message, or one | |
700 // that can be answered on the IO thread. | |
701 NOTREACHED() << "Can't send sync messages to UI thread without pumping " | |
702 "messages in the renderer or else deadlocks can occur if the page " | |
703 "has windowed plugins! (message type " << msg.type() << ")"; | |
704 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); | |
705 reply->set_reply_error(); | |
706 Send(reply); | |
707 return true; | 692 return true; |
708 } | |
709 #endif | |
710 | 693 |
711 if (delegate_->OnMessageReceived(msg)) | 694 if (delegate_->OnMessageReceived(msg)) |
712 return true; | 695 return true; |
713 | 696 |
714 bool handled = true; | 697 bool handled = true; |
715 bool msg_is_ok = true; | 698 bool msg_is_ok = true; |
716 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) | 699 IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok) |
717 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) | 700 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnMsgShowView) |
718 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) | 701 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnMsgShowWidget) |
719 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 702 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1666 LOG(DFATAL) << "Invalid checked state " << checked_state; | 1649 LOG(DFATAL) << "Invalid checked state " << checked_state; |
1667 return; | 1650 return; |
1668 } | 1651 } |
1669 | 1652 |
1670 CommandState state; | 1653 CommandState state; |
1671 state.is_enabled = is_enabled; | 1654 state.is_enabled = is_enabled; |
1672 state.checked_state = | 1655 state.checked_state = |
1673 static_cast<RenderViewCommandCheckedState>(checked_state); | 1656 static_cast<RenderViewCommandCheckedState>(checked_state); |
1674 command_states_[static_cast<RenderViewCommand>(command)] = state; | 1657 command_states_[static_cast<RenderViewCommand>(command)] = state; |
1675 } | 1658 } |
OLD | NEW |