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

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

Issue 513323002: Service worker fixups for scoped_refptr operator T* removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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
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_manager.h" 5 #include "content/browser/service_worker/service_worker_cache_storage_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 } // namespace 30 } // namespace
31 31
32 namespace content { 32 namespace content {
33 33
34 // static 34 // static
35 scoped_ptr<ServiceWorkerCacheStorageManager> 35 scoped_ptr<ServiceWorkerCacheStorageManager>
36 ServiceWorkerCacheStorageManager::Create( 36 ServiceWorkerCacheStorageManager::Create(
37 const base::FilePath& path, 37 const base::FilePath& path,
38 base::SequencedTaskRunner* cache_task_runner) { 38 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner) {
39 base::FilePath root_path = path; 39 base::FilePath root_path = path;
40 if (!path.empty()) { 40 if (!path.empty()) {
41 root_path = path.Append(ServiceWorkerContextCore::kServiceWorkerDirectory) 41 root_path = path.Append(ServiceWorkerContextCore::kServiceWorkerDirectory)
42 .AppendASCII("CacheStorage"); 42 .AppendASCII("CacheStorage");
43 } 43 }
44 44
45 return make_scoped_ptr( 45 return make_scoped_ptr(
46 new ServiceWorkerCacheStorageManager(root_path, cache_task_runner)); 46 new ServiceWorkerCacheStorageManager(root_path, cache_task_runner));
47 } 47 }
48 48
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 DCHECK_CURRENTLY_ON(BrowserThread::IO); 131 DCHECK_CURRENTLY_ON(BrowserThread::IO);
132 DCHECK(cache_storage_map_.empty()); 132 DCHECK(cache_storage_map_.empty());
133 DCHECK(!request_context_ || request_context_ == request_context); 133 DCHECK(!request_context_ || request_context_ == request_context);
134 DCHECK(!blob_context_ || blob_context_.get() == blob_storage_context.get()); 134 DCHECK(!blob_context_ || blob_context_.get() == blob_storage_context.get());
135 request_context_ = request_context; 135 request_context_ = request_context;
136 blob_context_ = blob_storage_context; 136 blob_context_ = blob_storage_context;
137 } 137 }
138 138
139 ServiceWorkerCacheStorageManager::ServiceWorkerCacheStorageManager( 139 ServiceWorkerCacheStorageManager::ServiceWorkerCacheStorageManager(
140 const base::FilePath& path, 140 const base::FilePath& path,
141 base::SequencedTaskRunner* cache_task_runner) 141 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner)
142 : root_path_(path), 142 : root_path_(path),
143 cache_task_runner_(cache_task_runner), 143 cache_task_runner_(cache_task_runner),
144 request_context_(NULL) { 144 request_context_(NULL) {
145 } 145 }
146 146
147 ServiceWorkerCacheStorage* 147 ServiceWorkerCacheStorage*
148 ServiceWorkerCacheStorageManager::FindOrCreateServiceWorkerCacheManager( 148 ServiceWorkerCacheStorageManager::FindOrCreateServiceWorkerCacheManager(
149 const GURL& origin) { 149 const GURL& origin) {
150 DCHECK_CURRENTLY_ON(BrowserThread::IO); 150 DCHECK_CURRENTLY_ON(BrowserThread::IO);
151 DCHECK(request_context_); 151 DCHECK(request_context_);
152 152
153 ServiceWorkerCacheStorageMap::const_iterator it = 153 ServiceWorkerCacheStorageMap::const_iterator it =
154 cache_storage_map_.find(origin); 154 cache_storage_map_.find(origin);
155 if (it == cache_storage_map_.end()) { 155 if (it == cache_storage_map_.end()) {
156 bool memory_only = root_path_.empty(); 156 bool memory_only = root_path_.empty();
157 ServiceWorkerCacheStorage* cache_storage = 157 ServiceWorkerCacheStorage* cache_storage =
158 new ServiceWorkerCacheStorage(ConstructOriginPath(root_path_, origin), 158 new ServiceWorkerCacheStorage(ConstructOriginPath(root_path_, origin),
159 memory_only, 159 memory_only,
160 cache_task_runner_.get(), 160 cache_task_runner_.get(),
161 request_context_, 161 request_context_,
162 blob_context_); 162 blob_context_);
163 // The map owns fetch_stores. 163 // The map owns fetch_stores.
164 cache_storage_map_.insert(std::make_pair(origin, cache_storage)); 164 cache_storage_map_.insert(std::make_pair(origin, cache_storage));
165 return cache_storage; 165 return cache_storage;
166 } 166 }
167 return it->second; 167 return it->second;
168 } 168 }
169 169
170 } // namespace content 170 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698