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

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: '' Created 8 years, 1 month 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 13 matching lines...) Expand all
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 void set_mtp_device_delegate(MTPDeviceDelegate* delegate) {
42 mtp_device_delegate_ = delegate; 43 mtp_device_delegate_ = delegate->GetAsWeakPtrOnIOThread();
43 } 44 }
44 45
45 MTPDeviceDelegate* mtp_device_delegate() const { 46 base::WeakPtr<MTPDeviceDelegate> mtp_device_delegate() const {
kinuko 2012/11/15 10:23:39 I'm afraid this weakptr is created on IO thread bu
kmadhusu 2012/11/15 17:52:24 Can you please provide more details on how this ca
46 return mtp_device_delegate_.get(); 47 return mtp_device_delegate_;
47 } 48 }
48 #endif 49 #endif
49 50
50 // Returns TaskRunner which the operation is performed on. 51 // Returns TaskRunner which the operation is performed on.
51 base::SequencedTaskRunner* task_runner() const { 52 base::SequencedTaskRunner* task_runner() const {
52 return task_runner_.get(); 53 return task_runner_.get();
53 } 54 }
54 55
55 // Overrides TaskRunner which the operation is performed on. 56 // Overrides TaskRunner which the operation is performed on.
56 // file_system_context_->task_runners()->file_task_runner() is used otherwise. 57 // file_system_context_->task_runners()->file_task_runner() is used otherwise.
(...skipping 28 matching lines...) Expand all
85 86
86 int64 allowed_bytes_growth_; 87 int64 allowed_bytes_growth_;
87 MediaPathFilter* media_path_filter_; 88 MediaPathFilter* media_path_filter_;
88 89
89 AccessObserverList access_observers_; 90 AccessObserverList access_observers_;
90 ChangeObserverList change_observers_; 91 ChangeObserverList change_observers_;
91 UpdateObserverList update_observers_; 92 UpdateObserverList update_observers_;
92 93
93 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM) 94 #if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
94 // Store the current mtp device delegate. 95 // Store the current mtp device delegate.
95 scoped_refptr<MTPDeviceDelegate> mtp_device_delegate_; 96 base::WeakPtr<MTPDeviceDelegate> mtp_device_delegate_;
96 #endif 97 #endif
97 }; 98 };
98 99
99 } // namespace fileapi 100 } // namespace fileapi
100 101
101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_ 102 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698