Chromium Code Reviews| 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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(ViewHostMsg_ShowView, OnShowView) | 883 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) |
| 884 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) | 884 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) |
| 885 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, | 885 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, |
| 886 OnShowFullscreenWidget) | 886 OnShowFullscreenWidget) |
| 887 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) | 887 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal) |
| 888 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 888 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
| 889 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone) | |
| 890 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) | 889 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) |
| 891 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) | 890 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) |
| 892 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) | 891 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) |
| 893 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) | 892 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) |
| 894 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, | 893 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, |
| 895 OnDocumentAvailableInMainFrame) | 894 OnDocumentAvailableInMainFrame) |
| 896 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, | 895 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, |
| 897 OnDidContentsPreferredSizeChange) | 896 OnDidContentsPreferredSizeChange) |
| 898 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, | 897 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, |
| 899 OnRouteCloseEvent) | 898 OnRouteCloseEvent) |
| 900 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) | 899 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteMessageEvent, OnRouteMessageEvent) |
| 901 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) | 900 IPC_MESSAGE_HANDLER(DragHostMsg_StartDragging, OnStartDragging) |
| 902 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) | 901 IPC_MESSAGE_HANDLER(DragHostMsg_UpdateDragCursor, OnUpdateDragCursor) |
| 903 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) | 902 IPC_MESSAGE_HANDLER(DragHostMsg_TargetDrop_ACK, OnTargetDropACK) |
| 904 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) | 903 IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus) |
| 905 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) | 904 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
| 906 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) | 905 IPC_MESSAGE_HANDLER(ViewHostMsg_ClosePage_ACK, OnClosePageACK) |
| 907 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) | 906 IPC_MESSAGE_HANDLER(ViewHostMsg_DidZoomURL, OnDidZoomURL) |
| 908 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) | 907 IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnRunFileChooser) |
| 909 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) | 908 IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeTouched, OnFocusedNodeTouched) |
| 909 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) | |
| 910 // Have the super handle all other messages. | 910 // Have the super handle all other messages. |
| 911 IPC_MESSAGE_UNHANDLED( | 911 IPC_MESSAGE_UNHANDLED( |
| 912 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) | 912 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) |
| 913 IPC_END_MESSAGE_MAP() | 913 IPC_END_MESSAGE_MAP() |
| 914 | 914 |
| 915 return handled; | 915 return handled; |
| 916 } | 916 } |
| 917 | 917 |
| 918 void RenderViewHostImpl::Init() { | 918 void RenderViewHostImpl::Init() { |
| 919 RenderWidgetHostImpl::Init(); | 919 RenderWidgetHostImpl::Init(); |
| (...skipping 124 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. |
|
Charlie Reis
2015/02/03 01:06:35
At some point, we'll need RenderWidgetHostImpl to
nasko
2015/02/04 16:51:31
Acknowledged.
| |
| 1056 render_view_termination_status_ = | |
| 1057 static_cast<base::TerminationStatus>(status); | |
| 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 } | 1056 } |
| 1071 | 1057 |
| 1072 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1058 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
| 1073 // If the following DCHECK fails, you have encountered a tricky edge-case that | 1059 // 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 | 1060 // 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 | 1061 // doing on http://crbug.com/407376, whether or not you can reproduce the |
| 1076 // failure. | 1062 // failure. |
| 1077 DCHECK_EQ(page_id, page_id_); | 1063 DCHECK_EQ(page_id, page_id_); |
| 1078 | 1064 |
| 1079 // Without this check, the renderer can trick the browser into using | 1065 // 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(); | 1465 FrameTree* frame_tree = delegate_->GetFrameTree(); |
| 1480 | 1466 |
| 1481 frame_tree->ResetForMainFrameSwap(); | 1467 frame_tree->ResetForMainFrameSwap(); |
| 1482 } | 1468 } |
| 1483 | 1469 |
| 1484 void RenderViewHostImpl::SelectWordAroundCaret() { | 1470 void RenderViewHostImpl::SelectWordAroundCaret() { |
| 1485 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1471 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
| 1486 } | 1472 } |
| 1487 | 1473 |
| 1488 } // namespace content | 1474 } // namespace content |
| OLD | NEW |