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

Side by Side Diff: components/offline_pages/offline_page_model.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 12 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/offline_pages/offline_page_model.h" 5 #include "components/offline_pages/offline_page_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 // static 111 // static
112 base::TimeDelta OfflinePageModel::GetFinalDeletionDelayForTesting() { 112 base::TimeDelta OfflinePageModel::GetFinalDeletionDelayForTesting() {
113 return kFinalDeletionDelay; 113 return kFinalDeletionDelay;
114 } 114 }
115 115
116 OfflinePageModel::OfflinePageModel( 116 OfflinePageModel::OfflinePageModel(
117 scoped_ptr<OfflinePageMetadataStore> store, 117 scoped_ptr<OfflinePageMetadataStore> store,
118 const base::FilePath& archives_dir, 118 const base::FilePath& archives_dir,
119 const scoped_refptr<base::SequencedTaskRunner>& task_runner) 119 const scoped_refptr<base::SequencedTaskRunner>& task_runner)
120 : store_(store.Pass()), 120 : store_(std::move(store)),
121 archives_dir_(archives_dir), 121 archives_dir_(archives_dir),
122 is_loaded_(false), 122 is_loaded_(false),
123 task_runner_(task_runner), 123 task_runner_(task_runner),
124 scoped_observer_(this), 124 scoped_observer_(this),
125 weak_ptr_factory_(this) { 125 weak_ptr_factory_(this) {
126 task_runner_->PostTaskAndReply( 126 task_runner_->PostTaskAndReply(
127 FROM_HERE, base::Bind(EnsureArchivesDirCreated, archives_dir_), 127 FROM_HERE, base::Bind(EnsureArchivesDirCreated, archives_dir_),
128 base::Bind(&OfflinePageModel::OnEnsureArchivesDirCreatedDone, 128 base::Bind(&OfflinePageModel::OnEnsureArchivesDirCreatedDone,
129 weak_ptr_factory_.GetWeakPtr())); 129 weak_ptr_factory_.GetWeakPtr()));
130 } 130 }
(...skipping 28 matching lines...) Expand all
159 if (!CanSavePage(url)) { 159 if (!CanSavePage(url)) {
160 InformSavePageDone(callback, SavePageResult::SKIPPED); 160 InformSavePageDone(callback, SavePageResult::SKIPPED);
161 return; 161 return;
162 } 162 }
163 163
164 DCHECK(archiver.get()); 164 DCHECK(archiver.get());
165 archiver->CreateArchive(archives_dir_, 165 archiver->CreateArchive(archives_dir_,
166 base::Bind(&OfflinePageModel::OnCreateArchiveDone, 166 base::Bind(&OfflinePageModel::OnCreateArchiveDone,
167 weak_ptr_factory_.GetWeakPtr(), url, 167 weak_ptr_factory_.GetWeakPtr(), url,
168 bookmark_id, base::Time::Now(), callback)); 168 bookmark_id, base::Time::Now(), callback));
169 pending_archivers_.push_back(archiver.Pass()); 169 pending_archivers_.push_back(std::move(archiver));
170 } 170 }
171 171
172 void OfflinePageModel::MarkPageAccessed(int64_t bookmark_id) { 172 void OfflinePageModel::MarkPageAccessed(int64_t bookmark_id) {
173 DCHECK(is_loaded_); 173 DCHECK(is_loaded_);
174 auto iter = offline_pages_.find(bookmark_id); 174 auto iter = offline_pages_.find(bookmark_id);
175 if (iter == offline_pages_.end()) 175 if (iter == offline_pages_.end())
176 return; 176 return;
177 177
178 // MarkPageAccessed should not be called for a page that is being marked for 178 // MarkPageAccessed should not be called for a page that is being marked for
179 // deletion. 179 // deletion.
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 } 708 }
709 709
710 void OfflinePageModel::CacheLoadedData( 710 void OfflinePageModel::CacheLoadedData(
711 const std::vector<OfflinePageItem>& offline_pages) { 711 const std::vector<OfflinePageItem>& offline_pages) {
712 offline_pages_.clear(); 712 offline_pages_.clear();
713 for (const auto& offline_page : offline_pages) 713 for (const auto& offline_page : offline_pages)
714 offline_pages_[offline_page.bookmark_id] = offline_page; 714 offline_pages_[offline_page.bookmark_id] = offline_page;
715 } 715 }
716 716
717 } // namespace offline_pages 717 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698