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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 CacheMap::iterator iter = cache_map_.find(resource_id); | 219 CacheMap::iterator iter = cache_map_.find(resource_id); |
220 if (iter != cache_map_.end()) { | 220 if (iter != cache_map_.end()) { |
221 // Delete the CacheEntry and remove it from the map. | 221 // Delete the CacheEntry and remove it from the map. |
222 cache_map_.erase(iter); | 222 cache_map_.erase(iter); |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 scoped_ptr<GDataCache::CacheEntry> GDataCacheMap::GetCacheEntry( | 226 scoped_ptr<GDataCache::CacheEntry> GDataCacheMap::GetCacheEntry( |
227 const std::string& resource_id, | 227 const std::string& resource_id, |
228 const std::string& md5) { | 228 const std::string& md5) { |
229 // TODO(satorux): Enable this once all callers are fixed: crbug.com/131826. | 229 AssertOnSequencedWorkerPool(); |
230 // AssertOnSequencedWorkerPool(); | |
231 | 230 |
232 CacheMap::iterator iter = cache_map_.find(resource_id); | 231 CacheMap::iterator iter = cache_map_.find(resource_id); |
233 if (iter == cache_map_.end()) { | 232 if (iter == cache_map_.end()) { |
234 DVLOG(1) << "Can't find " << resource_id << " in cache map"; | 233 DVLOG(1) << "Can't find " << resource_id << " in cache map"; |
235 return scoped_ptr<CacheEntry>(); | 234 return scoped_ptr<CacheEntry>(); |
236 } | 235 } |
237 | 236 |
238 scoped_ptr<CacheEntry> cache_entry(new CacheEntry(iter->second)); | 237 scoped_ptr<CacheEntry> cache_entry(new CacheEntry(iter->second)); |
239 | 238 |
240 // If entry is not dirty, it's only valid if matches with non-empty |md5|. | 239 // If entry is not dirty, it's only valid if matches with non-empty |md5|. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // static | 279 // static |
281 FilePath GDataCache::GetCacheRootPath(Profile* profile) { | 280 FilePath GDataCache::GetCacheRootPath(Profile* profile) { |
282 FilePath cache_base_path; | 281 FilePath cache_base_path; |
283 chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path); | 282 chrome::GetUserCacheDirectory(profile->GetPath(), &cache_base_path); |
284 FilePath cache_root_path = | 283 FilePath cache_root_path = |
285 cache_base_path.Append(chrome::kGDataCacheDirname); | 284 cache_base_path.Append(chrome::kGDataCacheDirname); |
286 return cache_root_path.Append(kGDataCacheVersionDir); | 285 return cache_root_path.Append(kGDataCacheVersionDir); |
287 } | 286 } |
288 | 287 |
289 } // namespace gdata | 288 } // namespace gdata |
OLD | NEW |