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

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

Issue 452303003: Revert of 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>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 : RenderWidgetHostImpl(widget_delegate, 183 : RenderWidgetHostImpl(widget_delegate,
184 instance->GetProcess(), 184 instance->GetProcess(),
185 routing_id, 185 routing_id,
186 hidden), 186 hidden),
187 frames_ref_count_(0), 187 frames_ref_count_(0),
188 delegate_(delegate), 188 delegate_(delegate),
189 instance_(static_cast<SiteInstanceImpl*>(instance)), 189 instance_(static_cast<SiteInstanceImpl*>(instance)),
190 waiting_for_drag_context_response_(false), 190 waiting_for_drag_context_response_(false),
191 enabled_bindings_(0), 191 enabled_bindings_(0),
192 navigations_suspended_(false), 192 navigations_suspended_(false),
193 page_id_(-1),
194 main_frame_routing_id_(main_frame_routing_id), 193 main_frame_routing_id_(main_frame_routing_id),
195 run_modal_reply_msg_(NULL), 194 run_modal_reply_msg_(NULL),
196 run_modal_opener_id_(MSG_ROUTING_NONE), 195 run_modal_opener_id_(MSG_ROUTING_NONE),
197 is_waiting_for_beforeunload_ack_(false), 196 is_waiting_for_beforeunload_ack_(false),
198 unload_ack_is_for_cross_site_transition_(false), 197 unload_ack_is_for_cross_site_transition_(false),
199 sudden_termination_allowed_(false), 198 sudden_termination_allowed_(false),
200 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 199 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
201 virtual_keyboard_requested_(false), 200 virtual_keyboard_requested_(false),
202 weak_factory_(this), 201 weak_factory_(this),
203 is_focused_element_editable_(false) { 202 is_focused_element_editable_(false) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 DCHECK(GetProcess()->GetBrowserContext()); 276 DCHECK(GetProcess()->GetBrowserContext());
278 277
279 renderer_initialized_ = true; 278 renderer_initialized_ = true;
280 279
281 GpuSurfaceTracker::Get()->SetSurfaceHandle( 280 GpuSurfaceTracker::Get()->SetSurfaceHandle(
282 surface_id(), GetCompositingSurface()); 281 surface_id(), GetCompositingSurface());
283 282
284 // Ensure the RenderView starts with a next_page_id larger than any existing 283 // Ensure the RenderView starts with a next_page_id larger than any existing
285 // page ID it might be asked to render. 284 // page ID it might be asked to render.
286 int32 next_page_id = 1; 285 int32 next_page_id = 1;
287 if (max_page_id > -1) { 286 if (max_page_id > -1)
288 next_page_id = max_page_id + 1; 287 next_page_id = max_page_id + 1;
289 page_id_ = max_page_id;
290 }
291 288
292 ViewMsg_New_Params params; 289 ViewMsg_New_Params params;
293 params.renderer_preferences = 290 params.renderer_preferences =
294 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); 291 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext());
295 params.web_preferences = delegate_->GetWebkitPrefs(); 292 params.web_preferences = delegate_->GetWebkitPrefs();
296 params.view_id = GetRoutingID(); 293 params.view_id = GetRoutingID();
297 params.main_frame_routing_id = main_frame_routing_id_; 294 params.main_frame_routing_id = main_frame_routing_id_;
298 params.surface_id = surface_id(); 295 params.surface_id = surface_id();
299 params.session_storage_namespace_id = 296 params.session_storage_namespace_id =
300 delegate_->GetSessionStorageNamespace(instance_)->id(); 297 delegate_->GetSessionStorageNamespace(instance_)->id();
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 1104
1108 // Our base class RenderWidgetHost needs to reset some stuff. 1105 // Our base class RenderWidgetHost needs to reset some stuff.
1109 RendererExited(render_view_termination_status_, exit_code); 1106 RendererExited(render_view_termination_status_, exit_code);
1110 1107
1111 delegate_->RenderViewTerminated(this, 1108 delegate_->RenderViewTerminated(this,
1112 static_cast<base::TerminationStatus>(status), 1109 static_cast<base::TerminationStatus>(status),
1113 exit_code); 1110 exit_code);
1114 } 1111 }
1115 1112
1116 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) { 1113 void RenderViewHostImpl::OnUpdateState(int32 page_id, const PageState& state) {
1117 CHECK_EQ(page_id_, page_id);
1118 // Without this check, the renderer can trick the browser into using 1114 // Without this check, the renderer can trick the browser into using
1119 // filenames it can't access in a future session restore. 1115 // filenames it can't access in a future session restore.
1120 if (!CanAccessFilesOfPageState(state)) { 1116 if (!CanAccessFilesOfPageState(state)) {
1121 GetProcess()->ReceivedBadMessage(); 1117 GetProcess()->ReceivedBadMessage();
1122 return; 1118 return;
1123 } 1119 }
1124 1120
1125 delegate_->UpdateState(this, page_id_, state); 1121 delegate_->UpdateState(this, page_id, state);
1126 } 1122 }
1127 1123
1128 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) { 1124 void RenderViewHostImpl::OnUpdateTargetURL(int32 page_id, const GURL& url) {
1129 CHECK_EQ(page_id_, page_id);
1130 if (IsRVHStateActive(rvh_state_)) 1125 if (IsRVHStateActive(rvh_state_))
1131 delegate_->UpdateTargetURL(page_id_, url); 1126 delegate_->UpdateTargetURL(page_id, url);
1132 1127
1133 // Send a notification back to the renderer that we are ready to 1128 // Send a notification back to the renderer that we are ready to
1134 // receive more target urls. 1129 // receive more target urls.
1135 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID())); 1130 Send(new ViewMsg_UpdateTargetURL_ACK(GetRoutingID()));
1136 } 1131 }
1137 1132
1138 void RenderViewHostImpl::OnUpdateInspectorSetting( 1133 void RenderViewHostImpl::OnUpdateInspectorSetting(
1139 const std::string& key, const std::string& value) { 1134 const std::string& key, const std::string& value) {
1140 GetContentClient()->browser()->UpdateInspectorSetting( 1135 GetContentClient()->browser()->UpdateInspectorSetting(
1141 this, key, value); 1136 this, key, value);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 FrameTree* frame_tree = delegate_->GetFrameTree(); 1582 FrameTree* frame_tree = delegate_->GetFrameTree();
1588 1583
1589 frame_tree->ResetForMainFrameSwap(); 1584 frame_tree->ResetForMainFrameSwap();
1590 } 1585 }
1591 1586
1592 void RenderViewHostImpl::SelectWordAroundCaret() { 1587 void RenderViewHostImpl::SelectWordAroundCaret() {
1593 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1588 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1594 } 1589 }
1595 1590
1596 } // namespace content 1591 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/renderer_host/render_view_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698