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

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

Powered by Google App Engine
This is Rietveld 408576698