OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ | |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | |
10 | |
11 class RenderProcessHost; | |
12 class RenderFrameHostImpl; | |
13 class RenderViewHostImpl; | |
14 | |
15 namespace content { | |
16 | |
17 // When a page is rendered across multiple processes, each renderer has a | |
Charlie Reis
2014/04/09 21:48:30
nit: a page's frames are rendered by multiple
nasko
2014/04/10 20:37:36
Done.
| |
18 // full copy of the frame tree. It has real frame objects for the frames it is | |
Charlie Reis
2014/04/09 21:48:30
real frame objects -> full RenderFrames
nasko
2014/04/10 20:37:36
Done.
| |
19 // responsible for rendering and placeholder objects for frames rendered by | |
Charlie Reis
2014/04/09 21:48:30
placeholder objects (i.e., RenderFrameProxies)
nasko
2014/04/10 20:37:36
Done.
| |
20 // other processes - RenderFrameProxy. | |
Charlie Reis
2014/04/09 21:48:30
nit: Blank line after this paragraph.
nasko
2014/04/10 20:37:36
Done.
| |
21 // This class is the browser-site object for the placeholder. Each node in the | |
Charlie Reis
2014/04/09 21:48:30
browser-side host object
nasko
2014/04/10 20:37:36
Too much "site" isolation ;)
| |
22 // frame tree has a RenderFrameHost for the SiteInstance of the frame and a set | |
Charlie Reis
2014/04/09 21:48:30
for the active SiteInstance and a set
nasko
2014/04/10 20:37:36
Done.
| |
23 // of RenderFrameProxyHost objects - one for all other SiteInstances associated | |
Charlie Reis
2014/04/09 21:48:30
associated with the frame tree -> with references
nasko
2014/04/10 20:37:36
Done.
| |
24 // with the frame tree. The proxies allow us to keep existing window references | |
25 // valid over cross-process navigations and route cross-site asynchronous | |
26 // JavaScript calls, such as postMessage. | |
27 // | |
28 // For now, RenderFrameProxyHost is created when a RenderFrameHost is swapped | |
29 // out and acts just as a wrapper. If a RenderFrameHost can be deleted, no | |
30 // proxy object is created. It is destroyed when the RenderFrameHost is swapped | |
31 // back in or is no longer referenced and is therefore deleted. | |
32 // | |
33 // Long term, RenderFrameProxyHost will be created whenever a cross-site | |
34 // navigation occurs and a reference to the frame navigating needs to be kept | |
35 // alive. RenderFrameProxyHost and RenderFrameHost for the same SiteInstance can | |
Charlie Reis
2014/04/09 21:48:30
A RenderFrameHost and a RenderFrameProxyHost for
nasko
2014/04/10 20:37:36
Done.
| |
36 // exist at the same time, but only one will be "active" at a time. | |
Charlie Reis
2014/04/09 21:48:30
I don't understand what "active" means here. I di
nasko
2014/04/10 20:37:36
The object to use when sending IPC messages. I don
Charlie Reis
2014/04/11 17:42:53
If I understand the reason this can happen correct
| |
37 // There are two cases where the two objects will coexist: | |
38 // * When navigating cross-process and there is already a RenderFrameProxyHost | |
39 // for the new SiteInstance. A pending RenderFrameHost is created, but it is | |
40 // not used until it commits. At that point, RenderFrameHostManager transitions | |
41 // the pending RenderFrameHost to the active one and deletes the proxy. | |
42 // * When navigating cross-process and the existing document has an unload | |
43 // event handler. When the new navigation commits, RenderFrameHostManager | |
44 // creates a RenderFrameProxyHost for the old SiteInstance and uses it going | |
45 // forward. It also instructs the RenderFrameHost to run the unload event | |
46 // handler and is kept alive for the duration. Once the event handling is | |
47 // complete, the RenderFrameHost is deleted. | |
48 // | |
Charlie Reis
2014/04/09 21:48:30
nit: Remove empty comment line.
nasko
2014/04/10 20:37:36
Done.
| |
49 class RenderFrameProxyHost { | |
50 public: | |
51 explicit RenderFrameProxyHost( | |
52 scoped_ptr<RenderFrameHostImpl> render_frame_host); | |
53 ~RenderFrameProxyHost(); | |
54 | |
55 RenderProcessHost* GetProcess() { | |
56 return render_frame_host_->GetProcess(); | |
57 } | |
58 RenderFrameHostImpl* render_frame_host() { | |
Charlie Reis
2014/04/09 21:48:30
Can you move render_frame_host(), render_view_host
nasko
2014/04/10 20:37:36
Done.
| |
59 return render_frame_host_.get(); | |
60 } | |
61 RenderViewHostImpl* render_view_host() { | |
62 return render_frame_host_->render_view_host(); | |
63 } | |
64 scoped_ptr<RenderFrameHostImpl> PassFrameHost() { | |
65 return render_frame_host_.Pass(); | |
66 } | |
67 | |
68 private: | |
69 | |
Charlie Reis
2014/04/09 21:48:30
nit: No blank line here.
nasko
2014/04/10 20:37:36
Done.
| |
70 // TODO(nasko): For now, hide the RenderFrameHost inside the proxy, but remove | |
71 // it once we have all the code support for proper proxy objects. | |
72 scoped_ptr<RenderFrameHostImpl> render_frame_host_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(RenderFrameProxyHost); | |
75 }; | |
76 | |
77 } // namespace | |
78 | |
79 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_PROXY_HOST_H_ | |
OLD | NEW |