OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/service_worker/service_worker_cache_storage.h" | 5 #include "content/browser/service_worker/service_worker_cache_storage.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/memory_mapped_file.h" | 10 #include "base/files/memory_mapped_file.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 const std::string& cache_name, | 201 const std::string& cache_name, |
202 const CacheCallback& callback, | 202 const CacheCallback& callback, |
203 const scoped_refptr<base::MessageLoopProxy>& original_loop) { | 203 const scoped_refptr<base::MessageLoopProxy>& original_loop) { |
204 DCHECK(cache_task_runner_->RunsTasksOnCurrentThread()); | 204 DCHECK(cache_task_runner_->RunsTasksOnCurrentThread()); |
205 | 205 |
206 base::FilePath path(cache_path); | 206 base::FilePath path(cache_path); |
207 if (base::PathExists(path)) | 207 if (base::PathExists(path)) |
208 base::DeleteFile(path, /* recursive */ true); | 208 base::DeleteFile(path, /* recursive */ true); |
209 | 209 |
210 // Jump straight into LoadCache on the same thread. | 210 // Jump straight into LoadCache on the same thread. |
211 base::MessageLoopProxy::current()->PostTask( | 211 cache_task_runner_->PostTask( |
212 FROM_HERE, | 212 FROM_HERE, |
213 base::Bind(&SimpleCacheLoader::LoadCreateDirectoryInPool, | 213 base::Bind(&SimpleCacheLoader::LoadCreateDirectoryInPool, |
214 this, | 214 this, |
215 cache_path, | 215 cache_path, |
216 cache_name, | 216 cache_name, |
217 callback, | 217 callback, |
218 original_loop)); | 218 original_loop)); |
219 } | 219 } |
220 | 220 |
221 virtual void CleanUpDeletedCache(const std::string& cache_name, | 221 virtual void CleanUpDeletedCache(const std::string& cache_name, |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 NameMap::const_iterator it = name_map_.find(cache_name); | 709 NameMap::const_iterator it = name_map_.find(cache_name); |
710 if (it == name_map_.end()) | 710 if (it == name_map_.end()) |
711 return NULL; | 711 return NULL; |
712 | 712 |
713 ServiceWorkerCache* cache = cache_map_.Lookup(it->second); | 713 ServiceWorkerCache* cache = cache_map_.Lookup(it->second); |
714 DCHECK(cache); | 714 DCHECK(cache); |
715 return cache; | 715 return cache; |
716 } | 716 } |
717 | 717 |
718 } // namespace content | 718 } // namespace content |
OLD | NEW |