OLD | NEW |
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 COMPONENTS_DRIVE_FILE_SYSTEM_TRUNCATE_OPERATION_H_ | 5 #ifndef COMPONENTS_DRIVE_FILE_SYSTEM_TRUNCATE_OPERATION_H_ |
6 #define COMPONENTS_DRIVE_FILE_SYSTEM_TRUNCATE_OPERATION_H_ | 6 #define COMPONENTS_DRIVE_FILE_SYSTEM_TRUNCATE_OPERATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
13 #include "components/drive/file_errors.h" | 15 #include "components/drive/file_errors.h" |
14 | 16 |
15 namespace base { | 17 namespace base { |
16 class FilePath; | 18 class FilePath; |
17 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
18 } // namespace base | 20 } // namespace base |
(...skipping 24 matching lines...) Expand all Loading... |
43 JobScheduler* scheduler, | 45 JobScheduler* scheduler, |
44 internal::ResourceMetadata* metadata, | 46 internal::ResourceMetadata* metadata, |
45 internal::FileCache* cache, | 47 internal::FileCache* cache, |
46 const base::FilePath& temporary_file_directory); | 48 const base::FilePath& temporary_file_directory); |
47 ~TruncateOperation(); | 49 ~TruncateOperation(); |
48 | 50 |
49 // Performs the truncate operation on the file at drive path |file_path| to | 51 // Performs the truncate operation on the file at drive path |file_path| to |
50 // |length| bytes. Invokes |callback| when finished with the result of the | 52 // |length| bytes. Invokes |callback| when finished with the result of the |
51 // operation. |callback| must not be null. | 53 // operation. |callback| must not be null. |
52 void Truncate(const base::FilePath& file_path, | 54 void Truncate(const base::FilePath& file_path, |
53 int64 length, | 55 int64_t length, |
54 const FileOperationCallback& callback); | 56 const FileOperationCallback& callback); |
| 57 |
55 private: | 58 private: |
56 // Part of Truncate(). Called after EnsureFileDownloadedByPath() is complete. | 59 // Part of Truncate(). Called after EnsureFileDownloadedByPath() is complete. |
57 void TruncateAfterEnsureFileDownloadedByPath( | 60 void TruncateAfterEnsureFileDownloadedByPath( |
58 int64 length, | 61 int64_t length, |
59 const FileOperationCallback& callback, | 62 const FileOperationCallback& callback, |
60 FileError error, | 63 FileError error, |
61 const base::FilePath& local_file_path, | 64 const base::FilePath& local_file_path, |
62 scoped_ptr<ResourceEntry> resource_entry); | 65 scoped_ptr<ResourceEntry> resource_entry); |
63 | 66 |
64 // Part of Truncate(). Called after TruncateOnBlockingPool() is complete. | 67 // Part of Truncate(). Called after TruncateOnBlockingPool() is complete. |
65 void TruncateAfterTruncateOnBlockingPool( | 68 void TruncateAfterTruncateOnBlockingPool( |
66 const std::string& local_id, | 69 const std::string& local_id, |
67 const FileOperationCallback& callback, | 70 const FileOperationCallback& callback, |
68 FileError error); | 71 FileError error); |
(...skipping 10 matching lines...) Expand all Loading... |
79 // Note: This should remain the last member so it'll be destroyed and | 82 // Note: This should remain the last member so it'll be destroyed and |
80 // invalidate the weak pointers before any other members are destroyed. | 83 // invalidate the weak pointers before any other members are destroyed. |
81 base::WeakPtrFactory<TruncateOperation> weak_ptr_factory_; | 84 base::WeakPtrFactory<TruncateOperation> weak_ptr_factory_; |
82 DISALLOW_COPY_AND_ASSIGN(TruncateOperation); | 85 DISALLOW_COPY_AND_ASSIGN(TruncateOperation); |
83 }; | 86 }; |
84 | 87 |
85 } // namespace file_system | 88 } // namespace file_system |
86 } // namespace drive | 89 } // namespace drive |
87 | 90 |
88 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_TRUNCATE_OPERATION_H_ | 91 #endif // COMPONENTS_DRIVE_FILE_SYSTEM_TRUNCATE_OPERATION_H_ |
OLD | NEW |