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

Side by Side Diff: webkit/browser/fileapi/sandbox_file_system_test_helper.cc

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
OLDNEW
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_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return file_system_context_-> 84 return file_system_context_->
85 sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_); 85 sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_);
86 } 86 }
87 87
88 FileSystemURL SandboxFileSystemTestHelper::CreateURL( 88 FileSystemURL SandboxFileSystemTestHelper::CreateURL(
89 const base::FilePath& path) const { 89 const base::FilePath& path) const {
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_)->GetOriginUsageOnFileThread( 94 return file_system_context_->GetQuotaUtil(type_)
95 file_system_context_, 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 = file_util::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
(...skipping 20 matching lines...) Expand all
126 context->set_update_observers( 126 context->set_update_observers(
127 *file_system_context_->GetUpdateObservers(type_)); 127 *file_system_context_->GetUpdateObservers(type_));
128 return context; 128 return context;
129 } 129 }
130 130
131 FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() { 131 FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() {
132 return file_system_context()->sandbox_provider()->usage_cache(); 132 return file_system_context()->sandbox_provider()->usage_cache();
133 } 133 }
134 134
135 void SandboxFileSystemTestHelper::SetUpFileSystem() { 135 void SandboxFileSystemTestHelper::SetUpFileSystem() {
136 DCHECK(file_system_context_); 136 DCHECK(file_system_context_.get());
137 DCHECK(file_system_context_->sandbox_provider()->CanHandleType(type_)); 137 DCHECK(file_system_context_->sandbox_provider()->CanHandleType(type_));
138 138
139 file_util_ = file_system_context_->GetFileUtil(type_); 139 file_util_ = file_system_context_->GetFileUtil(type_);
140 DCHECK(file_util_); 140 DCHECK(file_util_);
141 141
142 // Prepare the origin's root directory. 142 // Prepare the origin's root directory.
143 file_system_context_->sandbox_provider()-> 143 file_system_context_->sandbox_provider()->
144 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); 144 GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */);
145 145
146 // Initialize the usage cache file. 146 // Initialize the usage cache file.
147 base::FilePath usage_cache_path = GetUsageCachePath(); 147 base::FilePath usage_cache_path = GetUsageCachePath();
148 if (!usage_cache_path.empty()) 148 if (!usage_cache_path.empty())
149 usage_cache()->UpdateUsage(usage_cache_path, 0); 149 usage_cache()->UpdateUsage(usage_cache_path, 0);
150 } 150 }
151 151
152 } // namespace fileapi 152 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/obfuscated_file_util_unittest.cc ('k') | webkit/browser/fileapi/sandbox_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698