summaryrefslogtreecommitdiffstats
path: root/content/renderer
diff options
context:
space:
mode:
authorcreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 01:26:14 +0000
committercreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-27 01:26:14 +0000
commit04981a6e55d581749b28e2493cd65b655f63a114 (patch)
tree69a49576ccd0e52d4c9cb2b46234bafc1249b22f /content/renderer
parent297ace04e7f0a31465d93843e01b4dbf4cb5453b (diff)
downloadchromium_src-04981a6e55d581749b28e2493cd65b655f63a114.zip
chromium_src-04981a6e55d581749b28e2493cd65b655f63a114.tar.gz
chromium_src-04981a6e55d581749b28e2493cd65b655f63a114.tar.bz2
Revert 237119 "Always create FrameTreeNodes and RenderFrameHosts..."
> Always create FrameTreeNodes and RenderFrameHosts for every frame. > > This allows us to run the FrameTreeShape tests without a flag. > > BUG=245126 > TEST=FrameTreeBrowserTest.FrameTreeShape* > > Review URL: https://codereview.chromium.org/82033002 TBR=creis@chromium.org Review URL: https://codereview.chromium.org/90213002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r--content/renderer/render_frame_impl.cc79
-rw-r--r--content/renderer/render_view_impl.cc4
2 files changed, 43 insertions, 40 deletions
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 6231d59..b2b7373 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -7,6 +7,7 @@
#include <map>
#include <string>
+#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "content/child/appcache/appcache_dispatcher.h"
@@ -219,25 +220,27 @@ void RenderFrameImpl::didAccessInitialDocument(blink::WebFrame* frame) {
blink::WebFrame* RenderFrameImpl::createChildFrame(
blink::WebFrame* parent,
const blink::WebString& name) {
+ RenderFrameImpl* child_render_frame = this;
long long child_frame_identifier = WebFrame::generateEmbedderIdentifier();
- // Synchronously notify the browser of a child frame creation to get the
- // routing_id for the RenderFrame.
- int routing_id = MSG_ROUTING_NONE;
- Send(new FrameHostMsg_CreateChildFrame(GetRoutingID(),
- parent->identifier(),
- child_frame_identifier,
- UTF16ToUTF8(name),
- &routing_id));
- if (routing_id == MSG_ROUTING_NONE)
- return NULL;
- RenderFrameImpl* child_render_frame = RenderFrameImpl::Create(render_view_,
- routing_id);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) {
+ // Synchronously notify the browser of a child frame creation to get the
+ // routing_id for the RenderFrame.
+ int routing_id;
+ Send(new FrameHostMsg_CreateChildFrame(GetRoutingID(),
+ parent->identifier(),
+ child_frame_identifier,
+ UTF16ToUTF8(name),
+ &routing_id));
+ child_render_frame = RenderFrameImpl::Create(render_view_, routing_id);
+ }
blink::WebFrame* web_frame = WebFrame::create(child_render_frame,
child_frame_identifier);
- g_child_frame_map.Get().insert(
- std::make_pair(web_frame, child_render_frame));
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) {
+ g_child_frame_map.Get().insert(
+ std::make_pair(web_frame, child_render_frame));
+ }
return web_frame;
}
@@ -252,41 +255,45 @@ void RenderFrameImpl::frameDetached(blink::WebFrame* frame) {
// called on the parent frame.
CHECK(!is_detaching_);
- bool is_subframe = !!frame->parent();
int64 parent_frame_id = -1;
- if (is_subframe)
+ if (frame->parent())
parent_frame_id = frame->parent()->identifier();
Send(new FrameHostMsg_Detach(GetRoutingID(), parent_frame_id,
frame->identifier()));
- // The |is_detaching_| flag disables Send(). FrameHostMsg_Detach must be
- // sent before setting |is_detaching_| to true. In contrast, Observers
- // should only be notified afterwards so they cannot call back into and
- // have IPCs fired off.
- is_detaching_ = true;
+ // Currently multiple WebCore::Frames can send frameDetached to a single
+ // RenderFrameImpl. This is legacy behavior from when RenderViewImpl served
+ // as a shared WebFrameClient for multiple Webcore::Frame objects. It also
+ // prevents this class from entering the |is_detaching_| state because
+ // even though one WebCore::Frame may have detached itself, others will
+ // still need to use this object.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) {
+ // The |is_detaching_| flag disables Send(). FrameHostMsg_Detach must be
+ // sent before setting |is_detaching_| to true. In contrast, Observers
+ // should only be notified afterwards so they cannot call back into and
+ // have IPCs fired off.
+ is_detaching_ = true;
+ }
// Call back to RenderViewImpl for observers to be notified.
// TODO(nasko): Remove once we have RenderFrameObserver.
render_view_->frameDetached(frame);
- // We need to clean up subframes by removing them from the map and deleting
- // the RenderFrameImpl. In contrast, the main frame is owned by its
- // containing RenderViewHost (so that they have the same lifetime), so it does
- // not require any cleanup here.
- if (is_subframe) {
- FrameMap::iterator it = g_child_frame_map.Get().find(frame);
- DCHECK(it != g_child_frame_map.Get().end());
- DCHECK_EQ(it->second, this);
- g_child_frame_map.Get().erase(it);
- }
-
- // |frame| is invalid after here.
frame->close();
- if (is_subframe) {
- delete this;
- // Object is invalid after this point.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) {
+ // If the frame does not have a parent, it is the main frame. The main
+ // frame is owned by the containing RenderViewHost so it does not require
+ // any cleanup here.
+ if (frame->parent()) {
+ FrameMap::iterator it = g_child_frame_map.Get().find(frame);
+ DCHECK(it != g_child_frame_map.Get().end());
+ DCHECK_EQ(it->second, this);
+ g_child_frame_map.Get().erase(it);
+ delete this;
+ // Object is invalid after this point.
+ }
}
}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index fe683d5..b21d9e0 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -3167,10 +3167,6 @@ void RenderViewImpl::didDisownOpener(blink::WebFrame* frame) {
}
void RenderViewImpl::frameDetached(WebFrame* frame) {
- // NOTE: We may get here for either the main frame or for subframes. The
- // RenderFrameImpl will be deleted immediately after this call for subframes
- // but not for the main frame, which is kept around in a scoped_ptr.
-
FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame));
}