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

Side by Side Diff: chrome/browser/chromeos/drive/job_scheduler.h

Issue 14493009: drive: Rename DriveScheduler to JobScheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indent Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
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_JOB_SCHEDULER_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" 14 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
15 #include "chrome/browser/chromeos/drive/job_list.h" 15 #include "chrome/browser/chromeos/drive/job_list.h"
16 #include "chrome/browser/google_apis/drive_service_interface.h" 16 #include "chrome/browser/google_apis/drive_service_interface.h"
17 #include "chrome/browser/google_apis/drive_uploader.h" 17 #include "chrome/browser/google_apis/drive_uploader.h"
18 #include "net/base/network_change_notifier.h" 18 #include "net/base/network_change_notifier.h"
19 19
20 class Profile; 20 class Profile;
21 21
22 namespace drive { 22 namespace drive {
23 23
24 // The DriveScheduler is responsible for queuing and scheduling drive 24 // The JobScheduler is responsible for queuing and scheduling drive
25 // operations. It is responsible for handling retry logic, rate limiting, as 25 // operations. It is responsible for handling retry logic, rate limiting, as
26 // concurrency as appropriate. 26 // concurrency as appropriate.
27 class DriveScheduler 27 class JobScheduler
28 : public net::NetworkChangeNotifier::ConnectionTypeObserver, 28 : public net::NetworkChangeNotifier::ConnectionTypeObserver,
29 public JobListInterface { 29 public JobListInterface {
30 public: 30 public:
31 DriveScheduler(Profile* profile, 31 JobScheduler(Profile* profile,
32 google_apis::DriveServiceInterface* drive_service); 32 google_apis::DriveServiceInterface* drive_service);
33 virtual ~DriveScheduler(); 33 virtual ~JobScheduler();
34 34
35 // JobListInterface overrides. 35 // JobListInterface overrides.
36 virtual std::vector<JobInfo> GetJobInfoList() OVERRIDE; 36 virtual std::vector<JobInfo> GetJobInfoList() OVERRIDE;
37 virtual void AddObserver(JobListObserver* observer) OVERRIDE; 37 virtual void AddObserver(JobListObserver* observer) OVERRIDE;
38 virtual void RemoveObserver(JobListObserver* observer) OVERRIDE; 38 virtual void RemoveObserver(JobListObserver* observer) OVERRIDE;
39 virtual void CancelJob(JobID job_id) OVERRIDE; 39 virtual void CancelJob(JobID job_id) OVERRIDE;
40 virtual void CancelAllJobs() OVERRIDE; 40 virtual void CancelAllJobs() OVERRIDE;
41 41
42 // Adds a GetAccountMetadata operation to the queue. 42 // Adds a GetAccountMetadata operation to the queue.
43 // |callback| must not be null. 43 // |callback| must not be null.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 void UploadExistingFile( 138 void UploadExistingFile(
139 const std::string& resource_id, 139 const std::string& resource_id,
140 const base::FilePath& drive_file_path, 140 const base::FilePath& drive_file_path,
141 const base::FilePath& local_file_path, 141 const base::FilePath& local_file_path,
142 const std::string& content_type, 142 const std::string& content_type,
143 const std::string& etag, 143 const std::string& etag,
144 const DriveClientContext& context, 144 const DriveClientContext& context,
145 const google_apis::UploadCompletionCallback& upload_completion_callback); 145 const google_apis::UploadCompletionCallback& upload_completion_callback);
146 146
147 private: 147 private:
148 friend class DriveSchedulerTest; 148 friend class JobSchedulerTest;
149 149
150 enum QueueType { 150 enum QueueType {
151 METADATA_QUEUE, 151 METADATA_QUEUE,
152 FILE_QUEUE, 152 FILE_QUEUE,
153 NUM_QUEUES 153 NUM_QUEUES
154 }; 154 };
155 155
156 static const int kMaxJobCount[NUM_QUEUES]; 156 static const int kMaxJobCount[NUM_QUEUES];
157 157
158 // Represents a single entry in the job queue. 158 // Represents a single entry in the job queue.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // The list of observers for the scheduler. 401 // The list of observers for the scheduler.
402 ObserverList<JobListObserver> observer_list_; 402 ObserverList<JobListObserver> observer_list_;
403 403
404 google_apis::DriveServiceInterface* drive_service_; 404 google_apis::DriveServiceInterface* drive_service_;
405 scoped_ptr<google_apis::DriveUploaderInterface> uploader_; 405 scoped_ptr<google_apis::DriveUploaderInterface> uploader_;
406 406
407 Profile* profile_; 407 Profile* profile_;
408 408
409 // 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
410 // invalidate its weak pointers before any other members are destroyed. 410 // invalidate its weak pointers before any other members are destroyed.
411 base::WeakPtrFactory<DriveScheduler> weak_ptr_factory_; 411 base::WeakPtrFactory<JobScheduler> weak_ptr_factory_;
412 DISALLOW_COPY_AND_ASSIGN(DriveScheduler); 412 DISALLOW_COPY_AND_ASSIGN(JobScheduler);
413 }; 413 };
414 414
415 } // namespace drive 415 } // namespace drive
416 416
417 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ 417 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_JOB_SCHEDULER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system/update_operation.cc ('k') | chrome/browser/chromeos/drive/job_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698