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

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

Issue 14265022: [Quota][FileAPI] Add quota policy to FileSystemOperationContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add special storage policy Created 7 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/fileapi/local_file_system_operation.h" 5 #include "webkit/fileapi/local_file_system_operation.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/time.h" 9 #include "base/time.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 const OpenFileCallback& callback) { 324 const OpenFileCallback& callback) {
325 DCHECK(SetPendingOperationType(kOperationOpenFile)); 325 DCHECK(SetPendingOperationType(kOperationOpenFile));
326 scoped_ptr<LocalFileSystemOperation> deleter(this); 326 scoped_ptr<LocalFileSystemOperation> deleter(this);
327 327
328 peer_handle_ = peer_handle; 328 peer_handle_ = peer_handle;
329 329
330 if (file_flags & ( 330 if (file_flags & (
331 (base::PLATFORM_FILE_ENUMERATE | base::PLATFORM_FILE_TEMPORARY | 331 (base::PLATFORM_FILE_ENUMERATE | base::PLATFORM_FILE_TEMPORARY |
332 base::PLATFORM_FILE_HIDDEN))) { 332 base::PLATFORM_FILE_HIDDEN))) {
333 callback.Run(base::PLATFORM_FILE_ERROR_FAILED, 333 callback.Run(base::PLATFORM_FILE_ERROR_FAILED,
334 base::PlatformFile(), base::ProcessHandle()); 334 base::kInvalidPlatformFileValue,
335 base::kNullProcessHandle);
335 return; 336 return;
336 } 337 }
337 if (file_flags & 338 if (file_flags &
338 (base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_OPEN_ALWAYS | 339 (base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_OPEN_ALWAYS |
339 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_OPEN_TRUNCATED | 340 base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_OPEN_TRUNCATED |
340 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE | 341 base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE |
341 base::PLATFORM_FILE_DELETE_ON_CLOSE | 342 base::PLATFORM_FILE_DELETE_ON_CLOSE |
342 base::PLATFORM_FILE_WRITE_ATTRIBUTES)) { 343 base::PLATFORM_FILE_WRITE_ATTRIBUTES)) {
343 base::PlatformFileError result = SetUp(url, OPERATION_MODE_WRITE); 344 base::PlatformFileError result = SetUp(url, OPERATION_MODE_WRITE);
344 if (result != base::PLATFORM_FILE_OK) { 345 if (result != base::PLATFORM_FILE_OK) {
345 callback.Run(result, base::PlatformFile(), base::ProcessHandle()); 346 callback.Run(result,
347 base::kInvalidPlatformFileValue,
348 base::kNullProcessHandle);
346 return; 349 return;
347 } 350 }
348 } else { 351 } else {
349 base::PlatformFileError result = SetUp(url, OPERATION_MODE_READ); 352 base::PlatformFileError result = SetUp(url, OPERATION_MODE_READ);
350 if (result != base::PLATFORM_FILE_OK) { 353 if (result != base::PLATFORM_FILE_OK) {
351 callback.Run(result, base::PlatformFile(), base::ProcessHandle()); 354 callback.Run(result,
355 base::kInvalidPlatformFileValue,
356 base::kNullProcessHandle);
352 return; 357 return;
353 } 358 }
354 } 359 }
355 GetUsageAndQuotaThenRunTask( 360 GetUsageAndQuotaThenRunTask(
356 url, 361 url,
357 base::Bind(&LocalFileSystemOperation::DoOpenFile, 362 base::Bind(&LocalFileSystemOperation::DoOpenFile,
358 base::Unretained(deleter.release()), 363 base::Unretained(deleter.release()),
359 url, callback, file_flags), 364 url, callback, file_flags),
360 base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED, 365 base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED,
361 base::kInvalidPlatformFileValue, 366 base::kInvalidPlatformFileValue,
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } 874 }
870 875
871 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) { 876 bool LocalFileSystemOperation::SetPendingOperationType(OperationType type) {
872 if (pending_operation_ != kOperationNone) 877 if (pending_operation_ != kOperationNone)
873 return false; 878 return false;
874 pending_operation_ = type; 879 pending_operation_ = type;
875 return true; 880 return true;
876 } 881 }
877 882
878 } // namespace fileapi 883 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_operation_context.cc ('k') | webkit/fileapi/sandbox_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698