| 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 WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public: | 31 public: |
| 32 explicit FileSystemOperationContext(FileSystemContext* context); | 32 explicit FileSystemOperationContext(FileSystemContext* context); |
| 33 | 33 |
| 34 // Specifies |task_runner| which the operation is performed on. | 34 // Specifies |task_runner| which the operation is performed on. |
| 35 FileSystemOperationContext(FileSystemContext* context, | 35 FileSystemOperationContext(FileSystemContext* context, |
| 36 base::SequencedTaskRunner* task_runner); | 36 base::SequencedTaskRunner* task_runner); |
| 37 | 37 |
| 38 virtual ~FileSystemOperationContext(); | 38 virtual ~FileSystemOperationContext(); |
| 39 | 39 |
| 40 FileSystemContext* file_system_context() const { | 40 FileSystemContext* file_system_context() const { |
| 41 return file_system_context_; | 41 return file_system_context_.get(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Updates the current remaining quota. | 44 // Updates the current remaining quota. |
| 45 // This can be called to update the remaining quota during the operation. | 45 // This can be called to update the remaining quota during the operation. |
| 46 void set_allowed_bytes_growth(const int64& allowed_bytes_growth) { | 46 void set_allowed_bytes_growth(const int64& allowed_bytes_growth) { |
| 47 allowed_bytes_growth_ = allowed_bytes_growth; | 47 allowed_bytes_growth_ = allowed_bytes_growth; |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Returns the current remaining quota. | 50 // Returns the current remaining quota. |
| 51 int64 allowed_bytes_growth() const { return allowed_bytes_growth_; } | 51 int64 allowed_bytes_growth() const { return allowed_bytes_growth_; } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 template <typename T> class ValueAdapter | 93 template <typename T> class ValueAdapter |
| 94 : public base::SupportsUserData::Data { | 94 : public base::SupportsUserData::Data { |
| 95 public: | 95 public: |
| 96 ValueAdapter(const T& value) : value_(value) {} | 96 ValueAdapter(const T& value) : value_(value) {} |
| 97 const T& value() const { return value_; } | 97 const T& value() const { return value_; } |
| 98 private: | 98 private: |
| 99 T value_; | 99 T value_; |
| 100 DISALLOW_COPY_AND_ASSIGN(ValueAdapter); | 100 DISALLOW_COPY_AND_ASSIGN(ValueAdapter); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 FileSystemContext* file_system_context_; | 103 scoped_refptr<FileSystemContext> file_system_context_; |
| 104 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 104 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 105 | 105 |
| 106 // The current remaining quota, used by ObfuscatedFileUtil. | 106 // The current remaining quota, used by ObfuscatedFileUtil. |
| 107 int64 allowed_bytes_growth_; | 107 int64 allowed_bytes_growth_; |
| 108 | 108 |
| 109 // The current quota limit type, used by ObfuscatedFileUtil. | 109 // The current quota limit type, used by ObfuscatedFileUtil. |
| 110 quota::QuotaLimitType quota_limit_type_; | 110 quota::QuotaLimitType quota_limit_type_; |
| 111 | 111 |
| 112 // Observers attached to this context. | 112 // Observers attached to this context. |
| 113 ChangeObserverList change_observers_; | 113 ChangeObserverList change_observers_; |
| 114 UpdateObserverList update_observers_; | 114 UpdateObserverList update_observers_; |
| 115 | 115 |
| 116 // Root path for the operation, used by LocalFileUtil. | 116 // Root path for the operation, used by LocalFileUtil. |
| 117 base::FilePath root_path_; | 117 base::FilePath root_path_; |
| 118 | 118 |
| 119 // Used to check its setters are not called on arbitrary thread. | 119 // Used to check its setters are not called on arbitrary thread. |
| 120 base::ThreadChecker setter_thread_checker_; | 120 base::ThreadChecker setter_thread_checker_; |
| 121 | 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationContext); | 122 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationContext); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 } // namespace fileapi | 125 } // namespace fileapi |
| 126 | 126 |
| 127 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ | 127 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ |
| OLD | NEW |