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

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

Issue 18308004: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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 | Annotate | Revision Log
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/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 return (free_space >= num_bytes); 809 return (free_space >= num_bytes);
810 } 810 }
811 811
812 bool FileCache::ImportOldDB(const base::FilePath& old_db_path) { 812 bool FileCache::ImportOldDB(const base::FilePath& old_db_path) {
813 if (!file_util::PathExists(old_db_path)) // Old DB is not there, do nothing. 813 if (!file_util::PathExists(old_db_path)) // Old DB is not there, do nothing.
814 return false; 814 return false;
815 815
816 // Copy all entries stored in the old DB. 816 // Copy all entries stored in the old DB.
817 bool imported = false; 817 bool imported = false;
818 { 818 {
819 FileCacheMetadata old_data(blocking_task_runner_); 819 FileCacheMetadata old_data(blocking_task_runner_.get());
820 if (old_data.Initialize(old_db_path) == 820 if (old_data.Initialize(old_db_path) ==
821 FileCacheMetadata::INITIALIZE_OPENED) { 821 FileCacheMetadata::INITIALIZE_OPENED) {
822 scoped_ptr<FileCacheMetadata::Iterator> it = old_data.GetIterator(); 822 scoped_ptr<FileCacheMetadata::Iterator> it = old_data.GetIterator();
823 for (; !it->IsAtEnd(); it->Advance()) { 823 for (; !it->IsAtEnd(); it->Advance()) {
824 FileCacheEntry entry; 824 FileCacheEntry entry;
825 if (storage_->GetCacheEntry(it->GetKey(), &entry)) 825 if (storage_->GetCacheEntry(it->GetKey(), &entry))
826 continue; // Do not overwrite. 826 continue; // Do not overwrite.
827 827
828 storage_->PutCacheEntry(it->GetKey(), it->GetValue()); 828 storage_->PutCacheEntry(it->GetKey(), it->GetValue());
829 } 829 }
830 imported = true; 830 imported = true;
831 } 831 }
832 } 832 }
833 833
834 // Delete old DB. 834 // Delete old DB.
835 base::Delete(old_db_path, true /* recursive */ ); 835 base::Delete(old_db_path, true /* recursive */ );
836 return imported; 836 return imported;
837 } 837 }
838 838
839 } // namespace internal 839 } // namespace internal
840 } // namespace drive 840 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_url_request_job_unittest.cc ('k') | chrome/browser/chromeos/drive/file_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698