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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 15682009: Eliminate SwapOut message parameters, keeping state in RVHM instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflicts Created 7 years, 6 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } 300 }
301 301
302 private: 302 private:
303 WebContentsImpl* owner_; 303 WebContentsImpl* owner_;
304 304
305 DISALLOW_COPY_AND_ASSIGN(DestructionObserver); 305 DISALLOW_COPY_AND_ASSIGN(DestructionObserver);
306 }; 306 };
307 307
308 // WebContentsImpl ------------------------------------------------------------- 308 // WebContentsImpl -------------------------------------------------------------
309 309
310 WebContentsImpl::PendingNavigationParams::PendingNavigationParams() {
311 }
312
313 WebContentsImpl::PendingNavigationParams::PendingNavigationParams(
314 const GlobalRequestID& global_request_id)
315 : global_request_id(global_request_id) {
316 }
317
310 WebContentsImpl::WebContentsImpl( 318 WebContentsImpl::WebContentsImpl(
311 BrowserContext* browser_context, 319 BrowserContext* browser_context,
312 WebContentsImpl* opener) 320 WebContentsImpl* opener)
313 : delegate_(NULL), 321 : delegate_(NULL),
314 controller_(this, browser_context), 322 controller_(this, browser_context),
315 render_view_host_delegate_view_(NULL), 323 render_view_host_delegate_view_(NULL),
316 opener_(opener), 324 opener_(opener),
317 #if defined(OS_WIN) && defined(USE_AURA) 325 #if defined(OS_WIN) && defined(USE_AURA)
318 accessible_parent_(NULL), 326 accessible_parent_(NULL),
319 #endif 327 #endif
(...skipping 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 view_->CloseTabAfterEventTracking(); 3034 view_->CloseTabAfterEventTracking();
3027 return; 3035 return;
3028 } 3036 }
3029 #endif 3037 #endif
3030 3038
3031 // Ignore this if it comes from a RenderViewHost that we aren't showing. 3039 // Ignore this if it comes from a RenderViewHost that we aren't showing.
3032 if (delegate_ && rvh == GetRenderViewHost()) 3040 if (delegate_ && rvh == GetRenderViewHost())
3033 delegate_->CloseContents(this); 3041 delegate_->CloseContents(this);
3034 } 3042 }
3035 3043
3044 void WebContentsImpl::OnCrossSiteResponse(
3045 RenderViewHost* pending_render_view_host,
3046 const GlobalRequestID& global_request_id) {
3047 // This should be called when the pending RVH is ready to commit.
3048 DCHECK_EQ(pending_render_view_host,
3049 render_manager_.pending_render_view_host());
3050
3051 // Remember the request ID until the unload handler has run.
3052 pending_nav_params_.reset(new PendingNavigationParams(global_request_id));
3053
3054 // Run the unload handler of the current page.
3055 render_manager_.SwapOutOldPage();
3056 }
3057
3036 void WebContentsImpl::SwappedOut(RenderViewHost* rvh) { 3058 void WebContentsImpl::SwappedOut(RenderViewHost* rvh) {
3037 if (delegate_ && rvh == GetRenderViewHost()) 3059 if (rvh != GetRenderViewHost()) {
3060 pending_nav_params_.reset();
3061 return;
3062 }
3063
3064 if (delegate_)
3038 delegate_->SwappedOut(this); 3065 delegate_->SwappedOut(this);
3066
3067 // Make sure we have a pending navigation from OnCrossSiteResponse above.
3068 // If not (e.g., for data URLs that don't make network requests), just return
3069 // early and ignore.
3070 if (!pending_nav_params_.get())
3071 return;
3072
3073 // Now that the unload handler has run, we need to resume the paused response.
3074 if (render_manager_.pending_render_view_host()) {
3075 RenderProcessHostImpl* pending_process =
3076 static_cast<RenderProcessHostImpl*>(
3077 render_manager_.pending_render_view_host()->GetProcess());
3078 pending_process->ResumeDeferredNavigation(
3079 pending_nav_params_->global_request_id);
3080 }
3081 pending_nav_params_.reset();
3039 } 3082 }
3040 3083
3041 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { 3084 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) {
3042 if (delegate_ && delegate_->IsPopupOrPanel(this)) 3085 if (delegate_ && delegate_->IsPopupOrPanel(this))
3043 delegate_->MoveContents(this, new_bounds); 3086 delegate_->MoveContents(this, new_bounds);
3044 } 3087 }
3045 3088
3046 void WebContentsImpl::DidStartLoading(RenderViewHost* render_view_host) { 3089 void WebContentsImpl::DidStartLoading(RenderViewHost* render_view_host) {
3047 SetIsLoading(true, NULL); 3090 SetIsLoading(true, NULL);
3048 3091
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3628 } 3671 }
3629 3672
3630 BrowserPluginGuestManager* 3673 BrowserPluginGuestManager*
3631 WebContentsImpl::GetBrowserPluginGuestManager() const { 3674 WebContentsImpl::GetBrowserPluginGuestManager() const {
3632 return static_cast<BrowserPluginGuestManager*>( 3675 return static_cast<BrowserPluginGuestManager*>(
3633 GetBrowserContext()->GetUserData( 3676 GetBrowserContext()->GetUserData(
3634 browser_plugin::kBrowserPluginGuestManagerKeyName)); 3677 browser_plugin::kBrowserPluginGuestManagerKeyName));
3635 } 3678 }
3636 3679
3637 } // namespace content 3680 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698