OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 // Don't continue looking for someone to handle it. | 873 // Don't continue looking for someone to handle it. |
874 return true; | 874 return true; |
875 } | 875 } |
876 } | 876 } |
877 | 877 |
878 if (delegate_->OnMessageReceived(this, msg)) | 878 if (delegate_->OnMessageReceived(this, msg)) |
879 return true; | 879 return true; |
880 | 880 |
881 bool handled = true; | 881 bool handled = true; |
882 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) | 882 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) |
| 883 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) |
883 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) | 884 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) |
884 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | 885 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) |
885 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 886 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
886 OnShowFullscreenWidget) | 887 OnShowFullscreenWidget) |
887 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) | 888 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) |
888 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 889 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
889 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | |
890 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) | 890 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) |
891 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) | 891 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
892 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 892 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
893 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 893 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
894 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, | 894 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, |
895 OnDocumentAvailableInMainFrame) | 895 OnDocumentAvailableInMainFrame) |
896 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 896 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |
897 OnDidContentsPreferredSizeChange) | 897 OnDidContentsPreferredSizeChange) |
898 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 898 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
899 OnRouteCloseEvent) | 899 OnRouteCloseEvent) |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 } | 1044 } |
1045 | 1045 |
1046 void RenderViewHostImpl::OnRenderViewReady() { | 1046 void RenderViewHostImpl::OnRenderViewReady() { |
1047 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; | 1047 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; |
1048 SendScreenRects(); | 1048 SendScreenRects(); |
1049 WasResized(); | 1049 WasResized(); |
1050 delegate_->RenderViewReady(this); | 1050 delegate_->RenderViewReady(this); |
1051 } | 1051 } |
1052 | 1052 |
1053 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { | 1053 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { |
1054 // Keep the termination status so we can get at it later when we | 1054 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a |
1055 // need to know why it died. | 1055 // RenderViewHostImpl and destroy itself. |
1056 render_view_termination_status_ = | 1056 // TODO(nasko): Remove this hack once RenderViewHost and RenderWidgetHost are |
1057 static_cast<base::TerminationStatus>(status); | 1057 // decoupled. |
1058 | |
1059 // Reset frame tree state associated with this process. This must happen | |
1060 // before RenderViewTerminated because observers expect the subframes of any | |
1061 // affected frames to be cleared first. | |
1062 delegate_->GetFrameTree()->RenderProcessGone(this); | |
1063 | |
1064 // Our base class RenderWidgetHost needs to reset some stuff. | |
1065 RendererExited(render_view_termination_status_, exit_code); | |
1066 | |
1067 delegate_->RenderViewTerminated(this, | |
1068 static_cast<base::TerminationStatus>(status), | |
1069 exit_code); | |
1070 } | 1058 } |
1071 | 1059 |
1072 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1060 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
1073 // If the following DCHECK fails, you have encountered a tricky edge-case that | 1061 // If the following DCHECK fails, you have encountered a tricky edge-case that |
1074 // has evaded reproduction for a very long time. Please report what you were | 1062 // has evaded reproduction for a very long time. Please report what you were |
1075 // doing on http://crbug.com/407376, whether or not you can reproduce the | 1063 // doing on http://crbug.com/407376, whether or not you can reproduce the |
1076 // failure. | 1064 // failure. |
1077 DCHECK_EQ(page_id, page_id_); | 1065 DCHECK_EQ(page_id, page_id_); |
1078 | 1066 |
1079 // Without this check, the renderer can trick the browser into using | 1067 // Without this check, the renderer can trick the browser into using |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1479 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1467 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1480 | 1468 |
1481 frame_tree->ResetForMainFrameSwap(); | 1469 frame_tree->ResetForMainFrameSwap(); |
1482 } | 1470 } |
1483 | 1471 |
1484 void RenderViewHostImpl::SelectWordAroundCaret() { | 1472 void RenderViewHostImpl::SelectWordAroundCaret() { |
1485 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1473 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1486 } | 1474 } |
1487 | 1475 |
1488 } // namespace content | 1476 } // namespace content |
OLD | NEW |