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

Unified 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 GetFileInfoWorker 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 side-by-side diff with in-line comments
Download patch
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 067e0d8886b81dd64345fd19e3767233c92b8e7e..9c9c59a4e9a244e9d051f7b81b43e19895111c05 100644
--- a/webkit/fileapi/file_system_operation_context.h
+++ b/webkit/fileapi/file_system_operation_context.h
@@ -6,6 +6,7 @@
#define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_CONTEXT_H_
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/media/mtp_device_file_system_config.h"
#include "webkit/fileapi/task_runner_bound_observer_list.h"
@@ -38,12 +39,16 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOperationContext {
int64 allowed_bytes_growth() const { return allowed_bytes_growth_; }
#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
- void set_mtp_device_delegate(MTPDeviceDelegate* delegate) {
+ // Called on IO thread.
+ void set_mtp_device_delegate(
+ const base::WeakPtr<MTPDeviceDelegate>& delegate) {
mtp_device_delegate_ = delegate;
}
- MTPDeviceDelegate* mtp_device_delegate() const {
- return mtp_device_delegate_.get();
+ // Caller of this function should dereference the delegate only on media
+ // sequenced task runner thread.
+ base::WeakPtr<MTPDeviceDelegate> mtp_device_delegate() const {
+ return mtp_device_delegate_;
}
#endif
@@ -91,8 +96,9 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOperationContext {
UpdateObserverList update_observers_;
#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
- // Store the current mtp device delegate.
- scoped_refptr<MTPDeviceDelegate> mtp_device_delegate_;
+ // The media transfer protocol (MTP) device delegate.
+ // Set on IO thread and dereferenced on media sequenced task runner thread.
+ base::WeakPtr<MTPDeviceDelegate> mtp_device_delegate_;
#endif
};
« no previous file with comments | « chrome/browser/media_gallery/mtp_device_delegate_impl_linux.cc ('k') | webkit/fileapi/isolated_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698