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> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/crash_logging.h" |
14 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
15 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
16 #include "base/json/json_reader.h" | 17 #include "base/json/json_reader.h" |
17 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
19 #include "base/stl_util.h" | 20 #include "base/stl_util.h" |
| 21 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
21 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
22 #include "base/sys_info.h" | 24 #include "base/sys_info.h" |
23 #include "base/time/time.h" | 25 #include "base/time/time.h" |
24 #include "base/values.h" | 26 #include "base/values.h" |
25 #include "cc/base/switches.h" | 27 #include "cc/base/switches.h" |
26 #include "content/browser/child_process_security_policy_impl.h" | 28 #include "content/browser/child_process_security_policy_impl.h" |
27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 29 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
28 #include "content/browser/frame_host/frame_tree.h" | 30 #include "content/browser/frame_host/frame_tree.h" |
29 #include "content/browser/gpu/compositor_util.h" | 31 #include "content/browser/gpu/compositor_util.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 bool hidden) | 179 bool hidden) |
178 : RenderWidgetHostImpl(widget_delegate, | 180 : RenderWidgetHostImpl(widget_delegate, |
179 instance->GetProcess(), | 181 instance->GetProcess(), |
180 routing_id, | 182 routing_id, |
181 hidden), | 183 hidden), |
182 frames_ref_count_(0), | 184 frames_ref_count_(0), |
183 delegate_(delegate), | 185 delegate_(delegate), |
184 instance_(static_cast<SiteInstanceImpl*>(instance)), | 186 instance_(static_cast<SiteInstanceImpl*>(instance)), |
185 waiting_for_drag_context_response_(false), | 187 waiting_for_drag_context_response_(false), |
186 enabled_bindings_(0), | 188 enabled_bindings_(0), |
| 189 page_id_(-1), |
187 main_frame_routing_id_(main_frame_routing_id), | 190 main_frame_routing_id_(main_frame_routing_id), |
188 run_modal_reply_msg_(NULL), | 191 run_modal_reply_msg_(NULL), |
189 run_modal_opener_id_(MSG_ROUTING_NONE), | 192 run_modal_opener_id_(MSG_ROUTING_NONE), |
190 is_waiting_for_beforeunload_ack_(false), | 193 is_waiting_for_beforeunload_ack_(false), |
191 unload_ack_is_for_cross_site_transition_(false), | 194 unload_ack_is_for_cross_site_transition_(false), |
192 sudden_termination_allowed_(false), | 195 sudden_termination_allowed_(false), |
193 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 196 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
194 virtual_keyboard_requested_(false), | 197 virtual_keyboard_requested_(false), |
195 weak_factory_(this), | 198 weak_factory_(this), |
196 is_focused_element_editable_(false), | 199 is_focused_element_editable_(false), |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 | 1083 |
1081 // Our base class RenderWidgetHost needs to reset some stuff. | 1084 // Our base class RenderWidgetHost needs to reset some stuff. |
1082 RendererExited(render_view_termination_status_, exit_code); | 1085 RendererExited(render_view_termination_status_, exit_code); |
1083 | 1086 |
1084 delegate_->RenderViewTerminated(this, | 1087 delegate_->RenderViewTerminated(this, |
1085 static_cast<base::TerminationStatus>(status), | 1088 static_cast<base::TerminationStatus>(status), |
1086 exit_code); | 1089 exit_code); |
1087 } | 1090 } |
1088 | 1091 |
1089 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { | 1092 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { |
| 1093 if (page_id_ != page_id) { |
| 1094 base::debug::SetCrashKeyValue( |
| 1095 "url1", GetMainFrame()->GetLastCommittedURL().possibly_invalid_spec()); |
| 1096 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_)); |
| 1097 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id)); |
| 1098 CHECK(false); |
| 1099 } |
1090 // Without this check, the renderer can trick the browser into using | 1100 // Without this check, the renderer can trick the browser into using |
1091 // filenames it can't access in a future session restore. | 1101 // filenames it can't access in a future session restore. |
1092 if (!CanAccessFilesOfPageState(state)) { | 1102 if (!CanAccessFilesOfPageState(state)) { |
1093 GetProcess()->ReceivedBadMessage(); | 1103 GetProcess()->ReceivedBadMessage(); |
1094 return; | 1104 return; |
1095 } | 1105 } |
1096 | 1106 |
1097 delegate_->UpdateState(this, page_id, state); | 1107 delegate_->UpdateState(this, page_id_, state); |
1098 } | 1108 } |
1099 | 1109 |
1100 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { | 1110 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { |
| 1111 if (page_id_ != page_id) { |
| 1112 base::debug::SetCrashKeyValue("url1", url.possibly_invalid_spec()); |
| 1113 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_)); |
| 1114 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id)); |
| 1115 CHECK(false); |
| 1116 } |
1101 if (IsRVHStateActive(rvh_state_)) | 1117 if (IsRVHStateActive(rvh_state_)) |
1102 delegate_->UpdateTargetURL(page_id, url); | 1118 delegate_->UpdateTargetURL(page_id_, url); |
1103 | 1119 |
1104 // Send a notification back to the renderer that we are ready to | 1120 // Send a notification back to the renderer that we are ready to |
1105 // receive more target urls. | 1121 // receive more target urls. |
1106 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); | 1122 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); |
1107 } | 1123 } |
1108 | 1124 |
1109 void RenderViewHostImpl::OnClose() { | 1125 void RenderViewHostImpl::OnClose() { |
1110 // If the renderer is telling us to close, it has already run the unload | 1126 // If the renderer is telling us to close, it has already run the unload |
1111 // events, and we can take the fast path. | 1127 // events, and we can take the fast path. |
1112 ClosePageIgnoringUnloadEvents(); | 1128 ClosePageIgnoringUnloadEvents(); |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1527 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1512 | 1528 |
1513 frame_tree->ResetForMainFrameSwap(); | 1529 frame_tree->ResetForMainFrameSwap(); |
1514 } | 1530 } |
1515 | 1531 |
1516 void RenderViewHostImpl::SelectWordAroundCaret() { | 1532 void RenderViewHostImpl::SelectWordAroundCaret() { |
1517 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1533 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1518 } | 1534 } |
1519 | 1535 |
1520 } // namespace content | 1536 } // namespace content |
OLD | NEW |