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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 132613002: Remove PrerenderTracker::TryCancel* methods and associated ones, since destruction of prerender onl… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 11 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 "chrome/browser/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 return; 659 return;
660 CheckURL(details.new_url); 660 CheckURL(details.new_url);
661 } 661 }
662 662
663 void PrerenderContents::Destroy(FinalStatus final_status) { 663 void PrerenderContents::Destroy(FinalStatus final_status) {
664 DCHECK_NE(final_status, FINAL_STATUS_USED); 664 DCHECK_NE(final_status, FINAL_STATUS_USED);
665 665
666 if (prerendering_has_been_cancelled_) 666 if (prerendering_has_been_cancelled_)
667 return; 667 return;
668 668
669 if (child_id_ != -1 && route_id_ != -1) {
670 // Cancel the prerender in the PrerenderTracker. This is needed
671 // because destroy may be called directly from the UI thread without calling
672 // TryCancel(). This is difficult to completely avoid, since prerendering
673 // can be cancelled before a RenderView is created.
674 bool is_cancelled = prerender_manager()->prerender_tracker()->TryCancel(
675 child_id_, route_id_, final_status);
676 CHECK(is_cancelled);
677
678 // A different final status may have been set already from another thread.
679 // If so, use it instead.
680 if (!prerender_manager()->prerender_tracker()->
681 GetFinalStatus(child_id_, route_id_, &final_status)) {
682 NOTREACHED();
683 }
684 }
685 SetFinalStatus(final_status); 669 SetFinalStatus(final_status);
686 670
687 prerendering_has_been_cancelled_ = true; 671 prerendering_has_been_cancelled_ = true;
688 prerender_manager_->AddToHistory(this); 672 prerender_manager_->AddToHistory(this);
689 prerender_manager_->MoveEntryToPendingDelete(this, final_status); 673 prerender_manager_->MoveEntryToPendingDelete(this, final_status);
690 674
691 // Note that if this PrerenderContents was made into a MatchComplete 675 // Note that if this PrerenderContents was made into a MatchComplete
692 // replacement by MoveEntryToPendingDelete, NotifyPrerenderStop will 676 // replacement by MoveEntryToPendingDelete, NotifyPrerenderStop will
693 // not reach the PrerenderHandle. Rather 677 // not reach the PrerenderHandle. Rather
694 // OnPrerenderCreatedMatchCompleteReplacement will propogate that 678 // OnPrerenderCreatedMatchCompleteReplacement will propogate that
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 return NULL; 770 return NULL;
787 return prerender_contents()->GetController(). 771 return prerender_contents()->GetController().
788 GetDefaultSessionStorageNamespace(); 772 GetDefaultSessionStorageNamespace();
789 } 773 }
790 774
791 void PrerenderContents::OnCancelPrerenderForPrinting() { 775 void PrerenderContents::OnCancelPrerenderForPrinting() {
792 Destroy(FINAL_STATUS_WINDOW_PRINT); 776 Destroy(FINAL_STATUS_WINDOW_PRINT);
793 } 777 }
794 778
795 } // namespace prerender 779 } // namespace prerender
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_manager.h » ('j') | chrome/browser/prerender/prerender_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698