| Index: content/renderer/render_frame_impl.cc
 | 
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
 | 
| index cf4947dc3c2b04d1d193d0d840429c3a90d56a5b..6db63204a76e74ffdb0516a895315ff56ddb1a6a 100644
 | 
| --- a/content/renderer/render_frame_impl.cc
 | 
| +++ b/content/renderer/render_frame_impl.cc
 | 
| @@ -740,7 +740,6 @@
 | 
|      IPC_MESSAGE_HANDLER(FrameMsg_Navigate, OnNavigate)
 | 
|      IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload)
 | 
|      IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut)
 | 
| -    IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop)
 | 
|      IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed)
 | 
|      IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction,
 | 
|                          OnCustomContextMenuAction)
 | 
| @@ -996,7 +995,6 @@
 | 
|    RenderFrameProxy* proxy = NULL;
 | 
|    bool is_site_per_process =
 | 
|        CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess);
 | 
| -  bool is_main_frame = !frame_->parent();
 | 
|  
 | 
|    // Only run unload if we're not swapped out yet, but send the ack either way.
 | 
|    if (!is_swapped_out_ || !render_view_->is_swapped_out_) {
 | 
| @@ -1015,12 +1013,12 @@
 | 
|      // Synchronously run the unload handler before sending the ACK.
 | 
|      // TODO(creis): Call dispatchUnloadEvent unconditionally here to support
 | 
|      // unload on subframes as well.
 | 
| -    if (is_main_frame)
 | 
| +    if (!frame_->parent())
 | 
|        frame_->dispatchUnloadEvent();
 | 
|  
 | 
|      // Swap out and stop sending any IPC messages that are not ACKs.
 | 
|      // TODO(nasko): Do we need RenderFrameImpl::is_swapped_out_ anymore?
 | 
| -    if (is_main_frame)
 | 
| +    if (!frame_->parent())
 | 
|        render_view_->SetSwappedOut(true);
 | 
|      is_swapped_out_ = true;
 | 
|  
 | 
| @@ -1030,24 +1028,27 @@
 | 
|      // TODO(creis): Should we be stopping all frames here and using
 | 
|      // StopAltErrorPageFetcher with RenderView::OnStop, or just stopping this
 | 
|      // frame?
 | 
| -    OnStop();
 | 
| +    if (!frame_->parent())
 | 
| +      render_view_->OnStop();
 | 
| +    else
 | 
| +      frame_->stopLoading();
 | 
|  
 | 
|      // Let subframes know that the frame is now rendered remotely, for the
 | 
|      // purposes of compositing and input events.
 | 
| -    if (!is_main_frame)
 | 
| +    if (frame_->parent())
 | 
|        frame_->setIsRemote(true);
 | 
|  
 | 
|      // Replace the page with a blank dummy URL. The unload handler will not be
 | 
|      // run a second time, thanks to a check in FrameLoader::stopLoading.
 | 
|      // TODO(creis): Need to add a better way to do this that avoids running the
 | 
|      // beforeunload handler. For now, we just run it a second time silently.
 | 
| -    if (!is_site_per_process || is_main_frame)
 | 
| +    if (!is_site_per_process || frame_->parent() == NULL)
 | 
|        render_view_->NavigateToSwappedOutURL(frame_);
 | 
|  
 | 
|      // Let WebKit know that this view is hidden so it can drop resources and
 | 
|      // stop compositing.
 | 
|      // TODO(creis): Support this for subframes as well.
 | 
| -    if (is_main_frame) {
 | 
| +    if (!frame_->parent()) {
 | 
|        render_view_->webview()->setVisibilityState(
 | 
|            blink::WebPageVisibilityStateHidden, false);
 | 
|      }
 | 
| @@ -1055,7 +1056,7 @@
 | 
|  
 | 
|    // It is now safe to show modal dialogs again.
 | 
|    // TODO(creis): Deal with modal dialogs from subframes.
 | 
| -  if (is_main_frame)
 | 
| +  if (!frame_->parent())
 | 
|      render_view_->suppress_dialogs_until_swap_out_ = false;
 | 
|  
 | 
|    Send(new FrameHostMsg_SwapOut_ACK(routing_id_));
 | 
| @@ -1063,7 +1064,7 @@
 | 
|    // Now that all of the cleanup is complete and the browser side is notified,
 | 
|    // start using the RenderFrameProxy, if one is created.
 | 
|    if (proxy) {
 | 
| -    if (!is_main_frame) {
 | 
| +    if (frame_->parent()) {
 | 
|        frame_->swap(proxy->web_frame());
 | 
|        if (is_site_per_process) {
 | 
|          // TODO(nasko): delete the frame here, since we've replaced it with a
 | 
| @@ -1075,7 +1076,7 @@
 | 
|    }
 | 
|  
 | 
|    // Safe to exit if no one else is using the process.
 | 
| -  if (is_main_frame)
 | 
| +  if (!frame_->parent())
 | 
|      render_view_->WasSwappedOut();
 | 
|  }
 | 
|  
 | 
| @@ -3059,11 +3060,6 @@
 | 
|  }
 | 
|  
 | 
|  void RenderFrameImpl::OnStop() {
 | 
| -  DCHECK(frame_);
 | 
| -  frame_->stopLoading();
 | 
| -  if (!frame_->parent())
 | 
| -    FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, OnStop());
 | 
| -
 | 
|    FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop());
 | 
|  }
 | 
|  
 | 
| 
 |