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

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

Issue 23841002: Create a new RenderFrameHost per child frame when --site-per-process is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and add some comments. Created 7 years, 3 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 10 matching lines...) Expand all
21 #include "base/strings/string_util.h" 21 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 22 #include "base/strings/utf_string_conversions.h"
23 #include "base/time/time.h" 23 #include "base/time/time.h"
24 #include "base/values.h" 24 #include "base/values.h"
25 #include "content/browser/child_process_security_policy_impl.h" 25 #include "content/browser/child_process_security_policy_impl.h"
26 #include "content/browser/cross_site_request_manager.h" 26 #include "content/browser/cross_site_request_manager.h"
27 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 27 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
28 #include "content/browser/gpu/gpu_surface_tracker.h" 28 #include "content/browser/gpu/gpu_surface_tracker.h"
29 #include "content/browser/host_zoom_map_impl.h" 29 #include "content/browser/host_zoom_map_impl.h"
30 #include "content/browser/renderer_host/dip_util.h" 30 #include "content/browser/renderer_host/dip_util.h"
31 #include "content/browser/renderer_host/frame_tree.h"
31 #include "content/browser/renderer_host/render_process_host_impl.h" 32 #include "content/browser/renderer_host/render_process_host_impl.h"
32 #include "content/browser/renderer_host/render_view_host_delegate.h" 33 #include "content/browser/renderer_host/render_view_host_delegate.h"
33 #include "content/common/accessibility_messages.h" 34 #include "content/common/accessibility_messages.h"
34 #include "content/common/browser_plugin/browser_plugin_messages.h" 35 #include "content/common/browser_plugin/browser_plugin_messages.h"
35 #include "content/common/desktop_notification_messages.h" 36 #include "content/common/desktop_notification_messages.h"
36 #include "content/common/drag_messages.h" 37 #include "content/common/drag_messages.h"
37 #include "content/common/input_messages.h" 38 #include "content/common/input_messages.h"
38 #include "content/common/inter_process_time_ticks_converter.h" 39 #include "content/common/inter_process_time_ticks_converter.h"
39 #include "content/common/speech_recognition_messages.h" 40 #include "content/common/speech_recognition_messages.h"
40 #include "content/common/swapped_out_messages.h" 41 #include "content/common/swapped_out_messages.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 are_javascript_messages_suppressed_(false), 177 are_javascript_messages_suppressed_(false),
177 sudden_termination_allowed_(false), 178 sudden_termination_allowed_(false),
178 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) { 179 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING) {
179 DCHECK(instance_.get()); 180 DCHECK(instance_.get());
180 CHECK(delegate_); // http://crbug.com/82827 181 CHECK(delegate_); // http://crbug.com/82827
181 182
182 if (main_frame_routing_id == MSG_ROUTING_NONE) 183 if (main_frame_routing_id == MSG_ROUTING_NONE)
183 main_frame_routing_id = GetProcess()->GetNextRoutingID(); 184 main_frame_routing_id = GetProcess()->GetNextRoutingID();
184 185
185 main_render_frame_host_.reset( 186 main_render_frame_host_.reset(
186 new RenderFrameHostImpl(this, main_frame_routing_id, is_swapped_out_)); 187 new RenderFrameHostImpl(GetProcess(), delegate_->GetFrameTree(),
188 main_frame_routing_id, is_swapped_out_));
187 189
188 GetProcess()->EnableSendQueue(); 190 GetProcess()->EnableSendQueue();
189 191
190 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) 192 for (size_t i = 0; i < g_created_callbacks.Get().size(); i++)
191 g_created_callbacks.Get().at(i).Run(this); 193 g_created_callbacks.Get().at(i).Run(this);
192 194
193 if (!swapped_out) 195 if (!swapped_out)
194 instance_->increment_active_view_count(); 196 instance_->increment_active_view_count();
195 197
196 #if defined(OS_ANDROID) 198 #if defined(OS_ANDROID)
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // page ID it might be asked to render. 249 // page ID it might be asked to render.
248 int32 next_page_id = 1; 250 int32 next_page_id = 1;
249 if (max_page_id > -1) 251 if (max_page_id > -1)
250 next_page_id = max_page_id + 1; 252 next_page_id = max_page_id + 1;
251 253
252 ViewMsg_New_Params params; 254 ViewMsg_New_Params params;
253 params.renderer_preferences = 255 params.renderer_preferences =
254 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext()); 256 delegate_->GetRendererPrefs(GetProcess()->GetBrowserContext());
255 params.web_preferences = delegate_->GetWebkitPrefs(); 257 params.web_preferences = delegate_->GetWebkitPrefs();
256 params.view_id = GetRoutingID(); 258 params.view_id = GetRoutingID();
257 params.main_frame_routing_id = main_render_frame_host_->routing_id(); 259 params.main_frame_routing_id = main_render_frame_host()->routing_id();
258 params.surface_id = surface_id(); 260 params.surface_id = surface_id();
259 params.session_storage_namespace_id = 261 params.session_storage_namespace_id =
260 delegate_->GetSessionStorageNamespace(instance_)->id(); 262 delegate_->GetSessionStorageNamespace(instance_)->id();
261 params.frame_name = frame_name; 263 params.frame_name = frame_name;
262 // Ensure the RenderView sets its opener correctly. 264 // Ensure the RenderView sets its opener correctly.
263 params.opener_route_id = opener_route_id; 265 params.opener_route_id = opener_route_id;
264 params.swapped_out = is_swapped_out_; 266 params.swapped_out = is_swapped_out_;
265 params.hidden = is_hidden(); 267 params.hidden = is_hidden();
266 params.next_page_id = next_page_id; 268 params.next_page_id = next_page_id;
267 GetWebScreenInfo(&params.screen_info); 269 GetWebScreenInfo(&params.screen_info);
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 params.item_font_size, 2029 params.item_font_size,
2028 params.selected_item, 2030 params.selected_item,
2029 params.popup_items, 2031 params.popup_items,
2030 params.right_aligned, 2032 params.right_aligned,
2031 params.allow_multiple_selection); 2033 params.allow_multiple_selection);
2032 } 2034 }
2033 } 2035 }
2034 #endif 2036 #endif
2035 2037
2036 RenderFrameHostImpl* RenderViewHostImpl::main_render_frame_host() const { 2038 RenderFrameHostImpl* RenderViewHostImpl::main_render_frame_host() const {
2037 DCHECK_EQ(GetProcess(), main_render_frame_host_->GetProcess()); 2039 // TODO(ajwong): Rename this function.
2038 return main_render_frame_host_.get(); 2040 RenderFrameHostImpl* render_frame_host = main_render_frame_host_.get();
2041 if (!render_frame_host)
2042 render_frame_host = delegate_->GetFrameTree()->GetMainFrame();
2043 DCHECK_EQ(GetProcess(), render_frame_host->GetProcess());
2044 return render_frame_host;
2039 } 2045 }
2040 2046
2041 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) { 2047 void RenderViewHostImpl::SetSwappedOut(bool is_swapped_out) {
2042 // We update the number of RenderViews in a SiteInstance when the 2048 // We update the number of RenderViews in a SiteInstance when the
2043 // swapped out status of this RenderView gets flipped. 2049 // swapped out status of this RenderView gets flipped.
2044 if (is_swapped_out_ && !is_swapped_out) 2050 if (is_swapped_out_ && !is_swapped_out)
2045 instance_->increment_active_view_count(); 2051 instance_->increment_active_view_count();
2046 else if (!is_swapped_out_ && is_swapped_out) 2052 else if (!is_swapped_out_ && is_swapped_out)
2047 instance_->decrement_active_view_count(); 2053 instance_->decrement_active_view_count();
2048 2054
(...skipping 14 matching lines...) Expand all
2063 2069
2064 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); 2070 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
2065 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); 2071 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
2066 file != file_paths.end(); ++file) { 2072 file != file_paths.end(); ++file) {
2067 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) 2073 if (!policy->CanReadFile(GetProcess()->GetID(), *file))
2068 return false; 2074 return false;
2069 } 2075 }
2070 return true; 2076 return true;
2071 } 2077 }
2072 2078
2079 void RenderViewHostImpl::SwapIntoFrameTree(
2080 RenderViewHostImpl* old_render_view_host) {
2081 FrameTree* frame_tree = delegate_->GetFrameTree();
2082 if (old_render_view_host) {
2083 old_render_view_host->main_render_frame_host_ =
2084 frame_tree->SwapMainFrame(main_render_frame_host_.Pass());
2085 } else {
2086 frame_tree->SwapMainFrame(main_render_frame_host_.Pass());
2087 }
2088
2089 if (main_frame_id() != -1) {
nasko 2013/09/11 22:26:24 Why not use the kInvalidFrameId constant here?
awong 2013/09/21 01:19:56 Done.
2090 frame_tree->OnFirstNavigation(main_frame_id());
2091 }
2092 }
2093
2073 } // namespace content 2094 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698