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

Side by Side Diff: chrome/browser/chromeos/drive/file_cache.cc

Issue 1036723003: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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) 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/chromeos/drive/file_cache.h" 5 #include "chrome/browser/chromeos/drive/file_cache.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 FileCache::FileCache(ResourceMetadataStorage* storage, 42 FileCache::FileCache(ResourceMetadataStorage* storage,
43 const base::FilePath& cache_file_directory, 43 const base::FilePath& cache_file_directory,
44 base::SequencedTaskRunner* blocking_task_runner, 44 base::SequencedTaskRunner* blocking_task_runner,
45 FreeDiskSpaceGetterInterface* free_disk_space_getter) 45 FreeDiskSpaceGetterInterface* free_disk_space_getter)
46 : cache_file_directory_(cache_file_directory), 46 : cache_file_directory_(cache_file_directory),
47 blocking_task_runner_(blocking_task_runner), 47 blocking_task_runner_(blocking_task_runner),
48 storage_(storage), 48 storage_(storage),
49 free_disk_space_getter_(free_disk_space_getter), 49 free_disk_space_getter_(free_disk_space_getter),
50 weak_ptr_factory_(this) { 50 weak_ptr_factory_(this) {
51 DCHECK(blocking_task_runner_.get()); 51 DCHECK(blocking_task_runner_.get());
52 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 52 DCHECK_CURRENTLY_ON(BrowserThread::UI);
53 } 53 }
54 54
55 FileCache::~FileCache() { 55 FileCache::~FileCache() {
56 // Must be on the sequenced worker pool, as |metadata_| must be deleted on 56 // Must be on the sequenced worker pool, as |metadata_| must be deleted on
57 // the sequenced worker pool. 57 // the sequenced worker pool.
58 AssertOnSequencedWorkerPool(); 58 AssertOnSequencedWorkerPool();
59 } 59 }
60 60
61 base::FilePath FileCache::GetCacheFilePath(const std::string& id) const { 61 base::FilePath FileCache::GetCacheFilePath(const std::string& id) const {
62 return cache_file_directory_.Append( 62 return cache_file_directory_.Append(
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 407 }
408 if (it->HasError()) 408 if (it->HasError())
409 return false; 409 return false;
410 410
411 if (!RenameCacheFilesToNewFormat()) 411 if (!RenameCacheFilesToNewFormat())
412 return false; 412 return false;
413 return true; 413 return true;
414 } 414 }
415 415
416 void FileCache::Destroy() { 416 void FileCache::Destroy() {
417 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 417 DCHECK_CURRENTLY_ON(BrowserThread::UI);
418 418
419 // Destroy myself on the blocking pool. 419 // Destroy myself on the blocking pool.
420 // Note that base::DeletePointer<> cannot be used as the destructor of this 420 // Note that base::DeletePointer<> cannot be used as the destructor of this
421 // class is private. 421 // class is private.
422 blocking_task_runner_->PostTask( 422 blocking_task_runner_->PostTask(
423 FROM_HERE, 423 FROM_HERE,
424 base::Bind(&FileCache::DestroyOnBlockingPool, base::Unretained(this))); 424 base::Bind(&FileCache::DestroyOnBlockingPool, base::Unretained(this)));
425 } 425 }
426 426
427 void FileCache::DestroyOnBlockingPool() { 427 void FileCache::DestroyOnBlockingPool() {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 base::Time::Now().ToInternalValue()); 604 base::Time::Now().ToInternalValue());
605 error = storage_->PutEntry(entry); 605 error = storage_->PutEntry(entry);
606 if (error != FILE_ERROR_OK) { 606 if (error != FILE_ERROR_OK) {
607 LOG(ERROR) << "Failed to put entry: " << id << ", " 607 LOG(ERROR) << "Failed to put entry: " << id << ", "
608 << FileErrorToString(error); 608 << FileErrorToString(error);
609 } 609 }
610 } 610 }
611 611
612 } // namespace internal 612 } // namespace internal
613 } // namespace drive 613 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/fake_file_system.cc ('k') | chrome/browser/chromeos/drive/file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698