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

Side by Side Diff: webkit/chromeos/fileapi/cros_mount_point_provider.cc

Issue 10197007: Change webkit/{fileapi,quota} code to use TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 8 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 | 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 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" 5 #include "webkit/chromeos/fileapi/cros_mount_point_provider.h"
6 6
7 #include "base/chromeos/chromeos_version.h" 7 #include "base/chromeos/chromeos_version.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/message_loop_proxy.h"
12 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
13 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/task_runner.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h "
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste m.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
19 #include "webkit/chromeos/fileapi/file_access_permissions.h" 19 #include "webkit/chromeos/fileapi/file_access_permissions.h"
20 #include "webkit/chromeos/fileapi/remote_file_system_operation.h" 20 #include "webkit/chromeos/fileapi/remote_file_system_operation.h"
21 #include "webkit/fileapi/file_system_file_reader.h" 21 #include "webkit/fileapi/file_system_file_reader.h"
22 #include "webkit/fileapi/file_system_operation.h" 22 #include "webkit/fileapi/file_system_operation.h"
23 #include "webkit/fileapi/file_system_util.h" 23 #include "webkit/fileapi/file_system_util.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return NULL; 237 return NULL;
238 238
239 return &(iter->second); 239 return &(iter->second);
240 } 240 }
241 241
242 fileapi::FileSystemOperationInterface* 242 fileapi::FileSystemOperationInterface*
243 CrosMountPointProvider::CreateFileSystemOperation( 243 CrosMountPointProvider::CreateFileSystemOperation(
244 const GURL& origin_url, 244 const GURL& origin_url,
245 fileapi::FileSystemType file_system_type, 245 fileapi::FileSystemType file_system_type,
246 const FilePath& virtual_path, 246 const FilePath& virtual_path,
247 base::MessageLoopProxy* file_proxy, 247 base::TaskRunner* task_runner,
248 fileapi::FileSystemContext* context) const { 248 fileapi::FileSystemContext* context) const {
249 const MountPoint* mount_point = GetMountPoint(virtual_path); 249 const MountPoint* mount_point = GetMountPoint(virtual_path);
250 if (mount_point && mount_point->location == REMOTE) 250 if (mount_point && mount_point->location == REMOTE)
251 return new chromeos::RemoteFileSystemOperation(mount_point->remote_proxy); 251 return new chromeos::RemoteFileSystemOperation(mount_point->remote_proxy);
252 252
253 return new fileapi::FileSystemOperation(file_proxy, context); 253 return new fileapi::FileSystemOperation(task_runner, context);
254 } 254 }
255 255
256 webkit_blob::FileReader* CrosMountPointProvider::CreateFileReader( 256 webkit_blob::FileReader* CrosMountPointProvider::CreateFileReader(
257 const GURL& url,
258 int64 offset,
259 base::TaskRunner* task_runner,
260 fileapi::FileSystemContext* context) const {
261 // For now we return a generic Reader implementation which utilizes
262 // CreateSnapshotFile internally (i.e. will download everything first).
263 // TODO(satorux,zel): implement more efficient reader for remote cases.
264 return new fileapi::FileSystemFileReader(task_runner, context, url, offset);
265 }
266
267 webkit_blob::FileReader* CrosMountPointProvider::CreateFileReader(
257 const GURL& url, 268 const GURL& url,
258 int64 offset, 269 int64 offset,
259 base::MessageLoopProxy* file_proxy, 270 base::MessageLoopProxy* file_proxy,
michaeln 2012/04/27 01:04:03 should this variant be removed now, i don't see it
kinuko 2012/04/27 10:10:29 Due to bad merge... this change contained some rou
260 fileapi::FileSystemContext* context) const { 271 fileapi::FileSystemContext* context) const {
261 // For now we return a generic Reader implementation which utilizes 272 // For now we return a generic Reader implementation which utilizes
262 // CreateSnapshotFile internally (i.e. will download everything first). 273 // CreateSnapshotFile internally (i.e. will download everything first).
263 // TODO(satorux,zel): implement more efficient reader for remote cases. 274 // TODO(satorux,zel): implement more efficient reader for remote cases.
264 return new fileapi::FileSystemFileReader(file_proxy, context, url, offset); 275 return new fileapi::FileSystemFileReader(file_proxy, context, url, offset);
265 } 276 }
266 277
267 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path, 278 bool CrosMountPointProvider::GetVirtualPath(const FilePath& filesystem_path,
268 FilePath* virtual_path) { 279 FilePath* virtual_path) {
269 for (MountPointMap::const_iterator iter = mount_point_map_.begin(); 280 for (MountPointMap::const_iterator iter = mount_point_map_.begin();
270 iter != mount_point_map_.end(); 281 iter != mount_point_map_.end();
271 ++iter) { 282 ++iter) {
272 FilePath mount_prefix = iter->second.local_root_path.Append(iter->first); 283 FilePath mount_prefix = iter->second.local_root_path.Append(iter->first);
273 *virtual_path = FilePath(iter->first); 284 *virtual_path = FilePath(iter->first);
274 if (mount_prefix == filesystem_path) { 285 if (mount_prefix == filesystem_path) {
275 return true; 286 return true;
276 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) { 287 } else if (mount_prefix.AppendRelativePath(filesystem_path, virtual_path)) {
277 return true; 288 return true;
278 } 289 }
279 } 290 }
280 return false; 291 return false;
281 } 292 }
282 293
283 } // namespace chromeos 294 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698