| OLD | NEW | 
|    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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   44 namespace { |   44 namespace { | 
|   45  |   45  | 
|   46 void RunOrPostGetMostVisitedURLsCallback( |   46 void RunOrPostGetMostVisitedURLsCallback( | 
|   47     base::TaskRunner* task_runner, |   47     base::TaskRunner* task_runner, | 
|   48     bool include_forced_urls, |   48     bool include_forced_urls, | 
|   49     const TopSitesImpl::GetMostVisitedURLsCallback& callback, |   49     const TopSitesImpl::GetMostVisitedURLsCallback& callback, | 
|   50     const MostVisitedURLList& all_urls, |   50     const MostVisitedURLList& all_urls, | 
|   51     const MostVisitedURLList& nonforced_urls) { |   51     const MostVisitedURLList& nonforced_urls) { | 
|   52   const MostVisitedURLList& urls = |   52   const MostVisitedURLList& urls = | 
|   53       include_forced_urls ? all_urls : nonforced_urls; |   53       include_forced_urls ? all_urls : nonforced_urls; | 
|   54   if (task_runner->RunsTasksOnCurrentThread()) |   54   if (task_runner->RunsTasksInCurrentSequence()) | 
|   55     callback.Run(urls); |   55     callback.Run(urls); | 
|   56   else |   56   else | 
|   57     task_runner->PostTask(FROM_HERE, base::Bind(callback, urls)); |   57     task_runner->PostTask(FROM_HERE, base::Bind(callback, urls)); | 
|   58 } |   58 } | 
|   59  |   59  | 
|   60 // Compares two MostVisitedURL having a non-null |last_forced_time|. |   60 // Compares two MostVisitedURL having a non-null |last_forced_time|. | 
|   61 bool ForcedURLComparator(const MostVisitedURL& first, |   61 bool ForcedURLComparator(const MostVisitedURL& first, | 
|   62                          const MostVisitedURL& second) { |   62                          const MostVisitedURL& second) { | 
|   63   DCHECK(!first.last_forced_time.is_null() && |   63   DCHECK(!first.last_forced_time.is_null() && | 
|   64          !second.last_forced_time.is_null()); |   64          !second.last_forced_time.is_null()); | 
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  918     for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin(); |  918     for (std::set<size_t>::reverse_iterator i = indices_to_delete.rbegin(); | 
|  919          i != indices_to_delete.rend(); i++) { |  919          i != indices_to_delete.rend(); i++) { | 
|  920       new_top_sites.erase(new_top_sites.begin() + *i); |  920       new_top_sites.erase(new_top_sites.begin() + *i); | 
|  921     } |  921     } | 
|  922     SetTopSites(new_top_sites, CALL_LOCATION_FROM_OTHER_PLACES); |  922     SetTopSites(new_top_sites, CALL_LOCATION_FROM_OTHER_PLACES); | 
|  923   } |  923   } | 
|  924   StartQueryForMostVisited(); |  924   StartQueryForMostVisited(); | 
|  925 } |  925 } | 
|  926  |  926  | 
|  927 }  // namespace history |  927 }  // namespace history | 
| OLD | NEW |