OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/fileapi/webfilesystem_impl.h" | 5 #include "content/child/fileapi/webfilesystem_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 if (g_webfilesystem_tls.Pointer()->Get() || !main_thread_loop) | 335 if (g_webfilesystem_tls.Pointer()->Get() || !main_thread_loop) |
336 return g_webfilesystem_tls.Pointer()->Get(); | 336 return g_webfilesystem_tls.Pointer()->Get(); |
337 WebFileSystemImpl* filesystem = new WebFileSystemImpl(main_thread_loop); | 337 WebFileSystemImpl* filesystem = new WebFileSystemImpl(main_thread_loop); |
338 if (WorkerTaskRunner::Instance()->CurrentWorkerId()) | 338 if (WorkerTaskRunner::Instance()->CurrentWorkerId()) |
339 WorkerTaskRunner::Instance()->AddStopObserver(filesystem); | 339 WorkerTaskRunner::Instance()->AddStopObserver(filesystem); |
340 return filesystem; | 340 return filesystem; |
341 } | 341 } |
342 | 342 |
343 void WebFileSystemImpl::DeleteThreadSpecificInstance() { | 343 void WebFileSystemImpl::DeleteThreadSpecificInstance() { |
344 DCHECK(!WorkerTaskRunner::Instance()->CurrentWorkerId()); | 344 DCHECK(!WorkerTaskRunner::Instance()->CurrentWorkerId()); |
345 if (g_webfilesystem_tls.Pointer()->Get()) | 345 if (g_webfilesystem_tls.Pointer()->Get()) { |
346 delete g_webfilesystem_tls.Pointer()->Get(); | 346 delete g_webfilesystem_tls.Pointer()->Get(); |
347 g_webfilesystem_tls.Pointer()->Set(NULL); | |
kinuko
2014/05/08 07:44:09
Don't we do this in WebFileSystemImpl dtor?
tzik
2014/05/08 08:05:30
Ah, yes, it's done in it. Reverted.
| |
348 } | |
347 } | 349 } |
348 | 350 |
349 WebFileSystemImpl::WebFileSystemImpl(base::MessageLoopProxy* main_thread_loop) | 351 WebFileSystemImpl::WebFileSystemImpl(base::MessageLoopProxy* main_thread_loop) |
350 : main_thread_loop_(main_thread_loop), | 352 : main_thread_loop_(main_thread_loop), |
351 next_callbacks_id_(1) { | 353 next_callbacks_id_(1) { |
352 g_webfilesystem_tls.Pointer()->Set(this); | 354 g_webfilesystem_tls.Pointer()->Set(this); |
353 } | 355 } |
354 | 356 |
355 WebFileSystemImpl::~WebFileSystemImpl() { | 357 WebFileSystemImpl::~WebFileSystemImpl() { |
356 g_webfilesystem_tls.Pointer()->Set(NULL); | 358 g_webfilesystem_tls.Pointer()->Set(NULL); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
646 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults( | 648 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults( |
647 const WebFileSystemCallbacks& callbacks, int callbacks_id) { | 649 const WebFileSystemCallbacks& callbacks, int callbacks_id) { |
648 if (!callbacks.shouldBlockUntilCompletion()) | 650 if (!callbacks.shouldBlockUntilCompletion()) |
649 return NULL; | 651 return NULL; |
650 WaitableCallbackResults* results = new WaitableCallbackResults(); | 652 WaitableCallbackResults* results = new WaitableCallbackResults(); |
651 waitable_results_[callbacks_id] = results; | 653 waitable_results_[callbacks_id] = results; |
652 return results; | 654 return results; |
653 } | 655 } |
654 | 656 |
655 } // namespace content | 657 } // namespace content |
OLD | NEW |