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

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

Issue 7608011: Simplify directory path accounting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rolled in CR feedback. Created 9 years, 4 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 | « webkit/fileapi/sandbox_mount_point_provider.h ('k') | 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/sandbox_mount_point_provider.h" 5 #include "webkit/fileapi/sandbox_mount_point_provider.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_callback_factory.h" 9 #include "base/memory/scoped_callback_factory.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 FILE_PATH_LITERAL("FS.old"); 272 FILE_PATH_LITERAL("FS.old");
273 273
274 SandboxMountPointProvider::SandboxMountPointProvider( 274 SandboxMountPointProvider::SandboxMountPointProvider(
275 FileSystemPathManager* path_manager, 275 FileSystemPathManager* path_manager,
276 scoped_refptr<base::MessageLoopProxy> file_message_loop, 276 scoped_refptr<base::MessageLoopProxy> file_message_loop,
277 const FilePath& profile_path) 277 const FilePath& profile_path)
278 : FileSystemQuotaUtil(file_message_loop), 278 : FileSystemQuotaUtil(file_message_loop),
279 path_manager_(path_manager), 279 path_manager_(path_manager),
280 file_message_loop_(file_message_loop), 280 file_message_loop_(file_message_loop),
281 profile_path_(profile_path), 281 profile_path_(profile_path),
282 quota_file_util_(QuotaFileUtil::CreateDefault()),
283 sandbox_file_util_( 282 sandbox_file_util_(
284 new ObfuscatedFileSystemFileUtil( 283 new ObfuscatedFileSystemFileUtil(
285 profile_path.Append(kNewFileSystemDirectory), 284 profile_path.Append(kNewFileSystemDirectory),
286 quota_file_util_)) { 285 QuotaFileUtil::CreateDefault())) {
287 } 286 }
288 287
289 SandboxMountPointProvider::~SandboxMountPointProvider() { 288 SandboxMountPointProvider::~SandboxMountPointProvider() {
290 if (!file_message_loop_->BelongsToCurrentThread()) 289 if (!file_message_loop_->BelongsToCurrentThread())
291 file_message_loop_->ReleaseSoon(FROM_HERE, sandbox_file_util_.release()); 290 file_message_loop_->ReleaseSoon(FROM_HERE, sandbox_file_util_.release());
292 } 291 }
293 292
294 bool SandboxMountPointProvider::IsAccessAllowed(const GURL& origin_url, 293 bool SandboxMountPointProvider::IsAccessAllowed(const GURL& origin_url,
295 FileSystemType type, 294 FileSystemType type,
296 const FilePath& unused) { 295 const FilePath& unused) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 base::PlatformFileInfo file_info; 555 base::PlatformFileInfo file_info;
557 FilePath platform_file_path; 556 FilePath platform_file_path;
558 if (!enumerator->IsDirectory()) { 557 if (!enumerator->IsDirectory()) {
559 base::PlatformFileError error = sandbox_file_util_->GetFileInfo( 558 base::PlatformFileError error = sandbox_file_util_->GetFileInfo(
560 &context, file_path_each, &file_info, &platform_file_path); 559 &context, file_path_each, &file_info, &platform_file_path);
561 if (error != base::PLATFORM_FILE_OK) 560 if (error != base::PLATFORM_FILE_OK)
562 NOTREACHED(); 561 NOTREACHED();
563 else 562 else
564 usage += file_info.size; 563 usage += file_info.size;
565 } 564 }
566 usage += quota_file_util_->ComputeFilePathCost(file_path_each); 565 usage += ObfuscatedFileSystemFileUtil::ComputeFilePathCost(file_path_each);
567 } 566 }
568 // This clears the dirty flag too. 567 // This clears the dirty flag too.
569 FileSystemUsageCache::UpdateUsage(usage_file_path, usage); 568 FileSystemUsageCache::UpdateUsage(usage_file_path, usage);
570 return usage; 569 return usage;
571 } 570 }
572 571
573 void SandboxMountPointProvider::NotifyOriginWasAccessedOnIOThread( 572 void SandboxMountPointProvider::NotifyOriginWasAccessedOnIOThread(
574 QuotaManagerProxy* proxy, const GURL& origin_url, 573 QuotaManagerProxy* proxy, const GURL& origin_url,
575 fileapi::FileSystemType type) { 574 fileapi::FileSystemType type) {
576 DCHECK(type == fileapi::kFileSystemTypeTemporary || 575 DCHECK(type == fileapi::kFileSystemTypeTemporary ||
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 651
653 // Creates the root directory. 652 // Creates the root directory.
654 root = origin_base_path.Append(OldCreateUniqueDirectoryName(origin_url)); 653 root = origin_base_path.Append(OldCreateUniqueDirectoryName(origin_url));
655 if (!file_util::CreateDirectory(root)) 654 if (!file_util::CreateDirectory(root))
656 return FilePath(); 655 return FilePath();
657 656
658 return root; 657 return root;
659 } 658 }
660 659
661 } // namespace fileapi 660 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/sandbox_mount_point_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698