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

Side by Side Diff: storage/browser/fileapi/plugin_private_file_system_backend.cc

Issue 1115663002: [storage/browser/fileapi] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "storage/browser/fileapi/plugin_private_file_system_backend.h" 5 #include "storage/browser/fileapi/plugin_private_file_system_backend.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
11 #include "base/task_runner_util.h" 11 #include "base/task_runner_util.h"
12 #include "base/thread_task_runner_handle.h"
12 #include "net/base/net_util.h" 13 #include "net/base/net_util.h"
13 #include "storage/browser/fileapi/async_file_util_adapter.h" 14 #include "storage/browser/fileapi/async_file_util_adapter.h"
14 #include "storage/browser/fileapi/file_stream_reader.h" 15 #include "storage/browser/fileapi/file_stream_reader.h"
15 #include "storage/browser/fileapi/file_stream_writer.h" 16 #include "storage/browser/fileapi/file_stream_writer.h"
16 #include "storage/browser/fileapi/file_system_context.h" 17 #include "storage/browser/fileapi/file_system_context.h"
17 #include "storage/browser/fileapi/file_system_operation.h" 18 #include "storage/browser/fileapi/file_system_operation.h"
18 #include "storage/browser/fileapi/file_system_operation_context.h" 19 #include "storage/browser/fileapi/file_system_operation_context.h"
19 #include "storage/browser/fileapi/file_system_options.h" 20 #include "storage/browser/fileapi/file_system_options.h"
20 #include "storage/browser/fileapi/isolated_context.h" 21 #include "storage/browser/fileapi/isolated_context.h"
21 #include "storage/browser/fileapi/obfuscated_file_util.h" 22 #include "storage/browser/fileapi/obfuscated_file_util.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 116 }
116 117
117 void PluginPrivateFileSystemBackend::OpenPrivateFileSystem( 118 void PluginPrivateFileSystemBackend::OpenPrivateFileSystem(
118 const GURL& origin_url, 119 const GURL& origin_url,
119 FileSystemType type, 120 FileSystemType type,
120 const std::string& filesystem_id, 121 const std::string& filesystem_id,
121 const std::string& plugin_id, 122 const std::string& plugin_id,
122 OpenFileSystemMode mode, 123 OpenFileSystemMode mode,
123 const StatusCallback& callback) { 124 const StatusCallback& callback) {
124 if (!CanHandleType(type) || file_system_options_.is_incognito()) { 125 if (!CanHandleType(type) || file_system_options_.is_incognito()) {
125 base::MessageLoopProxy::current()->PostTask( 126 base::ThreadTaskRunnerHandle::Get()->PostTask(
126 FROM_HERE, base::Bind(callback, base::File::FILE_ERROR_SECURITY)); 127 FROM_HERE, base::Bind(callback, base::File::FILE_ERROR_SECURITY));
127 return; 128 return;
128 } 129 }
129 130
130 PostTaskAndReplyWithResult( 131 PostTaskAndReplyWithResult(
131 file_task_runner_.get(), 132 file_task_runner_.get(),
132 FROM_HERE, 133 FROM_HERE,
133 base::Bind(&OpenFileSystemOnFileTaskRunner, 134 base::Bind(&OpenFileSystemOnFileTaskRunner,
134 obfuscated_file_util(), plugin_map_, 135 obfuscated_file_util(), plugin_map_,
135 origin_url, filesystem_id, plugin_id, mode), 136 origin_url, filesystem_id, plugin_id, mode),
136 callback); 137 callback);
137 } 138 }
138 139
139 bool PluginPrivateFileSystemBackend::CanHandleType(FileSystemType type) const { 140 bool PluginPrivateFileSystemBackend::CanHandleType(FileSystemType type) const {
140 return type == kFileSystemTypePluginPrivate; 141 return type == kFileSystemTypePluginPrivate;
141 } 142 }
142 143
143 void PluginPrivateFileSystemBackend::Initialize(FileSystemContext* context) { 144 void PluginPrivateFileSystemBackend::Initialize(FileSystemContext* context) {
144 } 145 }
145 146
146 void PluginPrivateFileSystemBackend::ResolveURL( 147 void PluginPrivateFileSystemBackend::ResolveURL(
147 const FileSystemURL& url, 148 const FileSystemURL& url,
148 OpenFileSystemMode mode, 149 OpenFileSystemMode mode,
149 const OpenFileSystemCallback& callback) { 150 const OpenFileSystemCallback& callback) {
150 // We never allow opening a new plugin-private filesystem via usual 151 // We never allow opening a new plugin-private filesystem via usual
151 // ResolveURL. 152 // ResolveURL.
152 base::MessageLoopProxy::current()->PostTask( 153 base::ThreadTaskRunnerHandle::Get()->PostTask(
153 FROM_HERE, 154 FROM_HERE,
154 base::Bind(callback, GURL(), std::string(), 155 base::Bind(callback, GURL(), std::string(),
155 base::File::FILE_ERROR_SECURITY)); 156 base::File::FILE_ERROR_SECURITY));
156 } 157 }
157 158
158 AsyncFileUtil* 159 AsyncFileUtil*
159 PluginPrivateFileSystemBackend::GetAsyncFileUtil(FileSystemType type) { 160 PluginPrivateFileSystemBackend::GetAsyncFileUtil(FileSystemType type) {
160 return file_util_.get(); 161 return file_util_.get();
161 } 162 }
162 163
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 FileSystemType type) const { 289 FileSystemType type) const {
289 return NULL; 290 return NULL;
290 } 291 }
291 292
292 ObfuscatedFileUtil* PluginPrivateFileSystemBackend::obfuscated_file_util() { 293 ObfuscatedFileUtil* PluginPrivateFileSystemBackend::obfuscated_file_util() {
293 return static_cast<ObfuscatedFileUtil*>( 294 return static_cast<ObfuscatedFileUtil*>(
294 static_cast<AsyncFileUtilAdapter*>(file_util_.get())->sync_file_util()); 295 static_cast<AsyncFileUtilAdapter*>(file_util_.get())->sync_file_util());
295 } 296 }
296 297
297 } // namespace storage 298 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/isolated_file_system_backend.cc ('k') | storage/browser/fileapi/recursive_operation_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698