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

Side by Side Diff: components/history/core/browser/top_sites_impl.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/history/core/browser/top_sites_impl.h" 5 #include "components/history/core/browser/top_sites_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // WARNING: this function may be invoked on any thread. 210 // WARNING: this function may be invoked on any thread.
211 void TopSitesImpl::GetMostVisitedURLs( 211 void TopSitesImpl::GetMostVisitedURLs(
212 const GetMostVisitedURLsCallback& callback, 212 const GetMostVisitedURLsCallback& callback,
213 bool include_forced_urls) { 213 bool include_forced_urls) {
214 MostVisitedURLList filtered_urls; 214 MostVisitedURLList filtered_urls;
215 { 215 {
216 base::AutoLock lock(lock_); 216 base::AutoLock lock(lock_);
217 if (!loaded_) { 217 if (!loaded_) {
218 // A request came in before we finished loading. Store the callback and 218 // A request came in before we finished loading. Store the callback and
219 // we'll run it on current thread when we finish loading. 219 // we'll run it on current thread when we finish loading.
220 pending_callbacks_.push_back(base::Bind( 220 pending_callbacks_.push_back(
221 &RunOrPostGetMostVisitedURLsCallback, 221 base::Bind(&RunOrPostGetMostVisitedURLsCallback,
222 base::ThreadTaskRunnerHandle::Get(), include_forced_urls, callback)); 222 base::RetainedRef(base::ThreadTaskRunnerHandle::Get()),
223 include_forced_urls, callback));
223 return; 224 return;
224 } 225 }
225 if (include_forced_urls) { 226 if (include_forced_urls) {
226 filtered_urls = thread_safe_cache_->top_sites(); 227 filtered_urls = thread_safe_cache_->top_sites();
227 } else { 228 } else {
228 filtered_urls.assign(thread_safe_cache_->top_sites().begin() + 229 filtered_urls.assign(thread_safe_cache_->top_sites().begin() +
229 thread_safe_cache_->GetNumForcedURLs(), 230 thread_safe_cache_->GetNumForcedURLs(),
230 thread_safe_cache_->top_sites().end()); 231 thread_safe_cache_->top_sites().end());
231 } 232 }
232 } 233 }
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin(); 935 for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin();
935 i != indices_to_delete.rend(); i++) { 936 i != indices_to_delete.rend(); i++) {
936 new_top_sites.erase(new_top_sites.begin() + *i); 937 new_top_sites.erase(new_top_sites.begin() + *i);
937 } 938 }
938 SetTopSites(new_top_sites, CALL_LOCATION_FROM_OTHER_PLACES); 939 SetTopSites(new_top_sites, CALL_LOCATION_FROM_OTHER_PLACES);
939 } 940 }
940 StartQueryForMostVisited(); 941 StartQueryForMostVisited();
941 } 942 }
942 943
943 } // namespace history 944 } // namespace history
OLDNEW
« no previous file with comments | « components/drive/file_system/search_operation.cc ('k') | components/scheduler/base/task_queue_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698