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

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

Issue 6995017: Revert 84771 - Fix QuotaFileUtil to write .usage into the same directory as "chrome-", not under ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/quota_file_util.h" 5 #include "webkit/fileapi/quota_file_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "webkit/fileapi/file_system_context.h" 9 #include "webkit/fileapi/file_system_context.h"
10 #include "webkit/fileapi/file_system_operation_context.h" 10 #include "webkit/fileapi/file_system_operation_context.h"
11 #include "webkit/fileapi/file_system_path_manager.h" 11 #include "webkit/fileapi/file_system_path_manager.h"
12 #include "webkit/fileapi/file_system_usage_cache.h" 12 #include "webkit/fileapi/file_system_usage_cache.h"
13 #include "webkit/fileapi/sandbox_mount_point_provider.h"
14 13
15 namespace fileapi { 14 namespace fileapi {
16 15
17 const int64 QuotaFileUtil::kNoLimit = kint64max; 16 const int64 QuotaFileUtil::kNoLimit = kint64max;
18 17
19 namespace { 18 namespace {
20 19
21 // Checks if copying in the same filesystem can be performed. 20 // Checks if copying in the same filesystem can be performed.
22 // This method is not called for moving within a single filesystem. 21 // This method is not called for moving within a single filesystem.
23 static bool CanCopy( 22 static bool CanCopy(
(...skipping 13 matching lines...) Expand all
37 src_file_info.size - dest_file_info.size > allowed_bytes_growth) 36 src_file_info.size - dest_file_info.size > allowed_bytes_growth)
38 return false; 37 return false;
39 if (growth != NULL) 38 if (growth != NULL)
40 *growth = src_file_info.size - dest_file_info.size; 39 *growth = src_file_info.size - dest_file_info.size;
41 40
42 return true; 41 return true;
43 } 42 }
44 43
45 static FilePath InitUsageFile(FileSystemOperationContext* fs_context) { 44 static FilePath InitUsageFile(FileSystemOperationContext* fs_context) {
46 FilePath base_path = fs_context->file_system_context()->path_manager()-> 45 FilePath base_path = fs_context->file_system_context()->path_manager()->
47 sandbox_provider()->GetBaseDirectoryForOriginAndType( 46 ValidateFileSystemRootAndGetPathOnFileThread(fs_context->src_origin_url(),
48 fs_context->src_origin_url(), fs_context->src_type()); 47 fs_context->src_type(), FilePath(), false);
49 FilePath usage_file_path = 48 FilePath usage_file_path =
50 base_path.AppendASCII(FileSystemUsageCache::kUsageFileName); 49 base_path.AppendASCII(FileSystemUsageCache::kUsageFileName);
51 50
52 if (FileSystemUsageCache::Exists(usage_file_path)) 51 if (FileSystemUsageCache::Exists(usage_file_path))
53 FileSystemUsageCache::IncrementDirty(usage_file_path); 52 FileSystemUsageCache::IncrementDirty(usage_file_path);
54 53
55 return usage_file_path; 54 return usage_file_path;
56 } 55 }
57 56
58 static void UpdateUsageFile(const FilePath& usage_file_path, int64 growth) { 57 static void UpdateUsageFile(const FilePath& usage_file_path, int64 growth) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 147
149 base::PlatformFileError error = FileSystemFileUtil::GetInstance()->Truncate( 148 base::PlatformFileError error = FileSystemFileUtil::GetInstance()->Truncate(
150 fs_context, path, length); 149 fs_context, path, length);
151 150
152 UpdateUsageFile(usage_file_path, growth); 151 UpdateUsageFile(usage_file_path, growth);
153 152
154 return error; 153 return error;
155 } 154 }
156 155
157 } // namespace fileapi 156 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698