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

Side by Side Diff: chrome/browser/autocomplete/in_memory_url_index.cc

Issue 1103343005: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/autocomplete,banners,background (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | chrome/browser/background/background_mode_manager_mac.mm » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autocomplete/in_memory_url_index.h" 5 #include "chrome/browser/autocomplete/in_memory_url_index.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "chrome/browser/autocomplete/url_index_private_data.h" 10 #include "chrome/browser/autocomplete/url_index_private_data.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 void InMemoryURLIndex::OnHistoryServiceLoaded( 201 void InMemoryURLIndex::OnHistoryServiceLoaded(
202 history::HistoryService* history_service) { 202 history::HistoryService* history_service) {
203 if (listen_to_history_service_loaded_) 203 if (listen_to_history_service_loaded_)
204 ScheduleRebuildFromHistory(); 204 ScheduleRebuildFromHistory();
205 listen_to_history_service_loaded_ = false; 205 listen_to_history_service_loaded_ = false;
206 } 206 }
207 207
208 // Restoring from Cache -------------------------------------------------------- 208 // Restoring from Cache --------------------------------------------------------
209 209
210 void InMemoryURLIndex::PostRestoreFromCacheFileTask() { 210 void InMemoryURLIndex::PostRestoreFromCacheFileTask() {
211 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 211 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
212 TRACE_EVENT0("browser", "InMemoryURLIndex::PostRestoreFromCacheFileTask"); 212 TRACE_EVENT0("browser", "InMemoryURLIndex::PostRestoreFromCacheFileTask");
213 213
214 base::FilePath path; 214 base::FilePath path;
215 if (!GetCacheFilePath(&path) || shutdown_) { 215 if (!GetCacheFilePath(&path) || shutdown_) {
216 restored_ = true; 216 restored_ = true;
217 if (restore_cache_observer_) 217 if (restore_cache_observer_)
218 restore_cache_observer_->OnCacheRestoreFinished(false); 218 restore_cache_observer_->OnCacheRestoreFinished(false);
219 return; 219 return;
220 } 220 }
221 221
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 history_service_->ScheduleDBTask( 279 history_service_->ScheduleDBTask(
280 scoped_ptr<history::HistoryDBTask>( 280 scoped_ptr<history::HistoryDBTask>(
281 new InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask( 281 new InMemoryURLIndex::RebuildPrivateDataFromHistoryDBTask(
282 this, languages_, scheme_whitelist_)), 282 this, languages_, scheme_whitelist_)),
283 &cache_reader_tracker_); 283 &cache_reader_tracker_);
284 } 284 }
285 285
286 void InMemoryURLIndex::DoneRebuidingPrivateDataFromHistoryDB( 286 void InMemoryURLIndex::DoneRebuidingPrivateDataFromHistoryDB(
287 bool succeeded, 287 bool succeeded,
288 scoped_refptr<URLIndexPrivateData> private_data) { 288 scoped_refptr<URLIndexPrivateData> private_data) {
289 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 289 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
290 if (succeeded) { 290 if (succeeded) {
291 private_data_tracker_.TryCancelAll(); 291 private_data_tracker_.TryCancelAll();
292 private_data_ = private_data; 292 private_data_ = private_data;
293 PostSaveToCacheFileTask(); // Cache the newly rebuilt index. 293 PostSaveToCacheFileTask(); // Cache the newly rebuilt index.
294 } else { 294 } else {
295 private_data_->Clear(); // Dump the old private data. 295 private_data_->Clear(); // Dump the old private data.
296 // There is no need to do anything with the cache file as it was deleted 296 // There is no need to do anything with the cache file as it was deleted
297 // when the rebuild from the history operation was kicked off. 297 // when the rebuild from the history operation was kicked off.
298 } 298 }
299 restored_ = true; 299 restored_ = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } else { 331 } else {
332 // If there is no data in our index then delete any existing cache file. 332 // If there is no data in our index then delete any existing cache file.
333 task_runner_->PostTask(FROM_HERE, base::Bind(DeleteCacheFile, path)); 333 task_runner_->PostTask(FROM_HERE, base::Bind(DeleteCacheFile, path));
334 } 334 }
335 } 335 }
336 336
337 void InMemoryURLIndex::OnCacheSaveDone(bool succeeded) { 337 void InMemoryURLIndex::OnCacheSaveDone(bool succeeded) {
338 if (save_cache_observer_) 338 if (save_cache_observer_)
339 save_cache_observer_->OnCacheSaveFinished(succeeded); 339 save_cache_observer_->OnCacheSaveFinished(succeeded);
340 } 340 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/background/background_mode_manager_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698