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

Side by Side Diff: content/browser/renderer_host/frame_tree.h

Issue 23841002: Create a new RenderFrameHost per child frame when --site-per-process is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: custom deleters rock. Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_H_
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/browser/renderer_host/frame_tree_node.h"
13 #include "content/common/content_export.h"
14
15 namespace content {
16
17 class FrameTreeNode;
18 class RenderProcessHost;
19
20 // Represents the frame tree for a page. With the exception of the main frame,
21 // all FrameTreeNodes will be created/deleted in response to frame attach and
22 // detach events in the DOM.
23 //
24 // The main frame's FrameTreeNode is special in that it is reused. This allows
25 // it to serve as an anchor for state that needs to persist across top-level
26 // page navigations.
27 //
28 // TODO(ajwong): Move NavigationController ownership the to main frame
29 // FrameTreeNode. Possibly expose access to it from here.
30 //
31 // This object is only used on the UI thread.
32 class CONTENT_EXPORT FrameTree {
Charlie Reis 2013/09/24 18:25:58 Can you add something to the class comment about t
awong 2013/09/26 21:25:24 Done.
33 public:
34 FrameTree();
35 ~FrameTree();
36
37 // Returns the FrameTreeNode with the given |frame_id|.
38 FrameTreeNode* FindByID(int64 frame_id);
39
40 // Executes |on_node| on each node in the frame tree. If |on_node| returns
41 // false, terminates the iteration immediately. Returning false is useful
42 // if |on_node| is just doing a search over the tree.
43 void ForEach(const base::Callback<bool(FrameTreeNode*)>& on_node) const;
44
45 // After the FrameTree is created, or after SwapMainFrame() has been called,
46 // the root node does not yet have a frame id. This is allocated by the
47 // renderer and is published to the browser process on the first navigation
48 // after a swap. These two functions are used to set the root node's frame
49 // id.
50 //
51 // TODO(ajwong): Remove these once RenderFrameHost's routing id replaces
52 // frame_id.
53 bool IsFirstNavigationAfterSwap() const;
54 void OnFirstNavigationAfterSwap(int main_frame_id);
55
56 // Frame tree manipulation routines.
57 void AddFrame(int render_frame_host_id, int64 parent_frame_id,
58 int64 frame_id, const std::string& frame_name);
59 void RemoveFrame(int64 parent_frame_id, int64 frame_id);
60 void SetFrameUrl(int64 frame_id, const GURL& url);
61
62 // Resets the FrameTree and changes RenderFrameHost for the main frame.
63 // This destroys most of frame tree but retains the root node so that
64 // navigation state may be kept on it between process swaps. Used to
65 // support bookeeping for top-level navigations.
66 //
67 // If |main_frame| is NULL, reset tree to initially constructed state.
68 //
69 // TODO(ajwong): This function should not be given a |main_frame|. This is
70 // required currently because the RenderViewHost owns is main frame. When
Charlie Reis 2013/09/24 18:25:58 nit: owns its
awong 2013/09/26 21:25:24 Done.
71 // that relation is fixed, the FrameTree should be repsonsible for
Charlie Reis 2013/09/24 18:25:58 nit: responsible
awong 2013/09/26 21:25:24 Done.
72 // created/destroying the main frame on the swap.
73 void SwapMainFrame(RenderFrameHostImpl* main_frame);
74
75 // Convenience accessor for the main frame's RenderFrameHostImpl.
76 RenderFrameHostImpl* GetMainFrame() const;
77
78 // Allows a client to listen for frame removal.
79 void SetFrameRemoveListener(
80 const base::Callback<void(int64)>& on_frame_removed);
81
82 FrameTreeNode* GetRootForTesting() { return root_.get(); }
83
84 private:
85 scoped_ptr<FrameTreeNode> CreateNode(int64 frame_id,
86 const std::string& frame_name,
87 int render_frame_host_id,
88 RenderProcessHost* render_process_host);
89
90 scoped_ptr<FrameTreeNode> root_;
91
92 base::Callback<void(int64)> on_frame_removed_;
93
94 DISALLOW_COPY_AND_ASSIGN(FrameTree);
95 };
96
97 } // namespace content
98
99 #endif // CONTENT_BROWSER_RENDERER_HOST_FRAME_TREE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/frame_tree.cc » ('j') | content/browser/renderer_host/render_view_host_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698