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

Side by Side Diff: webkit/fileapi/file_system_context.cc

Issue 13811013: Refactor FileSystemMountPointProvider::CreateFileStream{Reader,Writer} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: conflict fix Created 7 years, 8 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
« no previous file with comments | « webkit/fileapi/file_system_context.h ('k') | webkit/fileapi/file_system_mount_point_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/fileapi/file_system_context.h" 5 #include "webkit/fileapi/file_system_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "webkit/blob/file_stream_reader.h"
11 #include "webkit/fileapi/copy_or_move_file_validator.h" 12 #include "webkit/fileapi/copy_or_move_file_validator.h"
12 #include "webkit/fileapi/external_mount_points.h" 13 #include "webkit/fileapi/external_mount_points.h"
14 #include "webkit/fileapi/file_stream_writer.h"
13 #include "webkit/fileapi/file_system_file_util.h" 15 #include "webkit/fileapi/file_system_file_util.h"
14 #include "webkit/fileapi/file_system_operation.h" 16 #include "webkit/fileapi/file_system_operation.h"
15 #include "webkit/fileapi/file_system_options.h" 17 #include "webkit/fileapi/file_system_options.h"
16 #include "webkit/fileapi/file_system_quota_client.h" 18 #include "webkit/fileapi/file_system_quota_client.h"
17 #include "webkit/fileapi/file_system_task_runners.h" 19 #include "webkit/fileapi/file_system_task_runners.h"
18 #include "webkit/fileapi/file_system_url.h" 20 #include "webkit/fileapi/file_system_url.h"
19 #include "webkit/fileapi/file_system_util.h" 21 #include "webkit/fileapi/file_system_util.h"
20 #include "webkit/fileapi/isolated_context.h" 22 #include "webkit/fileapi/isolated_context.h"
21 #include "webkit/fileapi/isolated_mount_point_provider.h" 23 #include "webkit/fileapi/isolated_mount_point_provider.h"
22 #include "webkit/fileapi/mount_points.h" 24 #include "webkit/fileapi/mount_points.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 286
285 base::PlatformFileError fs_error = base::PLATFORM_FILE_OK; 287 base::PlatformFileError fs_error = base::PLATFORM_FILE_OK;
286 FileSystemOperation* operation = 288 FileSystemOperation* operation =
287 mount_point_provider->CreateFileSystemOperation(url, this, &fs_error); 289 mount_point_provider->CreateFileSystemOperation(url, this, &fs_error);
288 290
289 if (error_code) 291 if (error_code)
290 *error_code = fs_error; 292 *error_code = fs_error;
291 return operation; 293 return operation;
292 } 294 }
293 295
294 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( 296 scoped_ptr<webkit_blob::FileStreamReader>
297 FileSystemContext::CreateFileStreamReader(
295 const FileSystemURL& url, 298 const FileSystemURL& url,
296 int64 offset, 299 int64 offset,
297 const base::Time& expected_modification_time) { 300 const base::Time& expected_modification_time) {
298 if (!url.is_valid()) 301 if (!url.is_valid())
299 return NULL; 302 return scoped_ptr<webkit_blob::FileStreamReader>();
300 FileSystemMountPointProvider* mount_point_provider = 303 FileSystemMountPointProvider* mount_point_provider =
301 GetMountPointProvider(url.type()); 304 GetMountPointProvider(url.type());
302 if (!mount_point_provider) 305 if (!mount_point_provider)
303 return NULL; 306 return scoped_ptr<webkit_blob::FileStreamReader>();
304 return mount_point_provider->CreateFileStreamReader( 307 return mount_point_provider->CreateFileStreamReader(
305 url, offset, expected_modification_time, this); 308 url, offset, expected_modification_time, this);
306 } 309 }
307 310
308 FileStreamWriter* FileSystemContext::CreateFileStreamWriter( 311 scoped_ptr<FileStreamWriter> FileSystemContext::CreateFileStreamWriter(
309 const FileSystemURL& url, 312 const FileSystemURL& url,
310 int64 offset) { 313 int64 offset) {
311 if (!url.is_valid()) 314 if (!url.is_valid())
312 return NULL; 315 return scoped_ptr<FileStreamWriter>();
313 FileSystemMountPointProvider* mount_point_provider = 316 FileSystemMountPointProvider* mount_point_provider =
314 GetMountPointProvider(url.type()); 317 GetMountPointProvider(url.type());
315 if (!mount_point_provider) 318 if (!mount_point_provider)
316 return NULL; 319 return scoped_ptr<FileStreamWriter>();
317 return mount_point_provider->CreateFileStreamWriter(url, offset, this); 320 return mount_point_provider->CreateFileStreamWriter(url, offset, this);
318 } 321 }
319 322
320 void FileSystemContext::RegisterMountPointProvider( 323 void FileSystemContext::RegisterMountPointProvider(
321 FileSystemType type, 324 FileSystemType type,
322 FileSystemMountPointProvider* provider) { 325 FileSystemMountPointProvider* provider) {
323 DCHECK(provider); 326 DCHECK(provider);
324 DCHECK(provider_map_.find(type) == provider_map_.end()); 327 DCHECK(provider_map_.find(type) == provider_map_.end());
325 provider_map_[type] = provider; 328 provider_map_[type] = provider;
326 } 329 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 FileSystemFileUtil* FileSystemContext::GetFileUtil( 402 FileSystemFileUtil* FileSystemContext::GetFileUtil(
400 FileSystemType type) const { 403 FileSystemType type) const {
401 FileSystemMountPointProvider* mount_point_provider = 404 FileSystemMountPointProvider* mount_point_provider =
402 GetMountPointProvider(type); 405 GetMountPointProvider(type);
403 if (!mount_point_provider) 406 if (!mount_point_provider)
404 return NULL; 407 return NULL;
405 return mount_point_provider->GetFileUtil(type); 408 return mount_point_provider->GetFileUtil(type);
406 } 409 }
407 410
408 } // namespace fileapi 411 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_context.h ('k') | webkit/fileapi/file_system_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698