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_file_system_test_helper.h" | 5 #include "webkit/browser/fileapi/sandbox_file_system_test_helper.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return file_system_context_->CreateCrackedFileSystemURL(origin_, type_, path); | 90 return file_system_context_->CreateCrackedFileSystemURL(origin_, type_, path); |
91 } | 91 } |
92 | 92 |
93 int64 SandboxFileSystemTestHelper::GetCachedOriginUsage() const { | 93 int64 SandboxFileSystemTestHelper::GetCachedOriginUsage() const { |
94 return file_system_context_->GetQuotaUtil(type_) | 94 return file_system_context_->GetQuotaUtil(type_) |
95 ->GetOriginUsageOnFileThread(file_system_context_.get(), origin_, type_); | 95 ->GetOriginUsageOnFileThread(file_system_context_.get(), origin_, type_); |
96 } | 96 } |
97 | 97 |
98 int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() { | 98 int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() { |
99 usage_cache()->CloseCacheFiles(); | 99 usage_cache()->CloseCacheFiles(); |
100 int64 size = file_util::ComputeDirectorySize(GetOriginRootPath()); | 100 int64 size = base::ComputeDirectorySize(GetOriginRootPath()); |
101 if (file_util::PathExists(GetUsageCachePath())) | 101 if (file_util::PathExists(GetUsageCachePath())) |
102 size -= FileSystemUsageCache::kUsageFileSize; | 102 size -= FileSystemUsageCache::kUsageFileSize; |
103 return size; | 103 return size; |
104 } | 104 } |
105 | 105 |
106 int64 | 106 int64 |
107 SandboxFileSystemTestHelper::ComputeCurrentDirectoryDatabaseUsage() { | 107 SandboxFileSystemTestHelper::ComputeCurrentDirectoryDatabaseUsage() { |
108 return file_util::ComputeDirectorySize( | 108 return base::ComputeDirectorySize( |
109 GetOriginRootPath().AppendASCII("Paths")); | 109 GetOriginRootPath().AppendASCII("Paths")); |
110 } | 110 } |
111 | 111 |
112 FileSystemOperationRunner* SandboxFileSystemTestHelper::operation_runner() { | 112 FileSystemOperationRunner* SandboxFileSystemTestHelper::operation_runner() { |
113 return file_system_context_->operation_runner(); | 113 return file_system_context_->operation_runner(); |
114 } | 114 } |
115 | 115 |
116 FileSystemOperationContext* | 116 FileSystemOperationContext* |
117 SandboxFileSystemTestHelper::NewOperationContext() { | 117 SandboxFileSystemTestHelper::NewOperationContext() { |
118 DCHECK(file_system_context_.get()); | 118 DCHECK(file_system_context_.get()); |
(...skipping 25 matching lines...) Expand all Loading... |
144 file_system_context_->sandbox_provider()-> | 144 file_system_context_->sandbox_provider()-> |
145 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); | 145 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); |
146 | 146 |
147 // Initialize the usage cache file. | 147 // Initialize the usage cache file. |
148 base::FilePath usage_cache_path = GetUsageCachePath(); | 148 base::FilePath usage_cache_path = GetUsageCachePath(); |
149 if (!usage_cache_path.empty()) | 149 if (!usage_cache_path.empty()) |
150 usage_cache()->UpdateUsage(usage_cache_path, 0); | 150 usage_cache()->UpdateUsage(usage_cache_path, 0); |
151 } | 151 } |
152 | 152 |
153 } // namespace fileapi | 153 } // namespace fileapi |
OLD | NEW |