| 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 "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 5 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/guid.h" | 14 #include "base/guid.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/task_runner_util.h" | 17 #include "base/task_runner_util.h" |
| 18 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| 19 #include "base/trace_event/trace_event.h" |
| 19 #include "chrome/browser/sync_file_system/file_change.h" | 20 #include "chrome/browser/sync_file_system/file_change.h" |
| 20 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 21 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 21 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 22 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 22 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 23 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 23 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 24 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 24 #include "content/public/test/mock_blob_url_request_context.h" | 25 #include "content/public/test/mock_blob_url_request_context.h" |
| 25 #include "content/public/test/mock_special_storage_policy.h" | 26 #include "content/public/test/mock_special_storage_policy.h" |
| 26 #include "content/public/test/test_file_system_options.h" | 27 #include "content/public/test/test_file_system_options.h" |
| 27 #include "storage/browser/blob/shareable_file_reference.h" | 28 #include "storage/browser/blob/shareable_file_reference.h" |
| 28 #include "storage/browser/fileapi/external_mount_points.h" | 29 #include "storage/browser/fileapi/external_mount_points.h" |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 operation_runner()->Write(url_request_context, url, | 709 operation_runner()->Write(url_request_context, url, |
| 709 helper->scoped_text_blob()->GetBlobDataHandle(), 0, | 710 helper->scoped_text_blob()->GetBlobDataHandle(), 0, |
| 710 base::Bind(&WriteHelper::DidWrite, | 711 base::Bind(&WriteHelper::DidWrite, |
| 711 base::Owned(helper), callback)); | 712 base::Owned(helper), callback)); |
| 712 } | 713 } |
| 713 | 714 |
| 714 void CannedSyncableFileSystem::DoGetUsageAndQuota( | 715 void CannedSyncableFileSystem::DoGetUsageAndQuota( |
| 715 int64* usage, | 716 int64* usage, |
| 716 int64* quota, | 717 int64* quota, |
| 717 const storage::StatusCallback& callback) { | 718 const storage::StatusCallback& callback) { |
| 719 // crbug.com/349708 |
| 720 TRACE_EVENT0("io", "CannedSyncableFileSystem::DoGetUsageAndQuota"); |
| 721 |
| 718 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 722 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 719 EXPECT_TRUE(is_filesystem_opened_); | 723 EXPECT_TRUE(is_filesystem_opened_); |
| 720 DCHECK(quota_manager_.get()); | 724 DCHECK(quota_manager_.get()); |
| 721 quota_manager_->GetUsageAndQuota( | 725 quota_manager_->GetUsageAndQuota( |
| 722 origin_, storage_type(), | 726 origin_, storage_type(), |
| 723 base::Bind(&DidGetUsageAndQuota, callback, usage, quota)); | 727 base::Bind(&DidGetUsageAndQuota, callback, usage, quota)); |
| 724 } | 728 } |
| 725 | 729 |
| 726 void CannedSyncableFileSystem::DidOpenFileSystem( | 730 void CannedSyncableFileSystem::DidOpenFileSystem( |
| 727 base::SingleThreadTaskRunner* original_task_runner, | 731 base::SingleThreadTaskRunner* original_task_runner, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 755 sync_status_ = status; | 759 sync_status_ = status; |
| 756 quit_closure.Run(); | 760 quit_closure.Run(); |
| 757 } | 761 } |
| 758 | 762 |
| 759 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 763 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
| 760 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 764 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 761 backend()->sync_context()->sync_status()->AddObserver(this); | 765 backend()->sync_context()->sync_status()->AddObserver(this); |
| 762 } | 766 } |
| 763 | 767 |
| 764 } // namespace sync_file_system | 768 } // namespace sync_file_system |
| OLD | NEW |