| Index: webkit/fileapi/file_system_operation_context.h
|
| diff --git a/webkit/fileapi/file_system_operation_context.h b/webkit/fileapi/file_system_operation_context.h
|
| index 2cd2c6b960ae792d84ab3f999591f5410c768d5e..ebe22abfc5782d273908898e9b394f3a49c79e32 100644
|
| --- a/webkit/fileapi/file_system_operation_context.h
|
| +++ b/webkit/fileapi/file_system_operation_context.h
|
| @@ -5,7 +5,7 @@
|
| #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
|
| #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
|
|
|
| -#include "webkit/fileapi/media/mtp_device_file_system_config.h"
|
| +#include "base/supports_user_data.h"
|
| #include "webkit/fileapi/task_runner_bound_observer_list.h"
|
| #include "webkit/storage/webkit_storage_export.h"
|
|
|
| @@ -16,7 +16,6 @@ class SequencedTaskRunner;
|
| namespace fileapi {
|
|
|
| class FileSystemContext;
|
| -class MediaPathFilter;
|
|
|
| // A context class which is carried around by FileSystemOperation and
|
| // its delegated tasks. It is valid to reuse one context instance across
|
| @@ -24,10 +23,16 @@ class MediaPathFilter;
|
| // the same context (e.g. use the same task runner, share the quota etc).
|
| // Note that the remaining quota bytes (allowed_bytes_growth) may be
|
| // updated during the execution of write operations.
|
| -class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOperationContext {
|
| +class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOperationContext
|
| + : public base::SupportsUserData {
|
| public:
|
| explicit FileSystemOperationContext(FileSystemContext* context);
|
| - ~FileSystemOperationContext();
|
| +
|
| + // Specifies |task_runner| which the operation is performed on.
|
| + FileSystemOperationContext(FileSystemContext* context,
|
| + base::SequencedTaskRunner* task_runner);
|
| +
|
| + virtual ~FileSystemOperationContext();
|
|
|
| FileSystemContext* file_system_context() const {
|
| return file_system_context_;
|
| @@ -41,26 +46,37 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOperationContext {
|
| // Returns the current remaining quota.
|
| int64 allowed_bytes_growth() const { return allowed_bytes_growth_; }
|
|
|
| -#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
|
| - // Reads |mtp_device_delegate_url_| on |task_runner_|.
|
| - const std::string& mtp_device_delegate_url() const {
|
| - return mtp_device_delegate_url_;
|
| - }
|
| -#endif
|
| -
|
| // Returns TaskRunner which the operation is performed on.
|
| base::SequencedTaskRunner* task_runner() const {
|
| return task_runner_.get();
|
| }
|
|
|
| - MediaPathFilter* media_path_filter() { return media_path_filter_; }
|
| ChangeObserverList* change_observers() { return &change_observers_; }
|
| AccessObserverList* access_observers() { return &access_observers_; }
|
| UpdateObserverList* update_observers() { return &update_observers_; }
|
|
|
| + // Gets and sets value-type (or not-owned) variable as UserData.
|
| + template <typename T> T GetUserValue(const char* key) const {
|
| + ValueAdapter<T>* v = static_cast<ValueAdapter<T>*>(GetUserData(key));
|
| + return v ? v->value() : T();
|
| + }
|
| + template <typename T> void SetUserValue(const char* key, const T& value) {
|
| + SetUserData(key, new ValueAdapter<T>(value));
|
| + }
|
| +
|
| private:
|
| - // Only MountPointProviders can access these setters.
|
| - friend class CrosMountPointProvider;
|
| + // An adapter for setting a value-type (or not owned) data as UserData.
|
| + template <typename T> class ValueAdapter
|
| + : public base::SupportsUserData::Data {
|
| + public:
|
| + ValueAdapter(const T& value) : value_(value) {}
|
| + const T& value() const { return value_; }
|
| + private:
|
| + T value_;
|
| + DISALLOW_COPY_AND_ASSIGN(ValueAdapter);
|
| + };
|
| +
|
| + // Only regular (and test) MountPointProviders can access following setters.
|
| friend class IsolatedMountPointProvider;
|
| friend class SandboxMountPointProvider;
|
| friend class TestMountPointProvider;
|
| @@ -72,13 +88,6 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOperationContext {
|
| friend class LocalFileSystemTestOriginHelper;
|
| friend class ObfuscatedFileUtilTest;
|
|
|
| - // Overrides TaskRunner which the operation is performed on.
|
| - // file_system_context_->task_runners()->file_task_runner() is used otherwise.
|
| - void set_task_runner(base::SequencedTaskRunner* task_runner);
|
| -
|
| - void set_media_path_filter(MediaPathFilter* media_path_filter) {
|
| - media_path_filter_ = media_path_filter;
|
| - }
|
| void set_change_observers(const ChangeObserverList& list) {
|
| change_observers_ = list;
|
| }
|
| @@ -88,29 +97,16 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOperationContext {
|
| void set_update_observers(const UpdateObserverList& list) {
|
| update_observers_ = list;
|
| }
|
| -#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
|
| - // Initializes |mtp_device_delegate_url_| on the IO thread.
|
| - void set_mtp_device_delegate_url(const std::string& delegate_url) {
|
| - mtp_device_delegate_url_ = delegate_url;
|
| - }
|
| -#endif
|
|
|
| FileSystemContext* file_system_context_;
|
| scoped_refptr<base::SequencedTaskRunner> task_runner_;
|
|
|
| int64 allowed_bytes_growth_;
|
| - MediaPathFilter* media_path_filter_;
|
|
|
| AccessObserverList access_observers_;
|
| ChangeObserverList change_observers_;
|
| UpdateObserverList update_observers_;
|
|
|
| -#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
|
| - // URL for the media transfer protocol (MTP) device delegate.
|
| - // Initialized on IO thread and used on |task_runner_|.
|
| - std::string mtp_device_delegate_url_;
|
| -#endif
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(FileSystemOperationContext);
|
| };
|
|
|
|
|