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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1151393003: Add ref-count on RenderViewHost for each new RenderFrameProxyHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on Nick's review. Created 5 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 is_waiting_for_beforeunload_ack_(false), 159 is_waiting_for_beforeunload_ack_(false),
160 unload_ack_is_for_navigation_(false), 160 unload_ack_is_for_navigation_(false),
161 is_loading_(false), 161 is_loading_(false),
162 pending_commit_(false), 162 pending_commit_(false),
163 accessibility_reset_token_(0), 163 accessibility_reset_token_(0),
164 accessibility_reset_count_(0), 164 accessibility_reset_count_(0),
165 no_create_browser_accessibility_manager_for_testing_(false), 165 no_create_browser_accessibility_manager_for_testing_(false),
166 weak_ptr_factory_(this) { 166 weak_ptr_factory_(this) {
167 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT); 167 bool is_swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
168 bool hidden = !!(flags & CREATE_RF_HIDDEN); 168 bool hidden = !!(flags & CREATE_RF_HIDDEN);
169 frame_tree_->RegisterRenderFrameHost(this); 169 frame_tree_->AddRenderViewHostRef(render_view_host_);
170 GetProcess()->AddRoute(routing_id_, this); 170 GetProcess()->AddRoute(routing_id_, this);
171 g_routing_id_frame_map.Get().insert(std::make_pair( 171 g_routing_id_frame_map.Get().insert(std::make_pair(
172 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 172 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
173 this)); 173 this));
174 174
175 if (is_swapped_out) { 175 if (is_swapped_out) {
176 rfh_state_ = STATE_SWAPPED_OUT; 176 rfh_state_ = STATE_SWAPPED_OUT;
177 } else { 177 } else {
178 rfh_state_ = STATE_DEFAULT; 178 rfh_state_ = STATE_DEFAULT;
179 GetSiteInstance()->increment_active_frame_count(); 179 GetSiteInstance()->increment_active_frame_count();
(...skipping 20 matching lines...) Expand all
200 200
201 FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this); 201 FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this);
202 202
203 // If this was swapped out, it already decremented the active frame count of 203 // If this was swapped out, it already decremented the active frame count of
204 // the SiteInstance it belongs to. 204 // the SiteInstance it belongs to.
205 if (IsRFHStateActive(rfh_state_)) 205 if (IsRFHStateActive(rfh_state_))
206 GetSiteInstance()->decrement_active_frame_count(); 206 GetSiteInstance()->decrement_active_frame_count();
207 207
208 // Notify the FrameTree that this RFH is going away, allowing it to shut down 208 // Notify the FrameTree that this RFH is going away, allowing it to shut down
209 // the corresponding RenderViewHost if it is no longer needed. 209 // the corresponding RenderViewHost if it is no longer needed.
210 frame_tree_->UnregisterRenderFrameHost(this); 210 frame_tree_->ReleaseRenderViewHostRef(render_view_host_);
211 211
212 // NULL out the swapout timer; in crash dumps this member will be null only if 212 // NULL out the swapout timer; in crash dumps this member will be null only if
213 // the dtor has run. 213 // the dtor has run.
214 swapout_event_monitor_timeout_.reset(); 214 swapout_event_monitor_timeout_.reset();
215 215
216 for (const auto& iter: visual_state_callbacks_) { 216 for (const auto& iter: visual_state_callbacks_) {
217 iter.second.Run(false); 217 iter.second.Run(false);
218 } 218 }
219 219
220 if (render_widget_host_) { 220 if (render_widget_host_) {
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 // We may be returning to an existing NavigationEntry that had been granted 2068 // We may be returning to an existing NavigationEntry that had been granted
2069 // file access. If this is a different process, we will need to grant the 2069 // file access. If this is a different process, we will need to grant the
2070 // access again. The files listed in the page state are validated when they 2070 // access again. The files listed in the page state are validated when they
2071 // are received from the renderer to prevent abuse. 2071 // are received from the renderer to prevent abuse.
2072 if (request_params.page_state.IsValid()) { 2072 if (request_params.page_state.IsValid()) {
2073 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); 2073 render_view_host_->GrantFileAccessFromPageState(request_params.page_state);
2074 } 2074 }
2075 } 2075 }
2076 2076
2077 } // namespace content 2077 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree.cc ('k') | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698