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

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: Fixed output surface problems, combined RenderFrame and RenderWidget creation Created 6 years, 2 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 namespace content { 46 namespace content {
47 47
48 class CrossProcessFrameConnector; 48 class CrossProcessFrameConnector;
49 class CrossSiteTransferringRequest; 49 class CrossSiteTransferringRequest;
50 class FrameTree; 50 class FrameTree;
51 class FrameTreeNode; 51 class FrameTreeNode;
52 class RenderFrameHostDelegate; 52 class RenderFrameHostDelegate;
53 class RenderFrameProxyHost; 53 class RenderFrameProxyHost;
54 class RenderProcessHost; 54 class RenderProcessHost;
55 class RenderViewHostImpl; 55 class RenderViewHostImpl;
56 class RenderWidgetHostDelegate;
56 class RenderWidgetHostImpl; 57 class RenderWidgetHostImpl;
57 class TimeoutMonitor; 58 class TimeoutMonitor;
58 struct ContextMenuParams; 59 struct ContextMenuParams;
59 struct GlobalRequestID; 60 struct GlobalRequestID;
60 struct Referrer; 61 struct Referrer;
61 struct ShowDesktopNotificationHostMsgParams; 62 struct ShowDesktopNotificationHostMsgParams;
62 struct TransitionLayerData; 63 struct TransitionLayerData;
63 64
65 // Flag arguments for RenderFrameHost creation.
66 enum CreateRenderFrameFlags {
67 // The RFH will be initially placed on the swapped out hosts list.
68 SWAPPED_OUT = 1 << 0,
69 // The new RenderFrame is being created for a navigation of the
70 // top-level frame.
71 FOR_MAIN_FRAME_NAVIGATION = 1 << 1,
72 // The RenderFrame is initially hidden.
73 HIDDEN = 1 << 2,
74 // The RenderFrameHost will have a new RenderWidgetHost created and
75 // attached to it. This is used when the RenderFrameHost is the root
76 // of a subtree of frames that are being rendered in the same process.
77 CREATE_RENDER_WIDGET_HOST = 1 << 3
78 };
79
64 class CONTENT_EXPORT RenderFrameHostImpl 80 class CONTENT_EXPORT RenderFrameHostImpl
65 : public RenderFrameHost, 81 : public RenderFrameHost,
66 public BrowserAccessibilityDelegate { 82 public BrowserAccessibilityDelegate {
67 public: 83 public:
68 // Keeps track of the state of the RenderFrameHostImpl, particularly with 84 // Keeps track of the state of the RenderFrameHostImpl, particularly with
69 // respect to swap out. 85 // respect to swap out.
70 enum RenderFrameHostImplState { 86 enum RenderFrameHostImplState {
71 // The standard state for a RFH handling the communication with an active 87 // The standard state for a RFH handling the communication with an active
72 // RenderFrame. 88 // RenderFrame.
73 STATE_DEFAULT = 0, 89 STATE_DEFAULT = 0,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // after they are blocked in RenderWidgetHelper::CreateNewWindow. 176 // after they are blocked in RenderWidgetHelper::CreateNewWindow.
161 void Init(); 177 void Init();
162 178
163 int routing_id() const { return routing_id_; } 179 int routing_id() const { return routing_id_; }
164 void OnCreateChildFrame(int new_routing_id, 180 void OnCreateChildFrame(int new_routing_id,
165 const std::string& frame_name); 181 const std::string& frame_name);
166 182
167 RenderViewHostImpl* render_view_host() { return render_view_host_; } 183 RenderViewHostImpl* render_view_host() { return render_view_host_; }
168 RenderFrameHostDelegate* delegate() { return delegate_; } 184 RenderFrameHostDelegate* delegate() { return delegate_; }
169 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 185 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
170 // TODO(nasko): The RenderWidgetHost will be owned by RenderFrameHost in 186
171 // the future, so update this accessor to return the right pointer. 187 // This is called to create RenderWidgetHosts for out-of-process iframes.
188 void CreateRenderWidgetHost(RenderWidgetHostDelegate* delegate,
189 bool hidden);
190
191 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
192 // or else it returns a pointer to the RenderViewHost (which inherits
193 // RenderWidgetHost).
172 RenderWidgetHostImpl* GetRenderWidgetHost(); 194 RenderWidgetHostImpl* GetRenderWidgetHost();
173 195
174 // This function is called when this is a swapped out RenderFrameHost that 196 // This function is called when this is a swapped out RenderFrameHost that
175 // lives in the same process as the parent frame. The 197 // lives in the same process as the parent frame. The
176 // |cross_process_frame_connector| allows the non-swapped-out 198 // |cross_process_frame_connector| allows the non-swapped-out
177 // RenderFrameHost for a frame to communicate with the parent process 199 // RenderFrameHost for a frame to communicate with the parent process
178 // so that it may composite drawing data. 200 // so that it may composite drawing data.
179 // 201 //
180 // Ownership is not transfered. 202 // Ownership is not transfered.
181 void set_cross_process_frame_connector( 203 void set_cross_process_frame_connector(
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 #endif 367 #endif
346 368
347 protected: 369 protected:
348 friend class RenderFrameHostFactory; 370 friend class RenderFrameHostFactory;
349 371
350 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost 372 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost
351 // should be the abstraction needed here, but we need RenderViewHost to pass 373 // should be the abstraction needed here, but we need RenderViewHost to pass
352 // into WebContentsObserver::FrameDetached for now. 374 // into WebContentsObserver::FrameDetached for now.
353 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, 375 RenderFrameHostImpl(RenderViewHostImpl* render_view_host,
354 RenderFrameHostDelegate* delegate, 376 RenderFrameHostDelegate* delegate,
377 RenderWidgetHostDelegate* rwh_delegate,
355 FrameTree* frame_tree, 378 FrameTree* frame_tree,
356 FrameTreeNode* frame_tree_node, 379 FrameTreeNode* frame_tree_node,
357 int routing_id, 380 int routing_id,
358 bool is_swapped_out); 381 int flags);
359 382
360 private: 383 private:
361 friend class TestRenderFrameHost; 384 friend class TestRenderFrameHost;
362 friend class TestRenderViewHost; 385 friend class TestRenderViewHost;
363 386
364 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe); 387 FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrashSubframe);
365 388
366 // IPC Message handlers. 389 // IPC Message handlers.
367 void OnAddMessageToConsole(int32 level, 390 void OnAddMessageToConsole(int32 level,
368 const base::string16& message, 391 const base::string16& message,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. 508 // The FrameTreeNode which this RenderFrameHostImpl is hosted in.
486 FrameTreeNode* frame_tree_node_; 509 FrameTreeNode* frame_tree_node_;
487 510
488 // The mapping of pending JavaScript calls created by 511 // The mapping of pending JavaScript calls created by
489 // ExecuteJavaScript and their corresponding callbacks. 512 // ExecuteJavaScript and their corresponding callbacks.
490 std::map<int, JavaScriptResultCallback> javascript_callbacks_; 513 std::map<int, JavaScriptResultCallback> javascript_callbacks_;
491 514
492 // Map from notification_id to a callback to cancel them. 515 // Map from notification_id to a callback to cancel them.
493 std::map<int, base::Closure> cancel_notification_callbacks_; 516 std::map<int, base::Closure> cancel_notification_callbacks_;
494 517
518 // RenderFrameHosts that need management of the rendering and input events
519 // for their frame subtrees require RenderWidgetHosts. This typically
520 // means frames that are rendered in different processes from their parent
521 // frames.
522 // TODO(kenrb): Later this will also be used on the top-level frame.
523 scoped_ptr<RenderWidgetHostImpl> render_widget_host_;
524
495 int routing_id_; 525 int routing_id_;
496 526
497 // The current state of this RenderFrameHost. 527 // The current state of this RenderFrameHost.
498 RenderFrameHostImplState rfh_state_; 528 RenderFrameHostImplState rfh_state_;
499 529
500 // Tracks whether the RenderFrame for this RenderFrameHost has been created in 530 // Tracks whether the RenderFrame for this RenderFrameHost has been created in
501 // the renderer process. Currently only used for subframes. 531 // the renderer process. Currently only used for subframes.
502 // TODO(creis): Use this for main frames as well when RVH goes away. 532 // TODO(creis): Use this for main frames as well when RVH goes away.
503 bool render_frame_created_; 533 bool render_frame_created_;
504 534
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 583
554 // NOTE: This must be the last member. 584 // NOTE: This must be the last member.
555 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 585 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
556 586
557 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 587 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
558 }; 588 };
559 589
560 } // namespace content 590 } // namespace content
561 591
562 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 592 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698