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

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

Issue 1151973005: Bring RFH/RVH unit tests closer to reality of how RF/RV are initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add workaround to <webview> bug (492830) Created 5 years, 6 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // The renderer now has a RenderFrame for this RenderFrameHost. Note that 638 // The renderer now has a RenderFrame for this RenderFrameHost. Note that
639 // this path is only used for out-of-process iframes. Main frame RenderFrames 639 // this path is only used for out-of-process iframes. Main frame RenderFrames
640 // are created with their RenderView, and same-site iframes are created at the 640 // are created with their RenderView, and same-site iframes are created at the
641 // time of OnCreateChildFrame. 641 // time of OnCreateChildFrame.
642 SetRenderFrameCreated(true); 642 SetRenderFrameCreated(true);
643 643
644 return true; 644 return true;
645 } 645 }
646 646
647 bool RenderFrameHostImpl::IsRenderFrameLive() { 647 bool RenderFrameHostImpl::IsRenderFrameLive() {
648 // RenderFrames are created for main frames at the same time as RenderViews, 648 bool is_live = GetProcess()->HasConnection() && render_frame_created_;
649 // so we rely on IsRenderViewLive. For subframes, we keep track of each 649
650 // RenderFrame individually with render_frame_created_. 650 // If the process is for an isolated guest (e.g. <webview>), rely on the
651 bool is_live = !GetParent() ? 651 // RenderViewHost liveness check. Once https://crbug.com/492830 is fixed,
652 render_view_host_->IsRenderViewLive() : 652 // this can be removed.
653 GetProcess()->HasConnection() && render_frame_created_; 653 if (GetProcess()->IsIsolatedGuest())
654 is_live = render_view_host_->IsRenderViewLive();
ncarter (slow) 2015/05/29 00:01:18 If we're preserving the behavior of this function
nasko 2015/05/29 00:03:20 Not really. We don't support any cross-process nav
654 655
655 // Sanity check: the RenderView should always be live if the RenderFrame is. 656 // Sanity check: the RenderView should always be live if the RenderFrame is.
656 DCHECK(!is_live || render_view_host_->IsRenderViewLive()); 657 DCHECK(!is_live || render_view_host_->IsRenderViewLive());
657 658
658 return is_live; 659 return is_live;
659 } 660 }
660 661
661 void RenderFrameHostImpl::SetRenderFrameCreated(bool created) { 662 void RenderFrameHostImpl::SetRenderFrameCreated(bool created) {
662 bool was_created = render_frame_created_; 663 bool was_created = render_frame_created_;
663 render_frame_created_ = created; 664 render_frame_created_ = created;
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 // We may be returning to an existing NavigationEntry that had been granted 2072 // We may be returning to an existing NavigationEntry that had been granted
2072 // file access. If this is a different process, we will need to grant the 2073 // file access. If this is a different process, we will need to grant the
2073 // access again. The files listed in the page state are validated when they 2074 // access again. The files listed in the page state are validated when they
2074 // are received from the renderer to prevent abuse. 2075 // are received from the renderer to prevent abuse.
2075 if (request_params.page_state.IsValid()) { 2076 if (request_params.page_state.IsValid()) {
2076 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); 2077 render_view_host_->GrantFileAccessFromPageState(request_params.page_state);
2077 } 2078 }
2078 } 2079 }
2079 2080
2080 } // namespace content 2081 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698