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

Side by Side Diff: chrome/browser/sync_file_system/local/syncable_file_operation_runner.h

Issue 1545223002: Switch to standard integer types in chrome/browser/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 11 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
OLDNEW
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 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_
7 7
8 #include <stdint.h>
9
8 #include <list> 10 #include <list>
9 #include <vector> 11 #include <vector>
10 12
11 #include "base/basictypes.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
15 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
16 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" 18 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h"
17 #include "storage/browser/fileapi/file_system_url.h" 19 #include "storage/browser/fileapi/file_system_url.h"
18 20
19 namespace storage { 21 namespace storage {
20 class FileSystemURL; 22 class FileSystemURL;
21 } 23 }
22 24
(...skipping 22 matching lines...) Expand all
45 47
46 private: 48 private:
47 friend class SyncableFileOperationRunner; 49 friend class SyncableFileOperationRunner;
48 bool IsRunnable(LocalFileSyncStatus* status) const; 50 bool IsRunnable(LocalFileSyncStatus* status) const;
49 void Start(LocalFileSyncStatus* status); 51 void Start(LocalFileSyncStatus* status);
50 static void CancelAndDelete(Task* task); 52 static void CancelAndDelete(Task* task);
51 53
52 DISALLOW_COPY_AND_ASSIGN(Task); 54 DISALLOW_COPY_AND_ASSIGN(Task);
53 }; 55 };
54 56
55 SyncableFileOperationRunner(int64 max_inflight_tasks, 57 SyncableFileOperationRunner(int64_t max_inflight_tasks,
56 LocalFileSyncStatus* sync_status); 58 LocalFileSyncStatus* sync_status);
57 ~SyncableFileOperationRunner() override; 59 ~SyncableFileOperationRunner() override;
58 60
59 // LocalFileSyncStatus::Observer overrides. 61 // LocalFileSyncStatus::Observer overrides.
60 void OnSyncEnabled(const storage::FileSystemURL& url) override; 62 void OnSyncEnabled(const storage::FileSystemURL& url) override;
61 void OnWriteEnabled(const storage::FileSystemURL& url) override; 63 void OnWriteEnabled(const storage::FileSystemURL& url) override;
62 64
63 // Runs the given |task| if no sync operation is running on any of 65 // Runs the given |task| if no sync operation is running on any of
64 // its target_paths(). This also runs pending tasks that have become 66 // its target_paths(). This also runs pending tasks that have become
65 // runnable (before running the given operation). 67 // runnable (before running the given operation).
66 // If there're ongoing sync tasks on the target_paths this method 68 // If there're ongoing sync tasks on the target_paths this method
67 // just queues up the |task|. 69 // just queues up the |task|.
68 // Pending tasks are cancelled when this class is destructed. 70 // Pending tasks are cancelled when this class is destructed.
69 void PostOperationTask(scoped_ptr<Task> task); 71 void PostOperationTask(scoped_ptr<Task> task);
70 72
71 // Runs a next runnable task (if there's any). 73 // Runs a next runnable task (if there's any).
72 void RunNextRunnableTask(); 74 void RunNextRunnableTask();
73 75
74 // Called when an operation is completed. This will make |target_paths| 76 // Called when an operation is completed. This will make |target_paths|
75 // writable and may start a next runnable task. 77 // writable and may start a next runnable task.
76 void OnOperationCompleted( 78 void OnOperationCompleted(
77 const std::vector<storage::FileSystemURL>& target_paths); 79 const std::vector<storage::FileSystemURL>& target_paths);
78 80
79 LocalFileSyncStatus* sync_status() const { return sync_status_; } 81 LocalFileSyncStatus* sync_status() const { return sync_status_; }
80 82
81 int64 num_pending_tasks() const { 83 int64_t num_pending_tasks() const {
82 return static_cast<int64>(pending_tasks_.size()); 84 return static_cast<int64_t>(pending_tasks_.size());
83 } 85 }
84 86
85 int64 num_inflight_tasks() const { return num_inflight_tasks_; } 87 int64_t num_inflight_tasks() const { return num_inflight_tasks_; }
86 88
87 private: 89 private:
88 // Returns true if we should start more tasks. 90 // Returns true if we should start more tasks.
89 bool ShouldStartMoreTasks() const; 91 bool ShouldStartMoreTasks() const;
90 92
91 // Keeps track of the writing/syncing status. Not owned. 93 // Keeps track of the writing/syncing status. Not owned.
92 LocalFileSyncStatus* sync_status_; 94 LocalFileSyncStatus* sync_status_;
93 95
94 std::list<Task*> pending_tasks_; 96 std::list<Task*> pending_tasks_;
95 97
96 const int64 max_inflight_tasks_; 98 const int64_t max_inflight_tasks_;
97 int64 num_inflight_tasks_; 99 int64_t num_inflight_tasks_;
98 100
99 DISALLOW_COPY_AND_ASSIGN(SyncableFileOperationRunner); 101 DISALLOW_COPY_AND_ASSIGN(SyncableFileOperationRunner);
100 }; 102 };
101 103
102 } // namespace sync_file_system 104 } // namespace sync_file_system
103 105
104 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_ H_ 106 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698