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

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

Issue 2960373002: Rename TaskRunner::RunsTasksOnCurrentThread() in //service, //components (Closed)
Patch Set: Created 3 years, 5 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 | services/resource_coordinator/tracing/recorder.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_backend.h" 5 #include "components/history/core/browser/top_sites_backend.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 tracker->PostTaskAndReply(db_task_runner_.get(), FROM_HERE, 79 tracker->PostTaskAndReply(db_task_runner_.get(), FROM_HERE,
80 base::Bind(&base::DoNothing), reply); 80 base::Bind(&base::DoNothing), reply);
81 } 81 }
82 82
83 TopSitesBackend::~TopSitesBackend() { 83 TopSitesBackend::~TopSitesBackend() {
84 DCHECK(!db_); // Shutdown should have happened first (which results in 84 DCHECK(!db_); // Shutdown should have happened first (which results in
85 // nulling out db). 85 // nulling out db).
86 } 86 }
87 87
88 void TopSitesBackend::InitDBOnDBThread(const base::FilePath& path) { 88 void TopSitesBackend::InitDBOnDBThread(const base::FilePath& path) {
89 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); 89 DCHECK(db_task_runner_->RunsTasksInCurrentSequence());
90 if (!db_->Init(path)) { 90 if (!db_->Init(path)) {
91 LOG(ERROR) << "Failed to initialize database."; 91 LOG(ERROR) << "Failed to initialize database.";
92 db_.reset(); 92 db_.reset();
93 } 93 }
94 } 94 }
95 95
96 void TopSitesBackend::ShutdownDBOnDBThread() { 96 void TopSitesBackend::ShutdownDBOnDBThread() {
97 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); 97 DCHECK(db_task_runner_->RunsTasksInCurrentSequence());
98 db_.reset(); 98 db_.reset();
99 } 99 }
100 100
101 void TopSitesBackend::GetMostVisitedThumbnailsOnDBThread( 101 void TopSitesBackend::GetMostVisitedThumbnailsOnDBThread(
102 scoped_refptr<MostVisitedThumbnails> thumbnails) { 102 scoped_refptr<MostVisitedThumbnails> thumbnails) {
103 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); 103 DCHECK(db_task_runner_->RunsTasksInCurrentSequence());
104 104
105 if (db_) { 105 if (db_) {
106 db_->GetPageThumbnails(&(thumbnails->most_visited), 106 db_->GetPageThumbnails(&(thumbnails->most_visited),
107 &(thumbnails->url_to_images_map)); 107 &(thumbnails->url_to_images_map));
108 } 108 }
109 } 109 }
110 110
111 void TopSitesBackend::UpdateTopSitesOnDBThread( 111 void TopSitesBackend::UpdateTopSitesOnDBThread(
112 const TopSitesDelta& delta, const RecordHistogram record_or_not) { 112 const TopSitesDelta& delta, const RecordHistogram record_or_not) {
113 TRACE_EVENT0("startup", "history::TopSitesBackend::UpdateTopSitesOnDBThread"); 113 TRACE_EVENT0("startup", "history::TopSitesBackend::UpdateTopSitesOnDBThread");
(...skipping 21 matching lines...) Expand all
135 void TopSitesBackend::SetPageThumbnailOnDBThread(const MostVisitedURL& url, 135 void TopSitesBackend::SetPageThumbnailOnDBThread(const MostVisitedURL& url,
136 int url_rank, 136 int url_rank,
137 const Images& thumbnail) { 137 const Images& thumbnail) {
138 if (!db_) 138 if (!db_)
139 return; 139 return;
140 140
141 db_->SetPageThumbnail(url, url_rank, thumbnail); 141 db_->SetPageThumbnail(url, url_rank, thumbnail);
142 } 142 }
143 143
144 void TopSitesBackend::ResetDatabaseOnDBThread(const base::FilePath& file_path) { 144 void TopSitesBackend::ResetDatabaseOnDBThread(const base::FilePath& file_path) {
145 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); 145 DCHECK(db_task_runner_->RunsTasksInCurrentSequence());
146 db_.reset(NULL); 146 db_.reset(NULL);
147 sql::Connection::Delete(db_path_); 147 sql::Connection::Delete(db_path_);
148 db_.reset(new TopSitesDatabase()); 148 db_.reset(new TopSitesDatabase());
149 InitDBOnDBThread(db_path_); 149 InitDBOnDBThread(db_path_);
150 } 150 }
151 151
152 } // namespace history 152 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | services/resource_coordinator/tracing/recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698