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

Side by Side Diff: content/renderer/render_view_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/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 5565 matching lines...) Expand 10 before | Expand all | Expand 10 after
5576 5576
5577 void RenderViewImpl::OnShouldClose() { 5577 void RenderViewImpl::OnShouldClose() {
5578 base::TimeTicks before_unload_start_time = base::TimeTicks::Now(); 5578 base::TimeTicks before_unload_start_time = base::TimeTicks::Now();
5579 bool should_close = webview()->dispatchBeforeUnloadEvent(); 5579 bool should_close = webview()->dispatchBeforeUnloadEvent();
5580 base::TimeTicks before_unload_end_time = base::TimeTicks::Now(); 5580 base::TimeTicks before_unload_end_time = base::TimeTicks::Now();
5581 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close, 5581 Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close,
5582 before_unload_start_time, 5582 before_unload_start_time,
5583 before_unload_end_time)); 5583 before_unload_end_time));
5584 } 5584 }
5585 5585
5586 void RenderViewImpl::OnSwapOut(const ViewMsg_SwapOut_Params& params) { 5586 void RenderViewImpl::OnSwapOut() {
5587 // Only run unload if we're not swapped out yet, but send the ack either way. 5587 // Only run unload if we're not swapped out yet, but send the ack either way.
5588 if (!is_swapped_out_) { 5588 if (!is_swapped_out_) {
5589 // Swap this RenderView out so the tab can navigate to a page rendered by a 5589 // Swap this RenderView out so the tab can navigate to a page rendered by a
5590 // different process. This involves running the unload handler and clearing 5590 // different process. This involves running the unload handler and clearing
5591 // the page. Once WasSwappedOut is called, we also allow this process to 5591 // the page. Once WasSwappedOut is called, we also allow this process to
5592 // exit if there are no other active RenderViews in it. 5592 // exit if there are no other active RenderViews in it.
5593 5593
5594 // Send an UpdateState message before we get swapped out. 5594 // Send an UpdateState message before we get swapped out.
5595 SyncNavigationState(); 5595 SyncNavigationState();
5596 5596
(...skipping 12 matching lines...) Expand all
5609 // run a second time, thanks to a check in FrameLoader::stopLoading. 5609 // run a second time, thanks to a check in FrameLoader::stopLoading.
5610 // TODO(creis): Need to add a better way to do this that avoids running the 5610 // TODO(creis): Need to add a better way to do this that avoids running the
5611 // beforeunload handler. For now, we just run it a second time silently. 5611 // beforeunload handler. For now, we just run it a second time silently.
5612 NavigateToSwappedOutURL(webview()->mainFrame()); 5612 NavigateToSwappedOutURL(webview()->mainFrame());
5613 5613
5614 // Let WebKit know that this view is hidden so it can drop resources and 5614 // Let WebKit know that this view is hidden so it can drop resources and
5615 // stop compositing. 5615 // stop compositing.
5616 webview()->setVisibilityState(WebKit::WebPageVisibilityStateHidden, false); 5616 webview()->setVisibilityState(WebKit::WebPageVisibilityStateHidden, false);
5617 } 5617 }
5618 5618
5619 // Just echo back the params in the ACK. 5619 Send(new ViewHostMsg_SwapOut_ACK(routing_id_));
5620 Send(new ViewHostMsg_SwapOut_ACK(routing_id_, params));
5621 } 5620 }
5622 5621
5623 void RenderViewImpl::NavigateToSwappedOutURL(WebKit::WebFrame* frame) { 5622 void RenderViewImpl::NavigateToSwappedOutURL(WebKit::WebFrame* frame) {
5624 // We use loadRequest instead of loadHTMLString because the former commits 5623 // We use loadRequest instead of loadHTMLString because the former commits
5625 // synchronously. Otherwise a new navigation can interrupt the navigation 5624 // synchronously. Otherwise a new navigation can interrupt the navigation
5626 // to kSwappedOutURL. If that happens to be to the page we had been 5625 // to kSwappedOutURL. If that happens to be to the page we had been
5627 // showing, then WebKit will never send a commit and we'll be left spinning. 5626 // showing, then WebKit will never send a commit and we'll be left spinning.
5628 CHECK(is_swapped_out_); 5627 CHECK(is_swapped_out_);
5629 GURL swappedOutURL(kSwappedOutURL); 5628 GURL swappedOutURL(kSwappedOutURL);
5630 WebURLRequest request(swappedOutURL); 5629 WebURLRequest request(swappedOutURL);
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
6681 WebURL url = icon_urls[i].iconURL(); 6680 WebURL url = icon_urls[i].iconURL();
6682 if (!url.isEmpty()) 6681 if (!url.isEmpty())
6683 urls.push_back(FaviconURL(url, 6682 urls.push_back(FaviconURL(url,
6684 ToFaviconType(icon_urls[i].iconType()))); 6683 ToFaviconType(icon_urls[i].iconType())));
6685 } 6684 }
6686 SendUpdateFaviconURL(urls); 6685 SendUpdateFaviconURL(urls);
6687 } 6686 }
6688 6687
6689 6688
6690 } // namespace content 6689 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698