OLD | NEW |
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/browser/fileapi/sandbox_mount_point_provider.h" | 5 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 operation_context->set_update_observers(update_observers_); | 316 operation_context->set_update_observers(update_observers_); |
317 operation_context->set_access_observers(access_observers_); | 317 operation_context->set_access_observers(access_observers_); |
318 | 318 |
319 if (special_storage_policy_ && | 319 if (special_storage_policy_ && |
320 special_storage_policy_->IsStorageUnlimited(url.origin())) { | 320 special_storage_policy_->IsStorageUnlimited(url.origin())) { |
321 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeUnlimited); | 321 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeUnlimited); |
322 } else { | 322 } else { |
323 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeLimited); | 323 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeLimited); |
324 } | 324 } |
325 | 325 |
326 // Temporarily disable returning unlimited storage policy for non-PERSISTENT | |
327 // storage. Since it may hurt performance for all FileSystem operation. | |
328 if (url.type() != kFileSystemTypePersistent && | |
329 operation_context->quota_limit_type() == quota::kQuotaLimitTypeUnlimited) | |
330 operation_context->set_quota_limit_type(quota::kQuotaLimitTypeLimited); | |
331 | |
332 return new LocalFileSystemOperation(context, operation_context.Pass()); | 326 return new LocalFileSystemOperation(context, operation_context.Pass()); |
333 } | 327 } |
334 | 328 |
335 scoped_ptr<webkit_blob::FileStreamReader> | 329 scoped_ptr<webkit_blob::FileStreamReader> |
336 SandboxMountPointProvider::CreateFileStreamReader( | 330 SandboxMountPointProvider::CreateFileStreamReader( |
337 const FileSystemURL& url, | 331 const FileSystemURL& url, |
338 int64 offset, | 332 int64 offset, |
339 const base::Time& expected_modification_time, | 333 const base::Time& expected_modification_time, |
340 FileSystemContext* context) const { | 334 FileSystemContext* context) const { |
341 return scoped_ptr<webkit_blob::FileStreamReader>( | 335 return scoped_ptr<webkit_blob::FileStreamReader>( |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 664 |
671 while (!(file_path_each = enumerator->Next()).empty()) { | 665 while (!(file_path_each = enumerator->Next()).empty()) { |
672 usage += enumerator->Size(); | 666 usage += enumerator->Size(); |
673 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); | 667 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); |
674 } | 668 } |
675 | 669 |
676 return usage; | 670 return usage; |
677 } | 671 } |
678 | 672 |
679 } // namespace fileapi | 673 } // namespace fileapi |
OLD | NEW |