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

Side by Side Diff: chrome/browser/android/offline_pages/recent_tab_helper.cc

Issue 2030793002: Remove overeager DCHECK in SnapshotController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test Created 4 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
« no previous file with comments | « no previous file | components/offline_pages/snapshot_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/android/offline_pages/recent_tab_helper.h" 5 #include "chrome/browser/android/offline_pages/recent_tab_helper.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // WebContents with its origin as well. 58 // WebContents with its origin as well.
59 never_do_snapshots_ = web_contents->GetBrowserContext()->IsOffTheRecord(); 59 never_do_snapshots_ = web_contents->GetBrowserContext()->IsOffTheRecord();
60 } 60 }
61 61
62 RecentTabHelper::~RecentTabHelper() { 62 RecentTabHelper::~RecentTabHelper() {
63 } 63 }
64 64
65 void RecentTabHelper::DidFinishNavigation( 65 void RecentTabHelper::DidFinishNavigation(
66 content::NavigationHandle* navigation_handle) { 66 content::NavigationHandle* navigation_handle) {
67 if (navigation_handle->IsInMainFrame() && 67 if (navigation_handle->IsInMainFrame() &&
68 navigation_handle->HasCommitted() && 68 navigation_handle->HasCommitted()) {
69 !navigation_handle->IsErrorPage()) { 69 // Cancel tasks in flight that relate to the previous page.
70 weak_ptr_factory_.InvalidateWeakPtrs();
70 // New navigation, new snapshot session. 71 // New navigation, new snapshot session.
71 snapshot_controller_->Reset(); 72 snapshot_controller_->Reset();
72 snapshot_url_ = GURL::EmptyGURL(); 73 snapshot_url_ = GURL::EmptyGURL();
73 } 74 }
74 } 75 }
75 76
76 void RecentTabHelper::DocumentAvailableInMainFrame() { 77 void RecentTabHelper::DocumentAvailableInMainFrame() {
77 snapshot_controller_->DocumentAvailableInMainFrame(); 78 snapshot_controller_->DocumentAvailableInMainFrame();
78 } 79 }
79 80
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 std::unique_ptr<TestArchiveFactory> test_archive_factory) { 202 std::unique_ptr<TestArchiveFactory> test_archive_factory) {
202 test_archive_factory_ = std::move(test_archive_factory); 203 test_archive_factory_ = std::move(test_archive_factory);
203 } 204 }
204 205
205 void RecentTabHelper::SetTaskRunnerForTest( 206 void RecentTabHelper::SetTaskRunnerForTest(
206 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { 207 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) {
207 snapshot_controller_.reset(new SnapshotController(task_runner, this)); 208 snapshot_controller_.reset(new SnapshotController(task_runner, this));
208 } 209 }
209 210
210 } // namespace offline_pages 211 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/snapshot_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698