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

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

Issue 616133002: Make RenderFrame(Host) own a RenderWidget(Host). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test update, RWH lifetime fix Created 5 years, 11 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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 class CrossProcessFrameConnector; 53 class CrossProcessFrameConnector;
54 class CrossSiteTransferringRequest; 54 class CrossSiteTransferringRequest;
55 class FrameTree; 55 class FrameTree;
56 class FrameTreeNode; 56 class FrameTreeNode;
57 class PermissionServiceContext; 57 class PermissionServiceContext;
58 class RenderFrameHostDelegate; 58 class RenderFrameHostDelegate;
59 class RenderFrameProxyHost; 59 class RenderFrameProxyHost;
60 class RenderProcessHost; 60 class RenderProcessHost;
61 class RenderViewHostImpl; 61 class RenderViewHostImpl;
62 class RenderWidgetHostDelegate;
62 class RenderWidgetHostImpl; 63 class RenderWidgetHostImpl;
64 class RenderWidgetHostView;
63 class StreamHandle; 65 class StreamHandle;
64 class TimeoutMonitor; 66 class TimeoutMonitor;
65 struct CommitNavigationParams; 67 struct CommitNavigationParams;
66 struct CommonNavigationParams; 68 struct CommonNavigationParams;
67 struct ContextMenuParams; 69 struct ContextMenuParams;
68 struct GlobalRequestID; 70 struct GlobalRequestID;
69 struct Referrer; 71 struct Referrer;
70 struct ResourceResponse; 72 struct ResourceResponse;
71 struct TransitionLayerData; 73 struct TransitionLayerData;
72 74
73 // Flag arguments for RenderFrameHost creation. 75 // Flag arguments for RenderFrameHost creation.
74 enum CreateRenderFrameFlags { 76 enum CreateRenderFrameFlags {
75 // The RFH will be initially placed on the swapped out hosts list. 77 // The RFH will be initially placed on the swapped out hosts list.
76 CREATE_RF_SWAPPED_OUT = 1 << 0, 78 CREATE_RF_SWAPPED_OUT = 1 << 0,
77 // The new RenderFrame is being created for a navigation of the 79 // The new RenderFrame is being created for a navigation of the
78 // top-level frame. 80 // top-level frame.
79 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION = 1 << 1, 81 CREATE_RF_FOR_MAIN_FRAME_NAVIGATION = 1 << 1,
80 // The RenderFrame is initially hidden. 82 // The RenderFrame is initially hidden.
81 CREATE_RF_HIDDEN = 1 << 2 83 CREATE_RF_HIDDEN = 1 << 2,
84 // The RenderFrameHost will have a new RenderWidgetHost created and
85 // attached to it. This is used when the RenderFrameHost is in a different
86 // process from its parent frame.
87 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3
82 }; 88 };
83 89
84 class CONTENT_EXPORT RenderFrameHostImpl 90 class CONTENT_EXPORT RenderFrameHostImpl
85 : public RenderFrameHost, 91 : public RenderFrameHost,
86 public BrowserAccessibilityDelegate { 92 public BrowserAccessibilityDelegate {
87 public: 93 public:
88 // Keeps track of the state of the RenderFrameHostImpl, particularly with 94 // Keeps track of the state of the RenderFrameHostImpl, particularly with
89 // respect to swap out. 95 // respect to swap out.
90 enum RenderFrameHostImplState { 96 enum RenderFrameHostImplState {
91 // The standard state for a RFH handling the communication with an active 97 // The standard state for a RFH handling the communication with an active
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // after they are blocked in RenderWidgetHelper::CreateNewWindow. 188 // after they are blocked in RenderWidgetHelper::CreateNewWindow.
183 void Init(); 189 void Init();
184 190
185 int routing_id() const { return routing_id_; } 191 int routing_id() const { return routing_id_; }
186 void OnCreateChildFrame(int new_routing_id, 192 void OnCreateChildFrame(int new_routing_id,
187 const std::string& frame_name); 193 const std::string& frame_name);
188 194
189 RenderViewHostImpl* render_view_host() { return render_view_host_; } 195 RenderViewHostImpl* render_view_host() { return render_view_host_; }
190 RenderFrameHostDelegate* delegate() { return delegate_; } 196 RenderFrameHostDelegate* delegate() { return delegate_; }
191 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 197 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
192 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in 198
193 // the future, so update this accessor to return the right pointer. 199 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
200 // or else it returns nullptr.
201 // If the RenderFrameHost is the page's main frame, this returns instead a
202 // pointer to the RenderViewHost (which inherits RenderWidgetHost).
194 RenderWidgetHostImpl* GetRenderWidgetHost(); 203 RenderWidgetHostImpl* GetRenderWidgetHost();
195 204
205 // This returns the RenderWidgetHostView that can be used to control
206 // focus and visibility for this frame.
207 RenderWidgetHostView* GetView();
208
196 // This function is called when this is a swapped out RenderFrameHost that 209 // This function is called when this is a swapped out RenderFrameHost that
197 // lives in the same process as the parent frame. The 210 // lives in the same process as the parent frame. The
198 // |cross_process_frame_connector| allows the non-swapped-out 211 // |cross_process_frame_connector| allows the non-swapped-out
199 // RenderFrameHost for a frame to communicate with the parent process 212 // RenderFrameHost for a frame to communicate with the parent process
200 // so that it may composite drawing data. 213 // so that it may composite drawing data.
201 // 214 //
202 // Ownership is not transfered. 215 // Ownership is not transfered.
203 void set_cross_process_frame_connector( 216 void set_cross_process_frame_connector(
204 CrossProcessFrameConnector* cross_process_frame_connector) { 217 CrossProcessFrameConnector* cross_process_frame_connector) {
205 cross_process_frame_connector_ = cross_process_frame_connector; 218 cross_process_frame_connector_ = cross_process_frame_connector;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 403
391 protected: 404 protected:
392 friend class RenderFrameHostFactory; 405 friend class RenderFrameHostFactory;
393 406
394 // |flags| is a combination of CreateRenderFrameFlags. 407 // |flags| is a combination of CreateRenderFrameFlags.
395 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 408 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost
396 // should be the abstraction needed here, but we need RenderViewHost to pass 409 // should be the abstraction needed here, but we need RenderViewHost to pass
397 // into WebContentsObserver::FrameDetached for now. 410 // into WebContentsObserver::FrameDetached for now.
398 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 411 RenderFrameHostImpl(RenderViewHostImpl* render_view_host,
399 RenderFrameHostDelegate* delegate, 412 RenderFrameHostDelegate* delegate,
413 RenderWidgetHostDelegate* rwh_delegate,
400 FrameTree* frame_tree, 414 FrameTree* frame_tree,
401 FrameTreeNode* frame_tree_node, 415 FrameTreeNode* frame_tree_node,
402 int routing_id, 416 int routing_id,
403 int flags); 417 int flags);
404 418
405 private: 419 private:
406 friend class TestRenderFrameHost; 420 friend class TestRenderFrameHost;
407 friend class TestRenderViewHost; 421 friend class TestRenderViewHost;
408 422
409 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); 423 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 // messages from the renderer requesting DOM manipulation. 543 // messages from the renderer requesting DOM manipulation.
530 FrameTree* frame_tree_; 544 FrameTree* frame_tree_;
531 545
532 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. 546 // The FrameTreeNode which this RenderFrameHostImpl is hosted in.
533 FrameTreeNode* frame_tree_node_; 547 FrameTreeNode* frame_tree_node_;
534 548
535 // The mapping of pending JavaScript calls created by 549 // The mapping of pending JavaScript calls created by
536 // ExecuteJavaScript and their corresponding callbacks. 550 // ExecuteJavaScript and their corresponding callbacks.
537 std::map<int, JavaScriptResultCallback> javascript_callbacks_; 551 std::map<int, JavaScriptResultCallback> javascript_callbacks_;
538 552
553 // RenderFrameHosts that need management of the rendering and input events
554 // for their frame subtrees require RenderWidgetHosts. This typically
555 // means frames that are rendered in different processes from their parent
556 // frames.
557 // TODO(kenrb): Later this will also be used on the top-level frame, when
558 // RenderFrameHost owns its RenderViewHost.
559 scoped_ptr<RenderWidgetHostImpl> render_widget_host_;
560
539 int routing_id_; 561 int routing_id_;
540 562
541 // The current state of this RenderFrameHost. 563 // The current state of this RenderFrameHost.
542 RenderFrameHostImplState rfh_state_; 564 RenderFrameHostImplState rfh_state_;
543 565
544 // Tracks whether the RenderFrame for this RenderFrameHost has been created in 566 // Tracks whether the RenderFrame for this RenderFrameHost has been created in
545 // the renderer process. Currently only used for subframes. 567 // the renderer process. Currently only used for subframes.
546 // TODO(creis): Use this for main frames as well when RVH goes away. 568 // TODO(creis): Use this for main frames as well when RVH goes away.
547 bool render_frame_created_; 569 bool render_frame_created_;
548 570
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 639
618 // NOTE: This must be the last member. 640 // NOTE: This must be the last member.
619 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 641 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
620 642
621 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 643 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
622 }; 644 };
623 645
624 } // namespace content 646 } // namespace content
625 647
626 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 648 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698