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

Side by Side Diff: content/browser/service_worker/service_worker_cache_storage.cc

Issue 472843002: Use the task runner instead of MessageLoop::current() to PostTask (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698