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_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/sequenced_task_runner.h" |
10 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
11 #include "webkit/fileapi/fileapi_export.h" | 12 #include "webkit/fileapi/fileapi_export.h" |
12 #include "webkit/fileapi/file_system_context.h" | 13 #include "webkit/fileapi/file_system_context.h" |
13 #include "webkit/fileapi/file_system_file_util.h" | 14 #include "webkit/fileapi/file_system_file_util.h" |
14 #include "webkit/fileapi/file_system_types.h" | 15 #include "webkit/fileapi/file_system_types.h" |
15 #include "webkit/fileapi/media/media_file_system_config.h" | 16 #include "webkit/fileapi/media/media_file_system_config.h" |
16 | 17 |
17 #if defined(SUPPORT_MEDIA_FILESYSTEM) | 18 #if defined(SUPPORT_MEDIA_FILESYSTEM) |
18 #include "webkit/fileapi/media/media_device_interface_impl.h" | 19 #include "webkit/fileapi/media/media_device_interface_impl.h" |
19 #endif | 20 #endif |
20 | 21 |
21 namespace base { | |
22 class SequencedTaskRunner; | |
23 } | |
24 | |
25 namespace fileapi { | 22 namespace fileapi { |
26 | 23 |
27 class MediaPathFilter; | 24 class MediaPathFilter; |
28 | 25 |
29 class FILEAPI_EXPORT_PRIVATE FileSystemOperationContext { | 26 class FILEAPI_EXPORT_PRIVATE FileSystemOperationContext { |
30 public: | 27 public: |
31 explicit FileSystemOperationContext(FileSystemContext* context); | 28 explicit FileSystemOperationContext(FileSystemContext* context); |
32 ~FileSystemOperationContext(); | 29 ~FileSystemOperationContext(); |
33 | 30 |
34 FileSystemContext* file_system_context() const { | 31 FileSystemContext* file_system_context() const { |
35 return file_system_context_.get(); | 32 return file_system_context_.get(); |
36 } | 33 } |
37 | 34 |
38 void set_allowed_bytes_growth(const int64& allowed_bytes_growth) { | 35 void set_allowed_bytes_growth(const int64& allowed_bytes_growth) { |
39 allowed_bytes_growth_ = allowed_bytes_growth; | 36 allowed_bytes_growth_ = allowed_bytes_growth; |
40 } | 37 } |
41 int64 allowed_bytes_growth() const { return allowed_bytes_growth_; } | 38 int64 allowed_bytes_growth() const { return allowed_bytes_growth_; } |
42 | 39 |
43 #if defined(SUPPORT_MEDIA_FILESYSTEM) | 40 #if defined(SUPPORT_MEDIA_FILESYSTEM) |
44 void set_media_device(MediaDeviceInterfaceImpl* media_device) { | 41 void set_media_device(MediaDeviceInterfaceImpl* media_device) { |
45 media_device_ = media_device; | 42 media_device_ = media_device; |
46 } | 43 } |
47 | 44 |
48 MediaDeviceInterfaceImpl* media_device() const { | 45 MediaDeviceInterfaceImpl* media_device() const { |
49 return media_device_.get(); | 46 return media_device_.get(); |
50 } | 47 } |
51 #endif | 48 #endif |
52 | 49 |
53 base::SequencedTaskRunner* file_task_runner() const; | 50 // Returns TaskRunner which the operation is performed on. |
| 51 base::SequencedTaskRunner* task_runner() const { |
| 52 return task_runner_.get(); |
| 53 } |
| 54 |
| 55 // Overrides TaskRunner which the operation is performed on. |
| 56 // file_system_context_->task_runners()->file_task_runner() is used otherwise. |
| 57 void set_task_runner(base::SequencedTaskRunner* task_runner); |
54 | 58 |
55 void set_media_path_filter(MediaPathFilter* media_path_filter) { | 59 void set_media_path_filter(MediaPathFilter* media_path_filter) { |
56 media_path_filter_ = media_path_filter; | 60 media_path_filter_ = media_path_filter; |
57 } | 61 } |
58 | 62 |
59 MediaPathFilter* media_path_filter() { | 63 MediaPathFilter* media_path_filter() { |
60 return media_path_filter_; | 64 return media_path_filter_; |
61 } | 65 } |
62 | 66 |
63 private: | 67 private: |
64 scoped_refptr<FileSystemContext> file_system_context_; | 68 scoped_refptr<FileSystemContext> file_system_context_; |
| 69 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
65 | 70 |
66 int64 allowed_bytes_growth_; | 71 int64 allowed_bytes_growth_; |
67 MediaPathFilter* media_path_filter_; | 72 MediaPathFilter* media_path_filter_; |
68 | 73 |
69 #if defined(SUPPORT_MEDIA_FILESYSTEM) | 74 #if defined(SUPPORT_MEDIA_FILESYSTEM) |
70 // Store the current media device. | 75 // Store the current media device. |
71 scoped_refptr<MediaDeviceInterfaceImpl> media_device_; | 76 scoped_refptr<MediaDeviceInterfaceImpl> media_device_; |
72 #endif | 77 #endif |
73 }; | 78 }; |
74 | 79 |
75 } // namespace fileapi | 80 } // namespace fileapi |
76 | 81 |
77 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ | 82 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ |
OLD | NEW |