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

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

Issue 6997008: Fix QuotaFileUtil to write .usage into the same directory as "chrome-", not under "chrome-*". (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Mofified tests. 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 | webkit/fileapi/quota_file_util_unittest.cc » ('j') | 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"
13 14
14 namespace fileapi { 15 namespace fileapi {
15 16
16 const int64 QuotaFileUtil::kNoLimit = kint64max; 17 const int64 QuotaFileUtil::kNoLimit = kint64max;
17 18
18 namespace { 19 namespace {
19 20
20 // Checks if copying in the same filesystem can be performed. 21 // Checks if copying in the same filesystem can be performed.
21 // This method is not called for moving within a single filesystem. 22 // This method is not called for moving within a single filesystem.
22 static bool CanCopy( 23 static bool CanCopy(
(...skipping 13 matching lines...) Expand all
36 src_file_info.size - dest_file_info.size > allowed_bytes_growth) 37 src_file_info.size - dest_file_info.size > allowed_bytes_growth)
37 return false; 38 return false;
38 if (growth != NULL) 39 if (growth != NULL)
39 *growth = src_file_info.size - dest_file_info.size; 40 *growth = src_file_info.size - dest_file_info.size;
40 41
41 return true; 42 return true;
42 } 43 }
43 44
44 static FilePath InitUsageFile(FileSystemOperationContext* fs_context) { 45 static FilePath InitUsageFile(FileSystemOperationContext* fs_context) {
45 FilePath base_path = fs_context->file_system_context()->path_manager()-> 46 FilePath base_path = fs_context->file_system_context()->path_manager()->
46 ValidateFileSystemRootAndGetPathOnFileThread(fs_context->src_origin_url(), 47 sandbox_provider()->GetBaseDirectoryForOriginAndType(
47 fs_context->src_type(), FilePath(), false); 48 fs_context->src_origin_url(), fs_context->src_type());
48 FilePath usage_file_path = 49 FilePath usage_file_path =
49 base_path.AppendASCII(FileSystemUsageCache::kUsageFileName); 50 base_path.AppendASCII(FileSystemUsageCache::kUsageFileName);
50 51
51 if (FileSystemUsageCache::Exists(usage_file_path)) 52 if (FileSystemUsageCache::Exists(usage_file_path))
52 FileSystemUsageCache::IncrementDirty(usage_file_path); 53 FileSystemUsageCache::IncrementDirty(usage_file_path);
53 54
54 return usage_file_path; 55 return usage_file_path;
55 } 56 }
56 57
57 static void UpdateUsageFile(const FilePath& usage_file_path, int64 growth) { 58 static void UpdateUsageFile(const FilePath& usage_file_path, int64 growth) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 148
148 base::PlatformFileError error = FileSystemFileUtil::GetInstance()->Truncate( 149 base::PlatformFileError error = FileSystemFileUtil::GetInstance()->Truncate(
149 fs_context, path, length); 150 fs_context, path, length);
150 151
151 UpdateUsageFile(usage_file_path, growth); 152 UpdateUsageFile(usage_file_path, growth);
152 153
153 return error; 154 return error;
154 } 155 }
155 156
156 } // namespace fileapi 157 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/quota_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698