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

Side by Side Diff: storage/browser/fileapi/file_system_operation_runner.cc

Issue 1159553007: Move Tuple to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 "storage/browser/fileapi/file_system_operation_runner.h" 5 #include "storage/browser/fileapi/file_system_operation_runner.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "net/url_request/url_request_context.h" 10 #include "net/url_request/url_request_context.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 AsWeakPtr(), handle, callback, type, source_url, dest_url, size)); 625 AsWeakPtr(), handle, callback, type, source_url, dest_url, size));
626 return; 626 return;
627 } 627 }
628 callback.Run(type, source_url, dest_url, size); 628 callback.Run(type, source_url, dest_url, size);
629 } 629 }
630 630
631 void FileSystemOperationRunner::PrepareForWrite(OperationID id, 631 void FileSystemOperationRunner::PrepareForWrite(OperationID id,
632 const FileSystemURL& url) { 632 const FileSystemURL& url) {
633 if (file_system_context_->GetUpdateObservers(url.type())) { 633 if (file_system_context_->GetUpdateObservers(url.type())) {
634 file_system_context_->GetUpdateObservers(url.type())->Notify( 634 file_system_context_->GetUpdateObservers(url.type())->Notify(
635 &FileUpdateObserver::OnStartUpdate, MakeTuple(url)); 635 &FileUpdateObserver::OnStartUpdate, base::MakeTuple(url));
636 } 636 }
637 write_target_urls_[id].insert(url); 637 write_target_urls_[id].insert(url);
638 } 638 }
639 639
640 void FileSystemOperationRunner::PrepareForRead(OperationID id, 640 void FileSystemOperationRunner::PrepareForRead(OperationID id,
641 const FileSystemURL& url) { 641 const FileSystemURL& url) {
642 if (file_system_context_->GetAccessObservers(url.type())) { 642 if (file_system_context_->GetAccessObservers(url.type())) {
643 file_system_context_->GetAccessObservers(url.type())->Notify( 643 file_system_context_->GetAccessObservers(url.type())->Notify(
644 &FileAccessObserver::OnAccess, MakeTuple(url)); 644 &FileAccessObserver::OnAccess, base::MakeTuple(url));
645 } 645 }
646 } 646 }
647 647
648 FileSystemOperationRunner::OperationHandle 648 FileSystemOperationRunner::OperationHandle
649 FileSystemOperationRunner::BeginOperation( 649 FileSystemOperationRunner::BeginOperation(
650 FileSystemOperation* operation, 650 FileSystemOperation* operation,
651 base::WeakPtr<BeginOperationScoper> scope) { 651 base::WeakPtr<BeginOperationScoper> scope) {
652 OperationHandle handle; 652 OperationHandle handle;
653 handle.id = operations_.Add(operation); 653 handle.id = operations_.Add(operation);
654 handle.scope = scope; 654 handle.scope = scope;
655 return handle; 655 return handle;
656 } 656 }
657 657
658 void FileSystemOperationRunner::FinishOperation(OperationID id) { 658 void FileSystemOperationRunner::FinishOperation(OperationID id) {
659 OperationToURLSet::iterator found = write_target_urls_.find(id); 659 OperationToURLSet::iterator found = write_target_urls_.find(id);
660 if (found != write_target_urls_.end()) { 660 if (found != write_target_urls_.end()) {
661 const FileSystemURLSet& urls = found->second; 661 const FileSystemURLSet& urls = found->second;
662 for (FileSystemURLSet::const_iterator iter = urls.begin(); 662 for (FileSystemURLSet::const_iterator iter = urls.begin();
663 iter != urls.end(); ++iter) { 663 iter != urls.end(); ++iter) {
664 if (file_system_context_->GetUpdateObservers(iter->type())) { 664 if (file_system_context_->GetUpdateObservers(iter->type())) {
665 file_system_context_->GetUpdateObservers(iter->type())->Notify( 665 file_system_context_->GetUpdateObservers(iter->type())->Notify(
666 &FileUpdateObserver::OnEndUpdate, MakeTuple(*iter)); 666 &FileUpdateObserver::OnEndUpdate, base::MakeTuple(*iter));
667 } 667 }
668 } 668 }
669 write_target_urls_.erase(found); 669 write_target_urls_.erase(found);
670 } 670 }
671 671
672 // IDMap::Lookup fails if the operation is NULL, so we don't check 672 // IDMap::Lookup fails if the operation is NULL, so we don't check
673 // operations_.Lookup(id) here. 673 // operations_.Lookup(id) here.
674 674
675 operations_.Remove(id); 675 operations_.Remove(id);
676 finished_operations_.erase(id); 676 finished_operations_.erase(id);
677 677
678 // Dispatch stray cancel callback if exists. 678 // Dispatch stray cancel callback if exists.
679 std::map<OperationID, StatusCallback>::iterator found_cancel = 679 std::map<OperationID, StatusCallback>::iterator found_cancel =
680 stray_cancel_callbacks_.find(id); 680 stray_cancel_callbacks_.find(id);
681 if (found_cancel != stray_cancel_callbacks_.end()) { 681 if (found_cancel != stray_cancel_callbacks_.end()) {
682 // This cancel has been requested after the operation has finished, 682 // This cancel has been requested after the operation has finished,
683 // so report that we failed to stop it. 683 // so report that we failed to stop it.
684 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); 684 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION);
685 stray_cancel_callbacks_.erase(found_cancel); 685 stray_cancel_callbacks_.erase(found_cancel);
686 } 686 }
687 } 687 }
688 688
689 } // namespace storage 689 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/file_system_operation_impl.cc ('k') | storage/browser/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698