| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "chrome/browser/chromeos/drive/file_system_interface.h" | |
| 14 #include "chrome/browser/chromeos/drive/job_list.h" | 13 #include "chrome/browser/chromeos/drive/job_list.h" |
| 15 #include "chrome/browser/chromeos/drive/job_queue.h" | 14 #include "chrome/browser/chromeos/drive/job_queue.h" |
| 16 #include "chrome/browser/drive/drive_service_interface.h" | 15 #include "chrome/browser/drive/drive_service_interface.h" |
| 17 #include "chrome/browser/drive/drive_uploader.h" | 16 #include "chrome/browser/drive/drive_uploader.h" |
| 18 #include "net/base/network_change_notifier.h" | 17 #include "net/base/network_change_notifier.h" |
| 19 | 18 |
| 20 class PrefService; | 19 class PrefService; |
| 21 | 20 |
| 22 namespace base { | 21 namespace base { |
| 23 class SeqencedTaskRunner; | 22 class SeqencedTaskRunner; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace drive { | 25 namespace drive { |
| 27 | 26 |
| 28 class EventLogger; | 27 class EventLogger; |
| 29 | 28 |
| 29 // Priority of a job. Higher values are lower priority. |
| 30 enum ContextType { |
| 31 USER_INITIATED, |
| 32 BACKGROUND, |
| 33 // Indicates the number of values of this enum. |
| 34 NUM_CONTEXT_TYPES, |
| 35 }; |
| 36 |
| 37 struct ClientContext { |
| 38 explicit ClientContext(ContextType in_type) : type(in_type) {} |
| 39 ContextType type; |
| 40 }; |
| 41 |
| 30 // The JobScheduler is responsible for queuing and scheduling drive jobs. | 42 // The JobScheduler is responsible for queuing and scheduling drive jobs. |
| 31 // Because jobs are executed concurrently by priority and retried for network | 43 // Because jobs are executed concurrently by priority and retried for network |
| 32 // failures, there is no guarantee of orderings. | 44 // failures, there is no guarantee of orderings. |
| 33 // | 45 // |
| 34 // Jobs are grouped into two priority levels: | 46 // Jobs are grouped into two priority levels: |
| 35 // - USER_INITIATED jobs are those occur as a result of direct user actions. | 47 // - USER_INITIATED jobs are those occur as a result of direct user actions. |
| 36 // - BACKGROUND jobs runs in response to state changes, server actions, etc. | 48 // - BACKGROUND jobs runs in response to state changes, server actions, etc. |
| 37 // USER_INITIATED jobs must be handled immediately, thus have higher priority. | 49 // USER_INITIATED jobs must be handled immediately, thus have higher priority. |
| 38 // BACKGROUND jobs run only after all USER_INITIATED jobs have run. | 50 // BACKGROUND jobs run only after all USER_INITIATED jobs have run. |
| 39 // | 51 // |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 403 |
| 392 // Note: This should remain the last member so it'll be destroyed and | 404 // Note: This should remain the last member so it'll be destroyed and |
| 393 // invalidate its weak pointers before any other members are destroyed. | 405 // invalidate its weak pointers before any other members are destroyed. |
| 394 base::WeakPtrFactory<JobScheduler> weak_ptr_factory_; | 406 base::WeakPtrFactory<JobScheduler> weak_ptr_factory_; |
| 395 DISALLOW_COPY_AND_ASSIGN(JobScheduler); | 407 DISALLOW_COPY_AND_ASSIGN(JobScheduler); |
| 396 }; | 408 }; |
| 397 | 409 |
| 398 } // namespace drive | 410 } // namespace drive |
| 399 | 411 |
| 400 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ | 412 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_ |
| OLD | NEW |