diff options
author | nasko <nasko@chromium.org> | 2016-03-25 16:17:04 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 23:18:43 +0000 |
commit | 259799c180b8571c05473c0111f3e1fbf0e978ee (patch) | |
tree | b356df139fe50a254dc7620723a704eb9fb84eca | |
parent | 99a9fd01df438f41d7192e6581fe7b1cb4f18d99 (diff) | |
download | chromium_src-259799c180b8571c05473c0111f3e1fbf0e978ee.zip chromium_src-259799c180b8571c05473c0111f3e1fbf0e978ee.tar.gz chromium_src-259799c180b8571c05473c0111f3e1fbf0e978ee.tar.bz2 |
Remove CreateRenderFrameFlags enum.
The CreateRenderFrameFlags enum currently has only one value, which can
easily be replaced by a boolean. This CL is removing this enum in favor
of a bool value.
BUG=357747
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation
Review URL: https://codereview.chromium.org/1833243002
Cr-Commit-Position: refs/heads/master@{#383401}
8 files changed, 19 insertions, 36 deletions
diff --git a/content/browser/frame_host/render_frame_host_factory.cc b/content/browser/frame_host/render_frame_host_factory.cc index d91354b..92a449f 100644 --- a/content/browser/frame_host/render_frame_host_factory.cc +++ b/content/browser/frame_host/render_frame_host_factory.cc @@ -23,15 +23,15 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostFactory::Create( FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, - int flags) { + bool hidden) { if (factory_) { return factory_->CreateRenderFrameHost( site_instance, render_view_host, delegate, rwh_delegate, frame_tree, - frame_tree_node, routing_id, widget_routing_id, flags); + frame_tree_node, routing_id, widget_routing_id, hidden); } return make_scoped_ptr(new RenderFrameHostImpl( site_instance, render_view_host, delegate, rwh_delegate, frame_tree, - frame_tree_node, routing_id, widget_routing_id, flags)); + frame_tree_node, routing_id, widget_routing_id, hidden)); } // static diff --git a/content/browser/frame_host/render_frame_host_factory.h b/content/browser/frame_host/render_frame_host_factory.h index 1b2fdc3..d6eb490 100644 --- a/content/browser/frame_host/render_frame_host_factory.h +++ b/content/browser/frame_host/render_frame_host_factory.h @@ -37,7 +37,7 @@ class CONTENT_EXPORT RenderFrameHostFactory { FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, - int flags); + bool hidden); // Returns true if there is currently a globally-registered factory. static bool has_factory() { return !!factory_; } @@ -57,7 +57,7 @@ class CONTENT_EXPORT RenderFrameHostFactory { FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, - int flags) = 0; + bool hidden) = 0; // Registers a factory to be called when new RenderFrameHostImpls are created. // We have only one global factory, so there must be no factory registered diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 82a15ff..d45f4fe 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -184,7 +184,7 @@ RenderFrameHostImpl::RenderFrameHostImpl(SiteInstance* site_instance, FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, - int flags) + bool hidden) : render_view_host_(render_view_host), delegate_(delegate), site_instance_(static_cast<SiteInstanceImpl*>(site_instance)), @@ -212,7 +212,6 @@ RenderFrameHostImpl::RenderFrameHostImpl(SiteInstance* site_instance, is_in_commit_(false), last_navigation_lofi_state_(LOFI_UNSPECIFIED), weak_ptr_factory_(this) { - bool hidden = !!(flags & CREATE_RF_HIDDEN); frame_tree_->AddRenderViewHostRef(render_view_host_); GetProcess()->AddRoute(routing_id_, this); g_routing_id_frame_map.Get().insert(std::make_pair( diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h index 9c44727..33cb817 100644 --- a/content/browser/frame_host/render_frame_host_impl.h +++ b/content/browser/frame_host/render_frame_host_impl.h @@ -88,12 +88,6 @@ struct GlobalRequestID; struct Referrer; struct ResourceResponse; -// Flag arguments for RenderFrameHost creation. -enum CreateRenderFrameFlags { - // The RenderFrame is initially hidden. - CREATE_RF_HIDDEN = 1 << 0, -}; - class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost, public BrowserAccessibilityDelegate, public SiteInstanceImpl::Observer { @@ -569,7 +563,7 @@ class CONTENT_EXPORT RenderFrameHostImpl : public RenderFrameHost, FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, - int flags); + bool hidden); private: friend class TestRenderFrameHost; diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index 9d071d5..76fd8d2 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc @@ -94,10 +94,9 @@ void RenderFrameHostManager::Init(SiteInstance* site_instance, // https://crbug.com/545684 DCHECK(!frame_tree_node_->IsMainFrame() || view_routing_id == widget_routing_id); - int flags = delegate_->IsHidden() ? CREATE_RF_HIDDEN : 0; SetRenderFrameHost(CreateRenderFrameHost(site_instance, view_routing_id, frame_routing_id, widget_routing_id, - flags)); + delegate_->IsHidden())); // Notify the delegate of the creation of the current RenderFrameHost. // Do this only for subframes, as the main frame case is taken care of by @@ -1442,10 +1441,6 @@ const GURL& RenderFrameHostManager::GetCurrentURLForSiteInstance( void RenderFrameHostManager::CreatePendingRenderFrameHost( SiteInstance* old_instance, SiteInstance* new_instance) { - int create_render_frame_flags = 0; - if (delegate_->IsHidden()) - create_render_frame_flags |= CREATE_RF_HIDDEN; - if (pending_render_frame_host_) CancelPending(); @@ -1460,7 +1455,7 @@ void RenderFrameHostManager::CreatePendingRenderFrameHost( // Create a non-swapped-out RFH with the given opener. pending_render_frame_host_ = - CreateRenderFrame(new_instance, create_render_frame_flags, nullptr); + CreateRenderFrame(new_instance, delegate_->IsHidden(), nullptr); } void RenderFrameHostManager::CreateProxiesForNewRenderFrameHost( @@ -1516,12 +1511,10 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrameHost( int32_t view_routing_id, int32_t frame_routing_id, int32_t widget_routing_id, - int flags) { + bool hidden) { if (frame_routing_id == MSG_ROUTING_NONE) frame_routing_id = site_instance->GetProcess()->GetNextRoutingID(); - bool hidden = !!(flags & CREATE_RF_HIDDEN); - // Create a RVH for main frames, or find the existing one for subframes. FrameTree* frame_tree = frame_tree_node_->frame_tree(); RenderViewHostImpl* render_view_host = nullptr; @@ -1550,7 +1543,7 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrameHost( return RenderFrameHostFactory::Create( site_instance, render_view_host, render_frame_delegate_, render_widget_delegate_, frame_tree, frame_tree_node_, frame_routing_id, - widget_routing_id, flags); + widget_routing_id, hidden); } // PlzNavigate @@ -1569,18 +1562,15 @@ bool RenderFrameHostManager::CreateSpeculativeRenderFrameHost( CreateProxiesForNewRenderFrameHost(old_instance, new_instance); - int create_render_frame_flags = 0; - if (delegate_->IsHidden()) - create_render_frame_flags |= CREATE_RF_HIDDEN; speculative_render_frame_host_ = - CreateRenderFrame(new_instance, create_render_frame_flags, nullptr); + CreateRenderFrame(new_instance, delegate_->IsHidden(), nullptr); return !!speculative_render_frame_host_; } scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( SiteInstance* instance, - int flags, + bool hidden, int* view_routing_id_ptr) { int32_t widget_routing_id = MSG_ROUTING_NONE; RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); @@ -1608,7 +1598,7 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( } new_render_frame_host = CreateRenderFrameHost( - instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE, widget_routing_id, flags); + instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE, widget_routing_id, hidden); RenderViewHostImpl* render_view_host = new_render_frame_host->render_view_host(); diff --git a/content/browser/frame_host/render_frame_host_manager.h b/content/browser/frame_host/render_frame_host_manager.h index 12e1a1f..c758e8a 100644 --- a/content/browser/frame_host/render_frame_host_manager.h +++ b/content/browser/frame_host/render_frame_host_manager.h @@ -339,7 +339,7 @@ class CONTENT_EXPORT RenderFrameHostManager // is not nullptr it will be set to the routing id of the view associated with // the frame. scoped_ptr<RenderFrameHostImpl> CreateRenderFrame(SiteInstance* instance, - int flags, + bool hidden, int* view_routing_id_ptr); // Helper method to create and initialize a RenderFrameProxyHost and return @@ -643,7 +643,7 @@ class CONTENT_EXPORT RenderFrameHostManager int32_t view_routing_id, int32_t frame_routing_id, int32_t widget_routing_id, - int flags); + bool hidden); // PlzNavigate // Create and initialize a speculative RenderFrameHost for an ongoing diff --git a/content/test/test_render_frame_host_factory.cc b/content/test/test_render_frame_host_factory.cc index c5d016d..e0fed0d 100644 --- a/content/test/test_render_frame_host_factory.cc +++ b/content/test/test_render_frame_host_factory.cc @@ -28,10 +28,10 @@ TestRenderFrameHostFactory::CreateRenderFrameHost( FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, - int flags) { + bool hidden) { return make_scoped_ptr(new TestRenderFrameHost( site_instance, render_view_host, delegate, rwh_delegate, frame_tree, - frame_tree_node, routing_id, widget_routing_id, flags)); + frame_tree_node, routing_id, widget_routing_id, hidden)); } } // namespace content diff --git a/content/test/test_render_frame_host_factory.h b/content/test/test_render_frame_host_factory.h index 1682a50..4c35d49 100644 --- a/content/test/test_render_frame_host_factory.h +++ b/content/test/test_render_frame_host_factory.h @@ -35,7 +35,7 @@ class TestRenderFrameHostFactory : public RenderFrameHostFactory { FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, - int flags) override; + bool hidden) override; private: DISALLOW_COPY_AND_ASSIGN(TestRenderFrameHostFactory); |