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

Side by Side Diff: webkit/browser/fileapi/syncable/syncable_file_system_operation.cc

Issue 21370003: Rename fileapi::LocalFileSystemOperation to FileSystemOperationImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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 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 "webkit/browser/fileapi/syncable/syncable_file_system_operation.h" 5 #include "webkit/browser/fileapi/syncable/syncable_file_system_operation.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/url_request/url_request.h" 8 #include "net/url_request/url_request.h"
9 #include "webkit/browser/fileapi/file_system_context.h" 9 #include "webkit/browser/fileapi/file_system_context.h"
10 #include "webkit/browser/fileapi/file_system_operation_context.h" 10 #include "webkit/browser/fileapi/file_system_operation_context.h"
11 #include "webkit/browser/fileapi/file_system_operation_impl.h"
11 #include "webkit/browser/fileapi/file_system_url.h" 12 #include "webkit/browser/fileapi/file_system_url.h"
12 #include "webkit/browser/fileapi/local_file_system_operation.h"
13 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 13 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
14 #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" 14 #include "webkit/browser/fileapi/syncable/local_file_sync_context.h"
15 #include "webkit/browser/fileapi/syncable/syncable_file_operation_runner.h" 15 #include "webkit/browser/fileapi/syncable/syncable_file_operation_runner.h"
16 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" 16 #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h"
17 #include "webkit/common/blob/shareable_file_reference.h" 17 #include "webkit/common/blob/shareable_file_reference.h"
18 18
19 using fileapi::FileSystemURL; 19 using fileapi::FileSystemURL;
20 using fileapi::FileSystemOperationContext; 20 using fileapi::FileSystemOperationContext;
21 using fileapi::LocalFileSystemOperation; 21 using fileapi::FileSystemOperationImpl;
22 22
23 namespace sync_file_system { 23 namespace sync_file_system {
24 24
25 namespace { 25 namespace {
26 26
27 void WriteCallbackAdapter( 27 void WriteCallbackAdapter(
28 const SyncableFileSystemOperation::WriteCallback& callback, 28 const SyncableFileSystemOperation::WriteCallback& callback,
29 base::PlatformFileError status) { 29 base::PlatformFileError status) {
30 callback.Run(status, 0, true); 30 callback.Run(status, 0, true);
31 } 31 }
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 DCHECK(CalledOnValidThread()); 296 DCHECK(CalledOnValidThread());
297 if (!operation_runner_.get()) { 297 if (!operation_runner_.get()) {
298 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND); 298 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND);
299 return; 299 return;
300 } 300 }
301 DCHECK(operation_runner_.get()); 301 DCHECK(operation_runner_.get());
302 target_paths_.push_back(dest_url); 302 target_paths_.push_back(dest_url);
303 completion_callback_ = callback; 303 completion_callback_ = callback;
304 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( 304 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask(
305 AsWeakPtr(), 305 AsWeakPtr(),
306 base::Bind(&LocalFileSystemOperation::CopyInForeignFile, 306 base::Bind(&FileSystemOperationImpl::CopyInForeignFile,
307 NewOperation()->AsWeakPtr(), 307 NewOperation()->AsWeakPtr(),
308 src_local_disk_path, dest_url, 308 src_local_disk_path, dest_url,
309 base::Bind(&self::DidFinish, AsWeakPtr())))); 309 base::Bind(&self::DidFinish, AsWeakPtr()))));
310 operation_runner_->PostOperationTask(task.Pass()); 310 operation_runner_->PostOperationTask(task.Pass());
311 } 311 }
312 312
313 SyncableFileSystemOperation::SyncableFileSystemOperation( 313 SyncableFileSystemOperation::SyncableFileSystemOperation(
314 const FileSystemURL& url, 314 const FileSystemURL& url,
315 fileapi::FileSystemContext* file_system_context, 315 fileapi::FileSystemContext* file_system_context,
316 scoped_ptr<FileSystemOperationContext> operation_context) 316 scoped_ptr<FileSystemOperationContext> operation_context)
317 : LocalFileSystemOperation(url, file_system_context, 317 : FileSystemOperationImpl(url, file_system_context,
318 operation_context.Pass()), 318 operation_context.Pass()),
319 url_(url) { 319 url_(url) {
320 DCHECK(file_system_context); 320 DCHECK(file_system_context);
321 if (!file_system_context->sync_context()) { 321 if (!file_system_context->sync_context()) {
322 // Syncable FileSystem is opened in a file system context which doesn't 322 // Syncable FileSystem is opened in a file system context which doesn't
323 // support (or is not initialized for) the API. 323 // support (or is not initialized for) the API.
324 // Returning here to leave operation_runner_ as NULL. 324 // Returning here to leave operation_runner_ as NULL.
325 return; 325 return;
326 } 326 }
327 operation_runner_ = file_system_context->sync_context()->operation_runner(); 327 operation_runner_ = file_system_context->sync_context()->operation_runner();
328 is_directory_operation_enabled_ = IsSyncFSDirectoryOperationEnabled(); 328 is_directory_operation_enabled_ = IsSyncFSDirectoryOperationEnabled();
329 } 329 }
330 330
331 LocalFileSystemOperation* SyncableFileSystemOperation::NewOperation() { 331 FileSystemOperationImpl* SyncableFileSystemOperation::NewOperation() {
332 DCHECK(operation_context_); 332 DCHECK(operation_context_);
333 inflight_operation_.reset(new LocalFileSystemOperation( 333 inflight_operation_.reset(new FileSystemOperationImpl(
334 url_, file_system_context(), operation_context_.Pass())); 334 url_, file_system_context(), operation_context_.Pass()));
335 DCHECK(inflight_operation_); 335 DCHECK(inflight_operation_);
336 return inflight_operation_.get(); 336 return inflight_operation_.get();
337 } 337 }
338 338
339 void SyncableFileSystemOperation::DidFinish(base::PlatformFileError status) { 339 void SyncableFileSystemOperation::DidFinish(base::PlatformFileError status) {
340 DCHECK(CalledOnValidThread()); 340 DCHECK(CalledOnValidThread());
341 DCHECK(!completion_callback_.is_null()); 341 DCHECK(!completion_callback_.is_null());
342 if (operation_runner_.get()) 342 if (operation_runner_.get())
343 operation_runner_->OnOperationCompleted(target_paths_); 343 operation_runner_->OnOperationCompleted(target_paths_);
(...skipping 14 matching lines...) Expand all
358 operation_runner_->OnOperationCompleted(target_paths_); 358 operation_runner_->OnOperationCompleted(target_paths_);
359 callback.Run(result, bytes, complete); 359 callback.Run(result, bytes, complete);
360 } 360 }
361 361
362 void SyncableFileSystemOperation::OnCancelled() { 362 void SyncableFileSystemOperation::OnCancelled() {
363 DCHECK(!completion_callback_.is_null()); 363 DCHECK(!completion_callback_.is_null());
364 completion_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT); 364 completion_callback_.Run(base::PLATFORM_FILE_ERROR_ABORT);
365 } 365 }
366 366
367 } // namespace sync_file_system 367 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698