OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "webkit/tools/test_shell/simple_appcache_system.h" | 5 #include "webkit/tools/test_shell/simple_appcache_system.h" |
6 | 6 |
7 #include "base/lock.h" | 7 #include "base/lock.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "base/waitable_event.h" | 9 #include "base/waitable_event.h" |
10 #include "webkit/appcache/appcache_interceptor.h" | 10 #include "webkit/appcache/appcache_interceptor.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 | 252 |
253 void SimpleAppCacheSystem::InitOnUIThread( | 253 void SimpleAppCacheSystem::InitOnUIThread( |
254 const FilePath& cache_directory) { | 254 const FilePath& cache_directory) { |
255 DCHECK(!ui_message_loop_); | 255 DCHECK(!ui_message_loop_); |
256 DCHECK(!cache_directory.empty()); | 256 DCHECK(!cache_directory.empty()); |
257 ui_message_loop_ = MessageLoop::current(); | 257 ui_message_loop_ = MessageLoop::current(); |
258 cache_directory_ = cache_directory; | 258 cache_directory_ = cache_directory; |
259 } | 259 } |
260 | 260 |
261 void SimpleAppCacheSystem::InitOnIOThread() { | 261 void SimpleAppCacheSystem::InitOnIOThread(URLRequestContext* request_context) { |
262 if (!is_initailized_on_ui_thread()) | 262 if (!is_initailized_on_ui_thread()) |
263 return; | 263 return; |
264 | 264 |
265 DCHECK(!io_message_loop_); | 265 DCHECK(!io_message_loop_); |
266 io_message_loop_ = MessageLoop::current(); | 266 io_message_loop_ = MessageLoop::current(); |
267 io_message_loop_->AddDestructionObserver(this); | 267 io_message_loop_->AddDestructionObserver(this); |
268 | 268 |
269 // Recreate and initialize per each IO thread. | 269 // Recreate and initialize per each IO thread. |
270 service_ = new appcache::AppCacheService(); | 270 service_ = new appcache::AppCacheService(); |
271 backend_impl_ = new appcache::AppCacheBackendImpl(); | 271 backend_impl_ = new appcache::AppCacheBackendImpl(); |
272 service_->Initialize(cache_directory_); | 272 service_->Initialize(cache_directory_); |
| 273 service_->set_request_context(request_context); |
273 backend_impl_->Initialize(service_, frontend_proxy_.get(), kSingleProcessId); | 274 backend_impl_->Initialize(service_, frontend_proxy_.get(), kSingleProcessId); |
274 | 275 |
275 AppCacheInterceptor::EnsureRegistered(); | 276 AppCacheInterceptor::EnsureRegistered(); |
276 } | 277 } |
277 | 278 |
278 WebApplicationCacheHost* SimpleAppCacheSystem::CreateCacheHostForWebKit( | 279 WebApplicationCacheHost* SimpleAppCacheSystem::CreateCacheHostForWebKit( |
279 WebApplicationCacheHostClient* client) { | 280 WebApplicationCacheHostClient* client) { |
280 if (!is_initailized_on_ui_thread()) | 281 if (!is_initailized_on_ui_thread()) |
281 return NULL; | 282 return NULL; |
282 | 283 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 315 |
315 io_message_loop_ = NULL; | 316 io_message_loop_ = NULL; |
316 delete backend_impl_; | 317 delete backend_impl_; |
317 delete service_; | 318 delete service_; |
318 backend_impl_ = NULL; | 319 backend_impl_ = NULL; |
319 service_ = NULL; | 320 service_ = NULL; |
320 | 321 |
321 // Just in case the main thread is waiting on it. | 322 // Just in case the main thread is waiting on it. |
322 backend_proxy_->SignalEvent(); | 323 backend_proxy_->SignalEvent(); |
323 } | 324 } |
OLD | NEW |