OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> |
| 6 |
5 #include <deque> | 7 #include <deque> |
6 #include <string> | 8 #include <string> |
7 | 9 |
8 #include "base/basictypes.h" | |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
14 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
15 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
16 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" | 18 #include "chrome/browser/sync_file_system/drive_backend/sync_task.h" |
17 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" | 19 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
18 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" | 20 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" |
19 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" | 21 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" |
20 #include "storage/common/fileapi/file_system_util.h" | 22 #include "storage/common/fileapi/file_system_util.h" |
(...skipping 29 matching lines...) Expand all Loading... |
50 SyncStatusCode* status_out, | 52 SyncStatusCode* status_out, |
51 SyncStatusCode status) { | 53 SyncStatusCode status) { |
52 ++(*counter); | 54 ++(*counter); |
53 *status_out = status; | 55 *status_out = status; |
54 } | 56 } |
55 | 57 |
56 class TaskManagerClient | 58 class TaskManagerClient |
57 : public SyncTaskManager::Client, | 59 : public SyncTaskManager::Client, |
58 public base::SupportsWeakPtr<TaskManagerClient> { | 60 public base::SupportsWeakPtr<TaskManagerClient> { |
59 public: | 61 public: |
60 explicit TaskManagerClient(int64 maximum_background_task) | 62 explicit TaskManagerClient(int64_t maximum_background_task) |
61 : maybe_schedule_next_task_count_(0), | 63 : maybe_schedule_next_task_count_(0), |
62 task_scheduled_count_(0), | 64 task_scheduled_count_(0), |
63 idle_task_scheduled_count_(0), | 65 idle_task_scheduled_count_(0), |
64 last_operation_status_(SYNC_STATUS_OK) { | 66 last_operation_status_(SYNC_STATUS_OK) { |
65 task_manager_.reset(new SyncTaskManager( | 67 task_manager_.reset(new SyncTaskManager( |
66 AsWeakPtr(), maximum_background_task, | 68 AsWeakPtr(), maximum_background_task, |
67 base::ThreadTaskRunnerHandle::Get(), | 69 base::ThreadTaskRunnerHandle::Get(), |
68 nullptr /* worker_pool */)); | 70 nullptr /* worker_pool */)); |
69 task_manager_->Initialize(SYNC_STATUS_OK); | 71 task_manager_->Initialize(SYNC_STATUS_OK); |
70 base::MessageLoop::current()->RunUntilIdle(); | 72 base::MessageLoop::current()->RunUntilIdle(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 bool* task_started_; | 164 bool* task_started_; |
163 bool* task_completed_; | 165 bool* task_completed_; |
164 base::WeakPtrFactory<MultihopSyncTask> weak_ptr_factory_; | 166 base::WeakPtrFactory<MultihopSyncTask> weak_ptr_factory_; |
165 | 167 |
166 DISALLOW_COPY_AND_ASSIGN(MultihopSyncTask); | 168 DISALLOW_COPY_AND_ASSIGN(MultihopSyncTask); |
167 }; | 169 }; |
168 | 170 |
169 class BackgroundTask : public SyncTask { | 171 class BackgroundTask : public SyncTask { |
170 public: | 172 public: |
171 struct Stats { | 173 struct Stats { |
172 int64 running_background_task; | 174 int64_t running_background_task; |
173 int64 finished_task; | 175 int64_t finished_task; |
174 int64 max_parallel_task; | 176 int64_t max_parallel_task; |
175 | 177 |
176 Stats() | 178 Stats() |
177 : running_background_task(0), | 179 : running_background_task(0), |
178 finished_task(0), | 180 finished_task(0), |
179 max_parallel_task(0) {} | 181 max_parallel_task(0) {} |
180 }; | 182 }; |
181 | 183 |
182 BackgroundTask(const std::string& app_id, | 184 BackgroundTask(const std::string& app_id, |
183 const base::FilePath& path, | 185 const base::FilePath& path, |
184 Stats* stats) | 186 Stats* stats) |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 672 |
671 EXPECT_EQ("task1: finished", log[i++]); | 673 EXPECT_EQ("task1: finished", log[i++]); |
672 | 674 |
673 EXPECT_EQ("task2: updating to /hoge/fuga/piyo", log[i++]); | 675 EXPECT_EQ("task2: updating to /hoge/fuga/piyo", log[i++]); |
674 EXPECT_EQ("task2: updated to /hoge/fuga/piyo", log[i++]); | 676 EXPECT_EQ("task2: updated to /hoge/fuga/piyo", log[i++]); |
675 EXPECT_EQ("task2: finished", log[i++]); | 677 EXPECT_EQ("task2: finished", log[i++]); |
676 } | 678 } |
677 | 679 |
678 } // namespace drive_backend | 680 } // namespace drive_backend |
679 } // namespace sync_file_system | 681 } // namespace sync_file_system |
OLD | NEW |