OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ |
6 #define CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ | 6 #define CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // finished executing. It will still be responsible for routing IPC messages | 41 // finished executing. It will still be responsible for routing IPC messages |
42 // which are valid for cross-site interactions between frames. | 42 // which are valid for cross-site interactions between frames. |
43 // RenderFrameProxy will be deleted when the node in the frame tree is deleted | 43 // RenderFrameProxy will be deleted when the node in the frame tree is deleted |
44 // or when navigating the frame causes it to return to this process and a new | 44 // or when navigating the frame causes it to return to this process and a new |
45 // RenderFrame is created for it. | 45 // RenderFrame is created for it. |
46 class CONTENT_EXPORT RenderFrameProxy | 46 class CONTENT_EXPORT RenderFrameProxy |
47 : public IPC::Listener, | 47 : public IPC::Listener, |
48 public IPC::Sender, | 48 public IPC::Sender, |
49 NON_EXPORTED_BASE(public blink::WebFrameClient) { | 49 NON_EXPORTED_BASE(public blink::WebFrameClient) { |
50 public: | 50 public: |
| 51 // This method should be used to create a RenderFrameProxy, which will replace |
| 52 // an existing RenderFrame during its cross-process navigation from the |
| 53 // current process to a different one. |
| 54 static RenderFrameProxy* CreateProxyForFrame(int routing_id, |
| 55 int frame_routing_id); |
| 56 |
| 57 // This method should be used to create a RenderFrameProxy, when there isn't |
| 58 // an existing RenderFrame. It happens when some other frame in the frame tree |
| 59 // of the document is navigating cross-process and a proxy for the new frame |
| 60 // is needed. |
51 static RenderFrameProxy* CreateFrameProxy(int routing_id, | 61 static RenderFrameProxy* CreateFrameProxy(int routing_id, |
52 int frame_routing_id); | 62 int parent_routing_id, |
| 63 int render_view_routing_id); |
53 | 64 |
54 // Returns the RenderFrameProxy for the given routing ID. | 65 // Returns the RenderFrameProxy for the given routing ID. |
55 static RenderFrameProxy* FromRoutingID(int routing_id); | 66 static RenderFrameProxy* FromRoutingID(int routing_id); |
56 | 67 |
| 68 // Returns the RenderFrameProxy given a WebFrame. |
| 69 static RenderFrameProxy* FromWebFrame(blink::WebFrame* web_frame); |
| 70 |
57 virtual ~RenderFrameProxy(); | 71 virtual ~RenderFrameProxy(); |
58 | 72 |
59 // IPC::Sender | 73 // IPC::Sender |
60 virtual bool Send(IPC::Message* msg) OVERRIDE; | 74 virtual bool Send(IPC::Message* msg) OVERRIDE; |
61 | 75 |
| 76 int routing_id() { |
| 77 return routing_id_; |
| 78 } |
| 79 |
62 RenderFrameImpl* render_frame() { | 80 RenderFrameImpl* render_frame() { |
63 return render_frame_; | 81 return render_frame_; |
64 } | 82 } |
65 | 83 |
66 // Out-of-process child frames receive a signal from RenderWidgetCompositor | 84 // Out-of-process child frames receive a signal from RenderWidgetCompositor |
67 // when a compositor frame has committed. | 85 // when a compositor frame has committed. |
68 void DidCommitCompositorFrame(); | 86 void DidCommitCompositorFrame(); |
69 | 87 |
| 88 RenderViewImpl* render_view() { |
| 89 return render_view_; |
| 90 } |
| 91 |
| 92 blink::WebRemoteFrame* GetWebFrame() { |
| 93 return frame_; |
| 94 } |
| 95 |
70 private: | 96 private: |
71 RenderFrameProxy(int routing_id, int frame_routing_id); | 97 RenderFrameProxy(int routing_id, int frame_routing_id); |
72 | 98 |
73 // IPC::Listener | 99 // IPC::Listener |
74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 100 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
75 | 101 |
76 // IPC handlers | 102 // IPC handlers |
77 void OnDeleteProxy(); | 103 void OnDeleteProxy(); |
78 void OnChildFrameProcessGone(); | 104 void OnChildFrameProcessGone(); |
79 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); | 105 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); |
80 void OnCompositorFrameSwapped(const IPC::Message& message); | 106 void OnCompositorFrameSwapped(const IPC::Message& message); |
81 | 107 |
82 blink::WebFrame* GetWebFrame(); | 108 void set_render_view(RenderViewImpl* render_view) { |
| 109 render_view_ = render_view; |
| 110 } |
83 | 111 |
84 int routing_id_; | 112 int routing_id_; |
85 int frame_routing_id_; | 113 int frame_routing_id_; |
86 RenderFrameImpl* render_frame_; | 114 RenderFrameImpl* render_frame_; |
| 115 blink::WebRemoteFrame* frame_; |
| 116 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
87 | 117 |
88 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | 118 RenderViewImpl* render_view_; |
89 | 119 |
90 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxy); | 120 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxy); |
91 }; | 121 }; |
92 | 122 |
93 } // namespace | 123 } // namespace |
94 | 124 |
95 #endif // CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ | 125 #endif // CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ |
OLD | NEW |