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

Unified Diff: webkit/fileapi/quota_file_util.cc

Issue 6471019: Stackable file_util for FileAPIs. Sample code for discussion. Incomplete. Cannot be compiled. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/quota_file_util.cc
diff --git a/webkit/fileapi/quota_file_util.cc b/webkit/fileapi/quota_file_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ae069512fbe39094b9687c209ce09de2512c5ea6
--- /dev/null
+++ b/webkit/fileapi/quota_file_util.cc
@@ -0,0 +1,30 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/fileapi/file_system_file_util_base.h"
+#include "webkit/fileapi/file_system_operation_context.h"
+
+#include "base/file_util.h"
+
+namespace fileapi {
+
+bool QuotaFileUtil::CopyFile(
+ const FileSystemOperationContext& fs_context,
+ const FilePath& from_path, const FilePath& to_path) {
+ int allowed_growth = fs_context.GetAllowedGrowth();
+
+ if (allowed_growth < SIZE_MAX) {
+ const char* path_str = from_path.value().c_str();
+ stat_wrapper_t file_info;
+ int test = CallStat(path_str, &file_info);
+ if (test != 0)
+ return base::PLATFORM_FILE_ERROR_FAILED;
+ if (file_info.st_size > allowed_growth)
+ return base::PLATFORM_FILE_ERROR_NO_SPACE;
+ }
+
+ return file_util::CopyFile(from_path, to_path);
ericu 2011/02/10 20:41:54 Would this also call into the quota system somehow
+}
+
+} // namespace fileapi
« webkit/fileapi/file_system_operation_context.h ('K') | « webkit/fileapi/quota_file_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698