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_DRIVE_SCHEDULER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 int total_bytes; | 73 int total_bytes; |
74 | 74 |
75 // Drive path of the file that this job acts on. | 75 // Drive path of the file that this job acts on. |
76 base::FilePath file_path; | 76 base::FilePath file_path; |
77 | 77 |
78 // Current state of the operation. | 78 // Current state of the operation. |
79 JobState state; | 79 JobState state; |
80 }; | 80 }; |
81 | 81 |
82 DriveScheduler(Profile* profile, | 82 DriveScheduler(Profile* profile, |
83 google_apis::DriveServiceInterface* drive_service, | 83 google_apis::DriveServiceInterface* drive_service); |
84 google_apis::DriveUploaderInterface* uploader); | |
85 virtual ~DriveScheduler(); | 84 virtual ~DriveScheduler(); |
86 | 85 |
87 // Initializes the object. This function should be called before any | 86 // Initializes the object. This function should be called before any |
88 // other functions. | 87 // other functions. |
89 void Initialize(); | 88 void Initialize(); |
90 | 89 |
91 // Adds a GetAccountMetadata operation to the queue. | 90 // Adds a GetAccountMetadata operation to the queue. |
92 // |callback| must not be null. | 91 // |callback| must not be null. |
93 void GetAccountMetadata( | 92 void GetAccountMetadata( |
94 const google_apis::GetAccountMetadataCallback& callback); | 93 const google_apis::GetAccountMetadataCallback& callback); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // next task. | 392 // next task. |
394 int throttle_count_; | 393 int throttle_count_; |
395 | 394 |
396 // Disables throttling for testing. | 395 // Disables throttling for testing. |
397 bool disable_throttling_; | 396 bool disable_throttling_; |
398 | 397 |
399 // The queues of jobs. | 398 // The queues of jobs. |
400 std::list<QueueEntry*> queue_[NUM_QUEUES]; | 399 std::list<QueueEntry*> queue_[NUM_QUEUES]; |
401 | 400 |
402 google_apis::DriveServiceInterface* drive_service_; | 401 google_apis::DriveServiceInterface* drive_service_; |
403 google_apis::DriveUploaderInterface* uploader_; | 402 scoped_ptr<google_apis::DriveUploaderInterface> uploader_; |
404 | 403 |
405 Profile* profile_; | 404 Profile* profile_; |
406 | 405 |
407 // Whether this instance is initialized or not. | 406 // Whether this instance is initialized or not. |
408 bool initialized_; | 407 bool initialized_; |
409 | 408 |
410 // Note: This should remain the last member so it'll be destroyed and | 409 // Note: This should remain the last member so it'll be destroyed and |
411 // invalidate its weak pointers before any other members are destroyed. | 410 // invalidate its weak pointers before any other members are destroyed. |
412 base::WeakPtrFactory<DriveScheduler> weak_ptr_factory_; | 411 base::WeakPtrFactory<DriveScheduler> weak_ptr_factory_; |
413 DISALLOW_COPY_AND_ASSIGN(DriveScheduler); | 412 DISALLOW_COPY_AND_ASSIGN(DriveScheduler); |
414 }; | 413 }; |
415 | 414 |
416 } // namespace drive | 415 } // namespace drive |
417 | 416 |
418 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ | 417 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ |
OLD | NEW |