Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 493853002: Keep a copy of page id in RenderViewHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 bool hidden) 181 bool hidden)
180 : RenderWidgetHostImpl(widget_delegate, 182 : RenderWidgetHostImpl(widget_delegate,
181 instance->GetProcess(), 183 instance->GetProcess(),
182 routing_id, 184 routing_id,
183 hidden), 185 hidden),
184 frames_ref_count_(0), 186 frames_ref_count_(0),
185 delegate_(delegate), 187 delegate_(delegate),
186 instance_(static_cast<SiteInstanceImpl*>(instance)), 188 instance_(static_cast<SiteInstanceImpl*>(instance)),
187 waiting_for_drag_context_response_(false), 189 waiting_for_drag_context_response_(false),
188 enabled_bindings_(0), 190 enabled_bindings_(0),
191 page_id_(-1),
189 main_frame_routing_id_(main_frame_routing_id), 192 main_frame_routing_id_(main_frame_routing_id),
190 run_modal_reply_msg_(NULL), 193 run_modal_reply_msg_(NULL),
191 run_modal_opener_id_(MSG_ROUTING_NONE), 194 run_modal_opener_id_(MSG_ROUTING_NONE),
192 is_waiting_for_beforeunload_ack_(false), 195 is_waiting_for_beforeunload_ack_(false),
193 unload_ack_is_for_cross_site_transition_(false), 196 unload_ack_is_for_cross_site_transition_(false),
194 sudden_termination_allowed_(false), 197 sudden_termination_allowed_(false),
195 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 198 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
196 virtual_keyboard_requested_(false), 199 virtual_keyboard_requested_(false),
197 weak_factory_(this), 200 weak_factory_(this),
198 is_focused_element_editable_(false), 201 is_focused_element_editable_(false),
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 1048
1046 // Our base class RenderWidgetHost needs to reset some stuff. 1049 // Our base class RenderWidgetHost needs to reset some stuff.
1047 RendererExited(render_view_termination_status_, exit_code); 1050 RendererExited(render_view_termination_status_, exit_code);
1048 1051
1049 delegate_->RenderViewTerminated(this, 1052 delegate_->RenderViewTerminated(this,
1050 static_cast<base::TerminationStatus>(status), 1053 static_cast<base::TerminationStatus>(status),
1051 exit_code); 1054 exit_code);
1052 } 1055 }
1053 1056
1054 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { 1057 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) {
1058 if (page_id_ != page_id) {
1059 base::debug::SetCrashKeyValue(
1060 "url1", GetMainFrame()->GetLastCommittedURL().possibly_invalid_spec());
1061 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_));
1062 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id));
1063 CHECK(false);
1064 }
1055 // Without this check, the renderer can trick the browser into using 1065 // Without this check, the renderer can trick the browser into using
1056 // filenames it can't access in a future session restore. 1066 // filenames it can't access in a future session restore.
1057 if (!CanAccessFilesOfPageState(state)) { 1067 if (!CanAccessFilesOfPageState(state)) {
1058 GetProcess()->ReceivedBadMessage(); 1068 GetProcess()->ReceivedBadMessage();
1059 return; 1069 return;
1060 } 1070 }
1061 1071
1062 delegate_->UpdateState(this, page_id, state); 1072 delegate_->UpdateState(this, page_id_, state);
1063 } 1073 }
1064 1074
1065 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { 1075 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) {
1076 if (page_id_ != page_id) {
1077 base::debug::SetCrashKeyValue("url1", url.possibly_invalid_spec());
1078 base::debug::SetCrashKeyValue("id1", base::IntToString(page_id_));
1079 base::debug::SetCrashKeyValue("id2", base::IntToString(page_id));
1080 CHECK(false);
1081 }
1066 if (IsRVHStateActive(rvh_state_)) 1082 if (IsRVHStateActive(rvh_state_))
1067 delegate_->UpdateTargetURL(page_id, url); 1083 delegate_->UpdateTargetURL(page_id_, url);
1068 1084
1069 // Send a notification back to the renderer that we are ready to 1085 // Send a notification back to the renderer that we are ready to
1070 // receive more target urls. 1086 // receive more target urls.
1071 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); 1087 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID()));
1072 } 1088 }
1073 1089
1074 void RenderViewHostImpl::OnUpdateInspectorSetting( 1090 void RenderViewHostImpl::OnUpdateInspectorSetting(
1075 const std::string& key, const std::string& value) { 1091 const std::string& key, const std::string& value) {
1076 GetContentClient()->browser()->UpdateInspectorSetting( 1092 GetContentClient()->browser()->UpdateInspectorSetting(
1077 this, key, value); 1093 this, key, value);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 FrameTree* frame_tree = delegate_->GetFrameTree(); 1548 FrameTree* frame_tree = delegate_->GetFrameTree();
1533 1549
1534 frame_tree->ResetForMainFrameSwap(); 1550 frame_tree->ResetForMainFrameSwap();
1535 } 1551 }
1536 1552
1537 void RenderViewHostImpl::SelectWordAroundCaret() { 1553 void RenderViewHostImpl::SelectWordAroundCaret() {
1538 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1554 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1539 } 1555 }
1540 1556
1541 } // namespace content 1557 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698