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

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: Send Detach IPC from the RFH destructor. Created 5 years 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 int routing_id, 169 int routing_id,
170 int proxy_routing_id, 170 int proxy_routing_id,
171 int opener_routing_id, 171 int opener_routing_id,
172 int parent_routing_id, 172 int parent_routing_id,
173 int previous_sibling_routing_id, 173 int previous_sibling_routing_id,
174 const FrameReplicationState& replicated_state, 174 const FrameReplicationState& replicated_state,
175 CompositorDependencies* compositor_deps, 175 CompositorDependencies* compositor_deps,
176 const FrameMsg_NewFrame_WidgetParams& params, 176 const FrameMsg_NewFrame_WidgetParams& params,
177 const blink::WebFrameOwnerProperties& frameOwner_properties); 177 const blink::WebFrameOwnerProperties& frameOwner_properties);
178 178
179 // Detaches a RenderFrame identified by |routing_id|.
180 static void DetachFrame(int routing_id);
181
179 // Returns the RenderFrameImpl for the given routing ID. 182 // Returns the RenderFrameImpl for the given routing ID.
180 static RenderFrameImpl* FromRoutingID(int routing_id); 183 static RenderFrameImpl* FromRoutingID(int routing_id);
181 184
182 // Just like RenderFrame::FromWebFrame but returns the implementation. 185 // Just like RenderFrame::FromWebFrame but returns the implementation.
183 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); 186 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
184 187
185 // Used by content_layouttest_support to hook into the creation of 188 // Used by content_layouttest_support to hook into the creation of
186 // RenderFrameImpls. 189 // RenderFrameImpls.
187 struct CreateParams { 190 struct CreateParams {
188 CreateParams(RenderViewImpl* render_view, int32 routing_id) 191 CreateParams(RenderViewImpl* render_view, int32 routing_id)
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 void RegisterMojoServices(); 920 void RegisterMojoServices();
918 921
919 // Connects to a Mojo application and returns a proxy to its exposed 922 // Connects to a Mojo application and returns a proxy to its exposed
920 // ServiceProvider. 923 // ServiceProvider.
921 mojo::ServiceProviderPtr ConnectToApplication(const GURL& url); 924 mojo::ServiceProviderPtr ConnectToApplication(const GURL& url);
922 925
923 // Returns the media delegate for WebMediaPlayer usage. If 926 // Returns the media delegate for WebMediaPlayer usage. If
924 // |media_player_delegate_| is NULL, one is created. 927 // |media_player_delegate_| is NULL, one is created.
925 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate(); 928 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
926 929
930 void set_in_browser_initiated_detach() {
931 in_browser_initiated_detach_ = true;
932 }
933
927 // Stores the WebLocalFrame we are associated with. This is null from the 934 // Stores the WebLocalFrame we are associated with. This is null from the
928 // constructor until SetWebFrame is called, and it is null after 935 // constructor until SetWebFrame is called, and it is null after
929 // frameDetached is called until destruction (which is asynchronous in the 936 // frameDetached is called until destruction (which is asynchronous in the
930 // case of the main frame, but not subframes). 937 // case of the main frame, but not subframes).
931 blink::WebLocalFrame* frame_; 938 blink::WebLocalFrame* frame_;
932 939
933 // Boolean value indicating whether this RenderFrameImpl object is for the 940 // Boolean value indicating whether this RenderFrameImpl object is for the
934 // main frame or not. It remains accurate during destruction, even when 941 // main frame or not. It remains accurate during destruction, even when
935 // |frame_| has been invalidated. 942 // |frame_| has been invalidated.
936 bool is_main_frame_; 943 bool is_main_frame_;
937 944
945 // Frame is a local root if it is rendered in a process different than parent
946 // or it is a main frame.
947 bool is_local_root_;
948
949 // When a frame is detached in response to a message from the browser process,
950 // this RenderFrame should not be sending notifications back to it. This
951 // boolean is used to indicate this case.
952 bool in_browser_initiated_detach_;
953
954 // Indicates which of the two states this frame is currently in.
955 //
956 // When a frame is created by the browser process, it is for a pending
957 // navigation. In this case, it is not immediately attached to the frame tree
958 // and is inserted into it at the time the pending navigation commits.
959 // Frames added by the parent document are created from the renderer process
960 // and are immediately inserted in the frame tree.
961 bool in_frame_tree_;
dcheng 2015/12/11 23:40:17 You can TODO(dcheng) to clean this up: FrameTreeHa
nasko 2015/12/14 21:00:02 Done.
962
938 base::WeakPtr<RenderViewImpl> render_view_; 963 base::WeakPtr<RenderViewImpl> render_view_;
939 int routing_id_; 964 int routing_id_;
940 bool is_swapped_out_; 965 bool is_swapped_out_;
941 966
942 // RenderFrameProxy exists only when is_swapped_out_ is true. 967 // RenderFrameProxy exists only when is_swapped_out_ is true.
943 // TODO(nasko): This can be removed once we don't have a swapped out state on 968 // TODO(nasko): This can be removed once we don't have a swapped out state on
944 // RenderFrame. See https://crbug.com/357747. 969 // RenderFrame. See https://crbug.com/357747.
945 RenderFrameProxy* render_frame_proxy_; 970 RenderFrameProxy* render_frame_proxy_;
946 bool is_detaching_; 971 bool is_detaching_;
947 972
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 #endif 1154 #endif
1130 1155
1131 base::WeakPtrFactory<RenderFrameImpl> weak_factory_; 1156 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1132 1157
1133 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); 1158 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1134 }; 1159 };
1135 1160
1136 } // namespace content 1161 } // namespace content
1137 1162
1138 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ 1163 #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698