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

Side by Side Diff: webkit/browser/fileapi/file_system_operation_impl.cc

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 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/file_system_operation_impl.h" 5 #include "webkit/browser/fileapi/file_system_operation_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "net/base/escape.h" 11 #include "net/base/escape.h"
12 #include "net/url_request/url_request.h" 12 #include "net/url_request/url_request.h"
13 #include "webkit/browser/fileapi/async_file_util.h" 13 #include "webkit/browser/fileapi/async_file_util.h"
14 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h" 14 #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h"
15 #include "webkit/browser/fileapi/file_observers.h" 15 #include "webkit/browser/fileapi/file_observers.h"
16 #include "webkit/browser/fileapi/file_system_backend.h" 16 #include "webkit/browser/fileapi/file_system_backend.h"
17 #include "webkit/browser/fileapi/file_system_context.h" 17 #include "webkit/browser/fileapi/file_system_context.h"
18 #include "webkit/browser/fileapi/file_system_file_util.h" 18 #include "webkit/browser/fileapi/file_system_file_util.h"
19 #include "webkit/browser/fileapi/file_system_operation_context.h" 19 #include "webkit/browser/fileapi/file_system_operation_context.h"
20 #include "webkit/browser/fileapi/file_system_url.h" 20 #include "webkit/browser/fileapi/file_system_url.h"
21 #include "webkit/browser/fileapi/file_writer_delegate.h" 21 #include "webkit/browser/fileapi/file_writer_delegate.h"
22 #include "webkit/browser/fileapi/remove_operation_delegate.h" 22 #include "webkit/browser/fileapi/remove_operation_delegate.h"
23 #include "webkit/browser/fileapi/sandbox_file_system_backend.h" 23 #include "webkit/browser/fileapi/sandbox_file_system_backend.h"
24 #include "webkit/browser/quota/quota_manager_proxy.h" 24 #include "webkit/browser/quota/quota_manager_proxy.h"
25 #include "webkit/common/blob/shareable_file_reference.h" 25 #include "webkit/common/blob/shareable_file_reference.h"
26 #include "webkit/common/fileapi/file_system_types.h" 26 #include "webkit/common/fileapi/file_system_types.h"
27 #include "webkit/common/fileapi/file_system_util.h" 27 #include "webkit/common/fileapi/file_system_util.h"
28 #include "webkit/common/quota/quota_types.h" 28 #include "webkit/common/quota/quota_types.h"
29 29
30 using webkit_blob::ScopedFile; 30 using storage::ScopedFile;
31 31
32 namespace fileapi { 32 namespace storage {
33 33
34 FileSystemOperation* FileSystemOperation::Create( 34 FileSystemOperation* FileSystemOperation::Create(
35 const FileSystemURL& url, 35 const FileSystemURL& url,
36 FileSystemContext* file_system_context, 36 FileSystemContext* file_system_context,
37 scoped_ptr<FileSystemOperationContext> operation_context) { 37 scoped_ptr<FileSystemOperationContext> operation_context) {
38 return new FileSystemOperationImpl(url, file_system_context, 38 return new FileSystemOperationImpl(url, file_system_context,
39 operation_context.Pass()); 39 operation_context.Pass());
40 } 40 }
41 41
42 FileSystemOperationImpl::~FileSystemOperationImpl() { 42 FileSystemOperationImpl::~FileSystemOperationImpl() {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 DCHECK(operation_context_.get()); 334 DCHECK(operation_context_.get());
335 operation_context_->DetachUserDataThread(); 335 operation_context_->DetachUserDataThread();
336 async_file_util_ = file_system_context_->GetAsyncFileUtil(url.type()); 336 async_file_util_ = file_system_context_->GetAsyncFileUtil(url.type());
337 DCHECK(async_file_util_); 337 DCHECK(async_file_util_);
338 } 338 }
339 339
340 void FileSystemOperationImpl::GetUsageAndQuotaThenRunTask( 340 void FileSystemOperationImpl::GetUsageAndQuotaThenRunTask(
341 const FileSystemURL& url, 341 const FileSystemURL& url,
342 const base::Closure& task, 342 const base::Closure& task,
343 const base::Closure& error_callback) { 343 const base::Closure& error_callback) {
344 quota::QuotaManagerProxy* quota_manager_proxy = 344 storage::QuotaManagerProxy* quota_manager_proxy =
345 file_system_context()->quota_manager_proxy(); 345 file_system_context()->quota_manager_proxy();
346 if (!quota_manager_proxy || 346 if (!quota_manager_proxy ||
347 !file_system_context()->GetQuotaUtil(url.type())) { 347 !file_system_context()->GetQuotaUtil(url.type())) {
348 // If we don't have the quota manager or the requested filesystem type 348 // If we don't have the quota manager or the requested filesystem type
349 // does not support quota, we should be able to let it go. 349 // does not support quota, we should be able to let it go.
350 operation_context_->set_allowed_bytes_growth(kint64max); 350 operation_context_->set_allowed_bytes_growth(kint64max);
351 task.Run(); 351 task.Run();
352 return; 352 return;
353 } 353 }
354 354
355 DCHECK(quota_manager_proxy); 355 DCHECK(quota_manager_proxy);
356 DCHECK(quota_manager_proxy->quota_manager()); 356 DCHECK(quota_manager_proxy->quota_manager());
357 quota_manager_proxy->quota_manager()->GetUsageAndQuota( 357 quota_manager_proxy->quota_manager()->GetUsageAndQuota(
358 url.origin(), 358 url.origin(),
359 FileSystemTypeToQuotaStorageType(url.type()), 359 FileSystemTypeToQuotaStorageType(url.type()),
360 base::Bind(&FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask, 360 base::Bind(&FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask,
361 weak_factory_.GetWeakPtr(), task, error_callback)); 361 weak_factory_.GetWeakPtr(), task, error_callback));
362 } 362 }
363 363
364 void FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask( 364 void FileSystemOperationImpl::DidGetUsageAndQuotaAndRunTask(
365 const base::Closure& task, 365 const base::Closure& task,
366 const base::Closure& error_callback, 366 const base::Closure& error_callback,
367 quota::QuotaStatusCode status, 367 storage::QuotaStatusCode status,
368 int64 usage, int64 quota) { 368 int64 usage,
369 if (status != quota::kQuotaStatusOk) { 369 int64 quota) {
370 if (status != storage::kQuotaStatusOk) {
370 LOG(WARNING) << "Got unexpected quota error : " << status; 371 LOG(WARNING) << "Got unexpected quota error : " << status;
371 error_callback.Run(); 372 error_callback.Run();
372 return; 373 return;
373 } 374 }
374 375
375 operation_context_->set_allowed_bytes_growth(quota - usage); 376 operation_context_->set_allowed_bytes_growth(quota - usage);
376 task.Run(); 377 task.Run();
377 } 378 }
378 379
379 void FileSystemOperationImpl::DoCreateFile( 380 void FileSystemOperationImpl::DoCreateFile(
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 callback.Run(file.Pass(), on_close_callback); 549 callback.Run(file.Pass(), on_close_callback);
549 } 550 }
550 551
551 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) { 552 bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) {
552 if (pending_operation_ != kOperationNone) 553 if (pending_operation_ != kOperationNone)
553 return false; 554 return false;
554 pending_operation_ = type; 555 pending_operation_ = type;
555 return true; 556 return true;
556 } 557 }
557 558
558 } // namespace fileapi 559 } // namespace storage
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_operation_impl.h ('k') | webkit/browser/fileapi/file_system_operation_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698