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. |routing_id| will be ID of the newly | |
54 // created RenderFrameProxy. |frame_routing_id| is the ID of the RenderFrame | |
55 // to replace. | |
56 static RenderFrameProxy* CreateProxyToReplaceFrame(int routing_id, | |
57 int frame_routing_id); | |
58 | |
59 // This method should be used to create a RenderFrameProxy, when there isn't | |
dcheng
2014/07/03 05:58:54
I don't think this comment is completely accurate.
ncarter (slow)
2014/07/14 17:35:07
Done.
| |
60 // an existing RenderFrame. It happens when some other frame in the frame tree | |
61 // of the document is navigating cross-process and a proxy for the new frame | |
62 // is needed. |routing_id| will be the ID of the newly created | |
63 // RenderFrameProxy. |parent_routing_id| is the routing ID of the | |
64 // RenderFrameProxy to which the new frame is parented. | |
dcheng
2014/07/03 05:58:54
To a reader, I don't think it's immediately obviou
dcheng
2014/07/03 05:58:54
To a reader, I don't think it's immediately obviou
ncarter (slow)
2014/07/14 17:35:07
Done.
| |
65 // |render_view_routing_id| identifies the RenderView to be associated with | |
66 // this frame. | |
51 static RenderFrameProxy* CreateFrameProxy(int routing_id, | 67 static RenderFrameProxy* CreateFrameProxy(int routing_id, |
52 int frame_routing_id); | 68 int parent_routing_id, |
69 int render_view_routing_id); | |
53 | 70 |
54 // Returns the RenderFrameProxy for the given routing ID. | 71 // Returns the RenderFrameProxy for the given routing ID. |
55 static RenderFrameProxy* FromRoutingID(int routing_id); | 72 static RenderFrameProxy* FromRoutingID(int routing_id); |
56 | 73 |
74 // Returns the RenderFrameProxy given a WebFrame. | |
75 static RenderFrameProxy* FromWebFrame(blink::WebFrame* web_frame); | |
76 | |
57 virtual ~RenderFrameProxy(); | 77 virtual ~RenderFrameProxy(); |
58 | 78 |
59 // IPC::Sender | 79 // IPC::Sender |
60 virtual bool Send(IPC::Message* msg) OVERRIDE; | 80 virtual bool Send(IPC::Message* msg) OVERRIDE; |
61 | 81 |
62 RenderFrameImpl* render_frame() { | |
63 return render_frame_; | |
64 } | |
65 | |
66 // Out-of-process child frames receive a signal from RenderWidgetCompositor | 82 // Out-of-process child frames receive a signal from RenderWidgetCompositor |
67 // when a compositor frame has committed. | 83 // when a compositor frame has committed. |
68 void DidCommitCompositorFrame(); | 84 void DidCommitCompositorFrame(); |
69 | 85 |
86 int routing_id() { return routing_id_; } | |
dcheng
2014/07/03 05:58:54
Out of curiosity, is there a particular reason we
ncarter (slow)
2014/07/14 17:35:07
Done.
| |
87 RenderViewImpl* render_view() { return render_view_; } | |
88 blink::WebFrame* web_frame() { return web_frame_; } | |
89 | |
70 private: | 90 private: |
71 RenderFrameProxy(int routing_id, int frame_routing_id); | 91 RenderFrameProxy(int routing_id, int frame_routing_id); |
72 | 92 |
93 void Init(blink::WebFrame* frame, RenderViewImpl* render_view); | |
94 | |
73 // IPC::Listener | 95 // IPC::Listener |
74 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 96 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
75 | 97 |
76 // IPC handlers | 98 // IPC handlers |
77 void OnDeleteProxy(); | 99 void OnDeleteProxy(); |
78 void OnChildFrameProcessGone(); | 100 void OnChildFrameProcessGone(); |
79 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); | 101 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); |
80 void OnCompositorFrameSwapped(const IPC::Message& message); | 102 void OnCompositorFrameSwapped(const IPC::Message& message); |
81 | 103 |
82 blink::WebFrame* GetWebFrame(); | 104 const int routing_id_; |
105 const int frame_routing_id_; | |
106 blink::WebFrame* web_frame_; | |
dcheng
2014/07/03 05:58:54
I think these fields could use some comments. Also
ncarter (slow)
2014/07/14 17:35:07
Yes, this will become a WebRemoteFrame in a later
| |
107 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | |
83 | 108 |
84 int routing_id_; | 109 RenderViewImpl* render_view_; |
85 int frame_routing_id_; | |
86 RenderFrameImpl* render_frame_; | |
87 | |
88 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; | |
89 | 110 |
90 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxy); | 111 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxy); |
91 }; | 112 }; |
92 | 113 |
93 } // namespace | 114 } // namespace |
94 | 115 |
95 #endif // CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ | 116 #endif // CONTENT_RENDERER_RENDER_FRAME_PROXY_H_ |
OLD | NEW |