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

Side by Side Diff: webkit/fileapi/file_system_operation_context.h

Issue 11358243: Redesigned and refactored ScopedMTPDeviceMapEntry, MTPDeviceMapService & MTPDeviceDelegate classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comment. Created 8 years 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 | Annotate | Revision Log
OLDNEW
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/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
9 #include "webkit/fileapi/file_system_context.h" 10 #include "webkit/fileapi/file_system_context.h"
10 #include "webkit/fileapi/media/mtp_device_file_system_config.h" 11 #include "webkit/fileapi/media/mtp_device_file_system_config.h"
11 #include "webkit/fileapi/task_runner_bound_observer_list.h" 12 #include "webkit/fileapi/task_runner_bound_observer_list.h"
12 #include "webkit/storage/webkit_storage_export.h" 13 #include "webkit/storage/webkit_storage_export.h"
13 14
14 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 15 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
15 #include "webkit/fileapi/media/mtp_device_delegate.h" 16 #include "webkit/fileapi/media/mtp_device_delegate.h"
16 #endif 17 #endif
17 18
18 namespace base { 19 namespace base {
(...skipping 12 matching lines...) Expand all
31 FileSystemContext* file_system_context() const { 32 FileSystemContext* file_system_context() const {
32 return file_system_context_.get(); 33 return file_system_context_.get();
33 } 34 }
34 35
35 void set_allowed_bytes_growth(const int64& allowed_bytes_growth) { 36 void set_allowed_bytes_growth(const int64& allowed_bytes_growth) {
36 allowed_bytes_growth_ = allowed_bytes_growth; 37 allowed_bytes_growth_ = allowed_bytes_growth;
37 } 38 }
38 int64 allowed_bytes_growth() const { return allowed_bytes_growth_; } 39 int64 allowed_bytes_growth() const { return allowed_bytes_growth_; }
39 40
40 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 41 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
41 void set_mtp_device_delegate(MTPDeviceDelegate* delegate) { 42 // Called on IO thread.
43 void set_mtp_device_delegate(
44 const base::WeakPtr<MTPDeviceDelegate>& delegate) {
42 mtp_device_delegate_ = delegate; 45 mtp_device_delegate_ = delegate;
43 } 46 }
44 47
45 MTPDeviceDelegate* mtp_device_delegate() const { 48 // Caller of this function should dereference the delegate only on media
46 return mtp_device_delegate_.get(); 49 // sequenced task runner thread.
50 base::WeakPtr<MTPDeviceDelegate> mtp_device_delegate() const {
51 return mtp_device_delegate_;
47 } 52 }
48 #endif 53 #endif
49 54
50 // Returns TaskRunner which the operation is performed on. 55 // Returns TaskRunner which the operation is performed on.
51 base::SequencedTaskRunner* task_runner() const { 56 base::SequencedTaskRunner* task_runner() const {
52 return task_runner_.get(); 57 return task_runner_.get();
53 } 58 }
54 59
55 // Overrides TaskRunner which the operation is performed on. 60 // Overrides TaskRunner which the operation is performed on.
56 // file_system_context_->task_runners()->file_task_runner() is used otherwise. 61 // file_system_context_->task_runners()->file_task_runner() is used otherwise.
(...skipping 27 matching lines...) Expand all
84 scoped_refptr<base::SequencedTaskRunner> task_runner_; 89 scoped_refptr<base::SequencedTaskRunner> task_runner_;
85 90
86 int64 allowed_bytes_growth_; 91 int64 allowed_bytes_growth_;
87 MediaPathFilter* media_path_filter_; 92 MediaPathFilter* media_path_filter_;
88 93
89 AccessObserverList access_observers_; 94 AccessObserverList access_observers_;
90 ChangeObserverList change_observers_; 95 ChangeObserverList change_observers_;
91 UpdateObserverList update_observers_; 96 UpdateObserverList update_observers_;
92 97
93 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 98 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
94 // Store the current mtp device delegate. 99 // The media transfer protocol (MTP) device delegate.
95 scoped_refptr<MTPDeviceDelegate> mtp_device_delegate_; 100 // Set on IO thread and dereferenced on media sequenced task runner thread.
101 base::WeakPtr<MTPDeviceDelegate> mtp_device_delegate_;
96 #endif 102 #endif
97 }; 103 };
98 104
99 } // namespace fileapi 105 } // namespace fileapi
100 106
101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ 107 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698