| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tools/test_shell/simple_appcache_system.h" | 5 #include "webkit/tools/test_shell/simple_appcache_system.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/lock.h" | 8 #include "base/lock.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "base/waitable_event.h" | 10 #include "base/waitable_event.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 base::WaitableEvent event(false, false); | 296 base::WaitableEvent event(false, false); |
| 297 db_thread_.message_loop()->PostTask(FROM_HERE, | 297 db_thread_.message_loop()->PostTask(FROM_HERE, |
| 298 NewRunnableFunction(&SignalEvent, &event)); | 298 NewRunnableFunction(&SignalEvent, &event)); |
| 299 event.Wait(); | 299 event.Wait(); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 void SimpleAppCacheSystem::InitOnUIThread( | 303 void SimpleAppCacheSystem::InitOnUIThread( |
| 304 const FilePath& cache_directory) { | 304 const FilePath& cache_directory) { |
| 305 DCHECK(!ui_message_loop_); | 305 DCHECK(!ui_message_loop_); |
| 306 AppCacheThread::InitIDs(DB_THREAD_ID, IO_THREAD_ID); | 306 // TODO(michaeln): provide a cache_thread message loop |
| 307 AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID, NULL); |
| 307 ui_message_loop_ = MessageLoop::current(); | 308 ui_message_loop_ = MessageLoop::current(); |
| 308 cache_directory_ = cache_directory; | 309 cache_directory_ = cache_directory; |
| 309 } | 310 } |
| 310 | 311 |
| 311 void SimpleAppCacheSystem::InitOnIOThread(URLRequestContext* request_context) { | 312 void SimpleAppCacheSystem::InitOnIOThread(URLRequestContext* request_context) { |
| 312 if (!is_initailized_on_ui_thread()) | 313 if (!is_initailized_on_ui_thread()) |
| 313 return; | 314 return; |
| 314 | 315 |
| 315 DCHECK(!io_message_loop_); | 316 DCHECK(!io_message_loop_); |
| 316 io_message_loop_ = MessageLoop::current(); | 317 io_message_loop_ = MessageLoop::current(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 369 |
| 369 delete backend_impl_; | 370 delete backend_impl_; |
| 370 delete service_; | 371 delete service_; |
| 371 backend_impl_ = NULL; | 372 backend_impl_ = NULL; |
| 372 service_ = NULL; | 373 service_ = NULL; |
| 373 io_message_loop_ = NULL; | 374 io_message_loop_ = NULL; |
| 374 | 375 |
| 375 // Just in case the main thread is waiting on it. | 376 // Just in case the main thread is waiting on it. |
| 376 backend_proxy_->SignalEvent(); | 377 backend_proxy_->SignalEvent(); |
| 377 } | 378 } |
| OLD | NEW |