| OLD | NEW |
| 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/gdata/gdata_cache.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_cache.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/chromeos/chromeos_version.h" | 9 #include "base/chromeos/chromeos_version.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 CacheMap::iterator iter = cache_map_.find(resource_id); | 1205 CacheMap::iterator iter = cache_map_.find(resource_id); |
| 1206 if (iter != cache_map_.end()) { | 1206 if (iter != cache_map_.end()) { |
| 1207 // Delete the CacheEntry and remove it from the map. | 1207 // Delete the CacheEntry and remove it from the map. |
| 1208 cache_map_.erase(iter); | 1208 cache_map_.erase(iter); |
| 1209 } | 1209 } |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 scoped_ptr<GDataCache::CacheEntry> GDataCacheMap::GetCacheEntry( | 1212 scoped_ptr<GDataCache::CacheEntry> GDataCacheMap::GetCacheEntry( |
| 1213 const std::string& resource_id, | 1213 const std::string& resource_id, |
| 1214 const std::string& md5) { | 1214 const std::string& md5) { |
| 1215 // TODO(satorux): Enable this once all callers are fixed: crbug.com/131826. | 1215 AssertOnSequencedWorkerPool(); |
| 1216 // AssertOnSequencedWorkerPool(); | |
| 1217 | 1216 |
| 1218 CacheMap::iterator iter = cache_map_.find(resource_id); | 1217 CacheMap::iterator iter = cache_map_.find(resource_id); |
| 1219 if (iter == cache_map_.end()) { | 1218 if (iter == cache_map_.end()) { |
| 1220 DVLOG(1) << "Can't find " << resource_id << " in cache map"; | 1219 DVLOG(1) << "Can't find " << resource_id << " in cache map"; |
| 1221 return scoped_ptr<CacheEntry>(); | 1220 return scoped_ptr<CacheEntry>(); |
| 1222 } | 1221 } |
| 1223 | 1222 |
| 1224 scoped_ptr<CacheEntry> cache_entry(new CacheEntry(iter->second)); | 1223 scoped_ptr<CacheEntry> cache_entry(new CacheEntry(iter->second)); |
| 1225 | 1224 |
| 1226 // If entry is not dirty, it's only valid if matches with non-empty |md5|. | 1225 // If entry is not dirty, it's only valid if matches with non-empty |md5|. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 cache_base_path.Append(chrome::kGDataCacheDirname); | 1330 cache_base_path.Append(chrome::kGDataCacheDirname); |
| 1332 return cache_root_path.Append(kGDataCacheVersionDir); | 1331 return cache_root_path.Append(kGDataCacheVersionDir); |
| 1333 } | 1332 } |
| 1334 | 1333 |
| 1335 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { | 1334 void SetFreeDiskSpaceGetterForTesting(FreeDiskSpaceGetterInterface* getter) { |
| 1336 delete global_free_disk_getter_for_testing; // Safe to delete NULL; | 1335 delete global_free_disk_getter_for_testing; // Safe to delete NULL; |
| 1337 global_free_disk_getter_for_testing = getter; | 1336 global_free_disk_getter_for_testing = getter; |
| 1338 } | 1337 } |
| 1339 | 1338 |
| 1340 } // namespace gdata | 1339 } // namespace gdata |
| OLD | NEW |