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

Side by Side Diff: content/child/fileapi/webfilesystem_impl.cc

Issue 2915503002: Replace deprecated base::NonThreadSafe in content/child/fileapi in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <tuple> 8 #include <tuple>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 390 }
391 391
392 WebFileSystemImpl::WebFileSystemImpl( 392 WebFileSystemImpl::WebFileSystemImpl(
393 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner) 393 const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner)
394 : main_thread_task_runner_(main_thread_task_runner), 394 : main_thread_task_runner_(main_thread_task_runner),
395 next_callbacks_id_(1) { 395 next_callbacks_id_(1) {
396 g_webfilesystem_tls.Pointer()->Set(this); 396 g_webfilesystem_tls.Pointer()->Set(this);
397 } 397 }
398 398
399 WebFileSystemImpl::~WebFileSystemImpl() { 399 WebFileSystemImpl::~WebFileSystemImpl() {
400 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
400 g_webfilesystem_tls.Pointer()->Set(NULL); 401 g_webfilesystem_tls.Pointer()->Set(NULL);
401 } 402 }
402 403
403 void WebFileSystemImpl::WillStopCurrentWorkerThread() { 404 void WebFileSystemImpl::WillStopCurrentWorkerThread() {
404 delete this; 405 delete this;
405 } 406 }
406 407
407 void WebFileSystemImpl::OpenFileSystem(const blink::WebURL& storage_partition, 408 void WebFileSystemImpl::OpenFileSystem(const blink::WebURL& storage_partition,
408 blink::WebFileSystemType type, 409 blink::WebFileSystemType type,
409 WebFileSystemCallbacks callbacks) { 410 WebFileSystemCallbacks callbacks) {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 waitable_results_.find(callbacksId); 648 waitable_results_.find(callbacksId);
648 if (found == waitable_results_.end()) 649 if (found == waitable_results_.end())
649 return false; 650 return false;
650 651
651 found->second->WaitAndRun(); 652 found->second->WaitAndRun();
652 return true; 653 return true;
653 } 654 }
654 655
655 int WebFileSystemImpl::RegisterCallbacks( 656 int WebFileSystemImpl::RegisterCallbacks(
656 const WebFileSystemCallbacks& callbacks) { 657 const WebFileSystemCallbacks& callbacks) {
657 DCHECK(CalledOnValidThread()); 658 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
658 int id = next_callbacks_id_++; 659 int id = next_callbacks_id_++;
659 callbacks_[id] = callbacks; 660 callbacks_[id] = callbacks;
660 return id; 661 return id;
661 } 662 }
662 663
663 WebFileSystemCallbacks WebFileSystemImpl::GetCallbacks(int callbacks_id) { 664 WebFileSystemCallbacks WebFileSystemImpl::GetCallbacks(int callbacks_id) {
664 DCHECK(CalledOnValidThread()); 665 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
665 CallbacksMap::iterator found = callbacks_.find(callbacks_id); 666 CallbacksMap::iterator found = callbacks_.find(callbacks_id);
666 DCHECK(found != callbacks_.end()); 667 DCHECK(found != callbacks_.end());
667 return found->second; 668 return found->second;
668 } 669 }
669 670
670 void WebFileSystemImpl::UnregisterCallbacks(int callbacks_id) { 671 void WebFileSystemImpl::UnregisterCallbacks(int callbacks_id) {
671 DCHECK(CalledOnValidThread()); 672 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
672 CallbacksMap::iterator found = callbacks_.find(callbacks_id); 673 CallbacksMap::iterator found = callbacks_.find(callbacks_id);
673 DCHECK(found != callbacks_.end()); 674 DCHECK(found != callbacks_.end());
674 callbacks_.erase(found); 675 callbacks_.erase(found);
675 676
676 waitable_results_.erase(callbacks_id); 677 waitable_results_.erase(callbacks_id);
677 } 678 }
678 679
679 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults( 680 WaitableCallbackResults* WebFileSystemImpl::MaybeCreateWaitableResults(
680 const WebFileSystemCallbacks& callbacks, int callbacks_id) { 681 const WebFileSystemCallbacks& callbacks, int callbacks_id) {
681 if (!callbacks.ShouldBlockUntilCompletion()) 682 if (!callbacks.ShouldBlockUntilCompletion())
682 return NULL; 683 return NULL;
683 WaitableCallbackResults* results = new WaitableCallbackResults(); 684 WaitableCallbackResults* results = new WaitableCallbackResults();
684 waitable_results_[callbacks_id] = results; 685 waitable_results_[callbacks_id] = results;
685 return results; 686 return results;
686 } 687 }
687 688
688 } // namespace content 689 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698