| OLD | NEW |
| 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/frame_tree.h" | 5 #include "content/browser/frame_host/frame_tree.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool CreateProxyForSiteInstance(const scoped_refptr<SiteInstance>& instance, | 54 bool CreateProxyForSiteInstance(const scoped_refptr<SiteInstance>& instance, |
| 55 FrameTreeNode* node) { | 55 FrameTreeNode* node) { |
| 56 // If a new frame is created in the current SiteInstance, other frames in | 56 // If a new frame is created in the current SiteInstance, other frames in |
| 57 // that SiteInstance don't need a proxy for the new frame. | 57 // that SiteInstance don't need a proxy for the new frame. |
| 58 SiteInstance* current_instance = | 58 SiteInstance* current_instance = |
| 59 node->render_manager()->current_frame_host()->GetSiteInstance(); | 59 node->render_manager()->current_frame_host()->GetSiteInstance(); |
| 60 if (current_instance != instance.get()) | 60 if (current_instance != instance.get()) |
| 61 node->render_manager()->CreateRenderFrameProxy(instance.get()); | 61 node->render_manager()->CreateRenderFrameProxy(instance.get(), false); |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Helper function used with FrameTree::ForEach() for retrieving the total | 65 // Helper function used with FrameTree::ForEach() for retrieving the total |
| 66 // loading progress and number of frames in a frame tree. | 66 // loading progress and number of frames in a frame tree. |
| 67 bool CollectLoadProgress(double* progress, | 67 bool CollectLoadProgress(double* progress, |
| 68 int* frame_count, | 68 int* frame_count, |
| 69 FrameTreeNode* node) { | 69 FrameTreeNode* node) { |
| 70 // Ignore the current frame if it has not started loading. | 70 // Ignore the current frame if it has not started loading. |
| 71 if (!node->has_started_loading()) | 71 if (!node->has_started_loading()) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 void FrameTree::CreateProxiesForSiteInstance( | 221 void FrameTree::CreateProxiesForSiteInstance( |
| 222 FrameTreeNode* source, | 222 FrameTreeNode* source, |
| 223 SiteInstance* site_instance) { | 223 SiteInstance* site_instance) { |
| 224 // Create the swapped out RVH for the new SiteInstance. This will create | 224 // Create the swapped out RVH for the new SiteInstance. This will create |
| 225 // a top-level swapped out RFH as well, which will then be wrapped by a | 225 // a top-level swapped out RFH as well, which will then be wrapped by a |
| 226 // RenderFrameProxyHost. | 226 // RenderFrameProxyHost. |
| 227 if (!source || !source->IsMainFrame()) { | 227 if (!source || !source->IsMainFrame()) { |
| 228 RenderViewHostImpl* render_view_host = GetRenderViewHost(site_instance); | 228 RenderViewHostImpl* render_view_host = GetRenderViewHost(site_instance); |
| 229 if (!render_view_host) { | 229 if (!render_view_host) { |
| 230 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) { | 230 if (RenderFrameHostManager::IsSwappedOutStateForbidden()) { |
| 231 root()->render_manager()->CreateRenderFrameProxy(site_instance); | 231 root()->render_manager()->CreateRenderFrameProxy(site_instance, false); |
| 232 } else { | 232 } else { |
| 233 root()->render_manager()->CreateRenderFrame( | 233 root()->render_manager()->CreateRenderFrame( |
| 234 site_instance, nullptr, MSG_ROUTING_NONE, | 234 site_instance, nullptr, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, |
| 235 CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, nullptr); | 235 nullptr); |
| 236 } | 236 } |
| 237 } else { | 237 } else { |
| 238 root()->render_manager()->EnsureRenderViewInitialized(render_view_host, | 238 root()->render_manager()->EnsureRenderViewInitialized(render_view_host, |
| 239 site_instance); | 239 site_instance); |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 scoped_refptr<SiteInstance> instance(site_instance); | 243 scoped_refptr<SiteInstance> instance(site_instance); |
| 244 | 244 |
| 245 // Proxies are created in the FrameTree in response to a node navigating to a | 245 // Proxies are created in the FrameTree in response to a node navigating to a |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 load_progress_ = 0.0; | 397 load_progress_ = 0.0; |
| 398 } | 398 } |
| 399 | 399 |
| 400 bool FrameTree::IsLoading() { | 400 bool FrameTree::IsLoading() { |
| 401 bool is_loading = false; | 401 bool is_loading = false; |
| 402 ForEach(base::Bind(&IsNodeLoading, &is_loading)); | 402 ForEach(base::Bind(&IsNodeLoading, &is_loading)); |
| 403 return is_loading; | 403 return is_loading; |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace content | 406 } // namespace content |
| OLD | NEW |