OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "webkit/appcache/appcache_service.h" | 5 #include "webkit/appcache/appcache_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "webkit/appcache/appcache_backend_impl.h" | 10 #include "webkit/appcache/appcache_backend_impl.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 AppCacheService::~AppCacheService() { | 137 AppCacheService::~AppCacheService() { |
138 DCHECK(backends_.empty()); | 138 DCHECK(backends_.empty()); |
139 | 139 |
140 std::for_each(pending_helpers_.begin(), | 140 std::for_each(pending_helpers_.begin(), |
141 pending_helpers_.end(), | 141 pending_helpers_.end(), |
142 std::mem_fun(&AsyncHelper::Cancel)); | 142 std::mem_fun(&AsyncHelper::Cancel)); |
143 STLDeleteElements(&pending_helpers_); | 143 STLDeleteElements(&pending_helpers_); |
144 } | 144 } |
145 | 145 |
146 void AppCacheService::Initialize(const FilePath& cache_directory) { | 146 void AppCacheService::Initialize(const FilePath& cache_directory, |
| 147 base::MessageLoopProxy* cache_thread) { |
147 DCHECK(!storage_.get()); | 148 DCHECK(!storage_.get()); |
148 AppCacheStorageImpl* storage = new AppCacheStorageImpl(this); | 149 AppCacheStorageImpl* storage = new AppCacheStorageImpl(this); |
149 storage->Initialize(cache_directory); | 150 storage->Initialize(cache_directory, cache_thread); |
150 storage_.reset(storage); | 151 storage_.reset(storage); |
151 } | 152 } |
152 | 153 |
153 void AppCacheService::GetAllAppCacheInfo(AppCacheInfoCollection* collection, | 154 void AppCacheService::GetAllAppCacheInfo(AppCacheInfoCollection* collection, |
154 net::CompletionCallback* callback) { | 155 net::CompletionCallback* callback) { |
155 DCHECK(collection); | 156 DCHECK(collection); |
156 GetInfoHelper* helper = new GetInfoHelper(this, collection, callback); | 157 GetInfoHelper* helper = new GetInfoHelper(this, collection, callback); |
157 helper->Start(); | 158 helper->Start(); |
158 } | 159 } |
159 | 160 |
160 void AppCacheService::DeleteAppCacheGroup(const GURL& manifest_url, | 161 void AppCacheService::DeleteAppCacheGroup(const GURL& manifest_url, |
161 net::CompletionCallback* callback) { | 162 net::CompletionCallback* callback) { |
162 DeleteHelper* helper = new DeleteHelper(this, manifest_url, callback); | 163 DeleteHelper* helper = new DeleteHelper(this, manifest_url, callback); |
163 helper->Start(); | 164 helper->Start(); |
164 } | 165 } |
165 | 166 |
166 void AppCacheService::RegisterBackend( | 167 void AppCacheService::RegisterBackend( |
167 AppCacheBackendImpl* backend_impl) { | 168 AppCacheBackendImpl* backend_impl) { |
168 DCHECK(backends_.find(backend_impl->process_id()) == backends_.end()); | 169 DCHECK(backends_.find(backend_impl->process_id()) == backends_.end()); |
169 backends_.insert( | 170 backends_.insert( |
170 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 171 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
171 } | 172 } |
172 | 173 |
173 void AppCacheService::UnregisterBackend( | 174 void AppCacheService::UnregisterBackend( |
174 AppCacheBackendImpl* backend_impl) { | 175 AppCacheBackendImpl* backend_impl) { |
175 backends_.erase(backend_impl->process_id()); | 176 backends_.erase(backend_impl->process_id()); |
176 } | 177 } |
177 | 178 |
178 } // namespace appcache | 179 } // namespace appcache |
OLD | NEW |