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

Side by Side Diff: content/renderer/render_frame_impl.h

Issue 1409693009: Fix leaking of RenderFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes based on another review round. Created 5 years, 1 month 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 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ 6 #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // process. All other frame creation is driven through Blink and Create. 160 // process. All other frame creation is driven through Blink and Create.
161 static void CreateFrame(int routing_id, 161 static void CreateFrame(int routing_id,
162 int proxy_routing_id, 162 int proxy_routing_id,
163 int opener_routing_id, 163 int opener_routing_id,
164 int parent_routing_id, 164 int parent_routing_id,
165 int previous_sibling_routing_id, 165 int previous_sibling_routing_id,
166 const FrameReplicationState& replicated_state, 166 const FrameReplicationState& replicated_state,
167 CompositorDependencies* compositor_deps, 167 CompositorDependencies* compositor_deps,
168 const FrameMsg_NewFrame_WidgetParams& params); 168 const FrameMsg_NewFrame_WidgetParams& params);
169 169
170 // Detaches a RenderFrame identified by |routing_id|.
171 static void DetachFrame(int routing_id);
172
170 // Returns the RenderFrameImpl for the given routing ID. 173 // Returns the RenderFrameImpl for the given routing ID.
171 static RenderFrameImpl* FromRoutingID(int routing_id); 174 static RenderFrameImpl* FromRoutingID(int routing_id);
172 175
173 // Just like RenderFrame::FromWebFrame but returns the implementation. 176 // Just like RenderFrame::FromWebFrame but returns the implementation.
174 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); 177 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
175 178
176 // Used by content_layouttest_support to hook into the creation of 179 // Used by content_layouttest_support to hook into the creation of
177 // RenderFrameImpls. 180 // RenderFrameImpls.
178 struct CreateParams { 181 struct CreateParams {
179 CreateParams(RenderViewImpl* render_view, int32 routing_id) 182 CreateParams(RenderViewImpl* render_view, int32 routing_id)
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 #endif 879 #endif
877 880
878 media::CdmFactory* GetCdmFactory(); 881 media::CdmFactory* GetCdmFactory();
879 882
880 void RegisterMojoServices(); 883 void RegisterMojoServices();
881 884
882 // Connects to a Mojo application and returns a proxy to its exposed 885 // Connects to a Mojo application and returns a proxy to its exposed
883 // ServiceProvider. 886 // ServiceProvider.
884 mojo::ServiceProviderPtr ConnectToApplication(const GURL& url); 887 mojo::ServiceProviderPtr ConnectToApplication(const GURL& url);
885 888
889 void set_in_browser_initiated_detach() {
890 in_browser_initiated_detach_ = true;
891 }
892
886 // Stores the WebLocalFrame we are associated with. This is null from the 893 // Stores the WebLocalFrame we are associated with. This is null from the
887 // constructor until SetWebFrame is called, and it is null after 894 // constructor until SetWebFrame is called, and it is null after
888 // frameDetached is called until destruction (which is asynchronous in the 895 // frameDetached is called until destruction (which is asynchronous in the
889 // case of the main frame, but not subframes). 896 // case of the main frame, but not subframes).
890 blink::WebLocalFrame* frame_; 897 blink::WebLocalFrame* frame_;
891 898
892 // Boolean value indicating whether this RenderFrameImpl object is for the 899 // Boolean value indicating whether this RenderFrameImpl object is for the
893 // main frame or not. It remains accurate during destruction, even when 900 // main frame or not. It remains accurate during destruction, even when
894 // |frame_| has been invalidated. 901 // |frame_| has been invalidated.
895 bool is_main_frame_; 902 bool is_main_frame_;
896 903
897 // Frame is a local root if it is rendered in a process different than parent 904 // Frame is a local root if it is rendered in a process different than parent
898 // or it is a main frame. 905 // or it is a main frame.
899 bool is_local_root_; 906 bool is_local_root_;
900 907
908 // When a frame is detached in response to a messge from the browser process,
909 // this RenderFrame should not be sending notifications back to it. This
910 // boolean is used to indicate this case.
911 bool in_browser_initiated_detach_;
912
901 base::WeakPtr<RenderViewImpl> render_view_; 913 base::WeakPtr<RenderViewImpl> render_view_;
902 int routing_id_; 914 int routing_id_;
903 bool is_swapped_out_; 915 bool is_swapped_out_;
904 916
905 // RenderFrameProxy exists only when is_swapped_out_ is true. 917 // RenderFrameProxy exists only when is_swapped_out_ is true.
906 // TODO(nasko): This can be removed once we don't have a swapped out state on 918 // TODO(nasko): This can be removed once we don't have a swapped out state on
907 // RenderFrame. See https://crbug.com/357747. 919 // RenderFrame. See https://crbug.com/357747.
908 RenderFrameProxy* render_frame_proxy_; 920 RenderFrameProxy* render_frame_proxy_;
909 bool is_detaching_; 921 bool is_detaching_;
910 922
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 #endif 1090 #endif
1079 1091
1080 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; 1092 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1081 1093
1082 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); 1094 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1083 }; 1095 };
1084 1096
1085 } // namespace content 1097 } // namespace content
1086 1098
1087 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ 1099 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698