OLD | NEW |
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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void Init(); | 44 void Init(); |
45 int routing_id() const { return routing_id_; } | 45 int routing_id() const { return routing_id_; } |
46 void OnCreateChildFrame(int new_frame_routing_id, | 46 void OnCreateChildFrame(int new_frame_routing_id, |
47 int64 parent_frame_id, | 47 int64 parent_frame_id, |
48 int64 frame_id, | 48 int64 frame_id, |
49 const std::string& frame_name); | 49 const std::string& frame_name); |
50 | 50 |
51 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 51 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
52 RenderFrameHostDelegate* delegate() { return delegate_; } | 52 RenderFrameHostDelegate* delegate() { return delegate_; } |
53 | 53 |
| 54 // Hack to get this subframe to swap out, without yet moving over all the |
| 55 // state and machinery from RenderViewHost. |
| 56 void SwapOut(); |
| 57 void OnSwappedOut(bool timed_out); |
| 58 bool is_swapped_out() { return is_swapped_out_; } |
| 59 void set_swapped_out(bool is_swapped_out) { |
| 60 is_swapped_out_ = is_swapped_out; |
| 61 } |
| 62 |
54 protected: | 63 protected: |
55 friend class RenderFrameHostFactory; | 64 friend class RenderFrameHostFactory; |
56 | 65 |
57 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 66 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
58 // should be the abstraction needed here, but we need RenderViewHost to pass | 67 // should be the abstraction needed here, but we need RenderViewHost to pass |
59 // into WebContentsObserver::FrameDetached for now. | 68 // into WebContentsObserver::FrameDetached for now. |
60 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, | 69 RenderFrameHostImpl(RenderViewHostImpl* render_view_host, |
61 RenderFrameHostDelegate* delegate, | 70 RenderFrameHostDelegate* delegate, |
62 FrameTree* frame_tree, | 71 FrameTree* frame_tree, |
63 FrameTreeNode* frame_tree_node, | 72 FrameTreeNode* frame_tree_node, |
64 int routing_id, | 73 int routing_id, |
65 bool is_swapped_out); | 74 bool is_swapped_out); |
66 | 75 |
67 private: | 76 private: |
68 friend class TestRenderViewHost; | 77 friend class TestRenderViewHost; |
69 | 78 |
70 // IPC Message handlers. | 79 // IPC Message handlers. |
71 void OnDetach(int64 parent_frame_id, int64 frame_id); | 80 void OnDetach(int64 parent_frame_id, int64 frame_id); |
72 void OnDidStartProvisionalLoadForFrame(int64 frame_id, | 81 void OnDidStartProvisionalLoadForFrame(int64 frame_id, |
73 int64 parent_frame_id, | 82 int64 parent_frame_id, |
74 bool main_frame, | 83 bool main_frame, |
75 const GURL& url); | 84 const GURL& url); |
76 | 85 void OnSwapOutACK(); |
77 bool is_swapped_out() { return is_swapped_out_; } | |
78 | 86 |
79 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a | 87 // For now, RenderFrameHosts indirectly keep RenderViewHosts alive via a |
80 // refcount that calls Shutdown when it reaches zero. This allows each | 88 // refcount that calls Shutdown when it reaches zero. This allows each |
81 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring | 89 // RenderFrameHostManager to just care about RenderFrameHosts, while ensuring |
82 // we have a RenderViewHost for each RenderFrameHost. | 90 // we have a RenderViewHost for each RenderFrameHost. |
83 // TODO(creis): RenderViewHost will eventually go away and be replaced with | 91 // TODO(creis): RenderViewHost will eventually go away and be replaced with |
84 // some form of page context. | 92 // some form of page context. |
85 RenderViewHostImpl* render_view_host_; | 93 RenderViewHostImpl* render_view_host_; |
86 | 94 |
87 RenderFrameHostDelegate* delegate_; | 95 RenderFrameHostDelegate* delegate_; |
88 | 96 |
89 // Reference to the whole frame tree that this RenderFrameHost belongs too. | 97 // Reference to the whole frame tree that this RenderFrameHost belongs too. |
90 // Allows this RenderFrameHost to add and remove nodes in response to | 98 // Allows this RenderFrameHost to add and remove nodes in response to |
91 // messages from the renderer requesting DOM manipulation. | 99 // messages from the renderer requesting DOM manipulation. |
92 FrameTree* frame_tree_; | 100 FrameTree* frame_tree_; |
93 | 101 |
94 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. | 102 // The FrameTreeNode which this RenderFrameHostImpl is hosted in. |
95 FrameTreeNode* frame_tree_node_; | 103 FrameTreeNode* frame_tree_node_; |
96 | 104 |
97 int routing_id_; | 105 int routing_id_; |
98 bool is_swapped_out_; | 106 bool is_swapped_out_; |
99 | 107 |
100 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 108 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
101 }; | 109 }; |
102 | 110 |
103 } // namespace content | 111 } // namespace content |
104 | 112 |
105 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 113 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |