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

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

Issue 6426001: Add 1st cut of FileSystemUsageTracker that tracks the usage changes in FileSystem API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix for win Created 9 years, 10 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/sandboxed_file_system_context.h ('k') | webkit/fileapi/webkit_fileapi.gypi » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sandboxed_file_system_context.h" 5 #include "webkit/fileapi/sandboxed_file_system_context.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "webkit/fileapi/file_system_path_manager.h" 9 #include "webkit/fileapi/file_system_path_manager.h"
10 #include "webkit/fileapi/file_system_quota_manager.h" 10 #include "webkit/fileapi/file_system_quota_manager.h"
11 #include "webkit/fileapi/file_system_usage_tracker.h"
11 12
12 namespace fileapi { 13 namespace fileapi {
13 14
14 SandboxedFileSystemContext::SandboxedFileSystemContext( 15 SandboxedFileSystemContext::SandboxedFileSystemContext(
15 scoped_refptr<base::MessageLoopProxy> file_message_loop, 16 scoped_refptr<base::MessageLoopProxy> file_message_loop,
16 scoped_refptr<base::MessageLoopProxy> io_message_loop, 17 scoped_refptr<base::MessageLoopProxy> io_message_loop,
17 const FilePath& profile_path, 18 const FilePath& profile_path,
18 bool is_incognito, 19 bool is_incognito,
19 bool allow_file_access, 20 bool allow_file_access,
20 bool unlimited_quota) 21 bool unlimited_quota)
21 : file_message_loop_(file_message_loop), 22 : file_message_loop_(file_message_loop),
22 io_message_loop_(io_message_loop), 23 io_message_loop_(io_message_loop),
23 path_manager_(new FileSystemPathManager( 24 path_manager_(new FileSystemPathManager(
24 file_message_loop, profile_path, is_incognito, allow_file_access)), 25 file_message_loop, profile_path, is_incognito, allow_file_access)),
25 quota_manager_(new FileSystemQuotaManager( 26 quota_manager_(new FileSystemQuotaManager(
26 allow_file_access, unlimited_quota)) { 27 allow_file_access, unlimited_quota)),
28 usage_tracker_(new FileSystemUsageTracker(
29 file_message_loop, profile_path, is_incognito)) {
27 } 30 }
28 31
29 SandboxedFileSystemContext::~SandboxedFileSystemContext() { 32 SandboxedFileSystemContext::~SandboxedFileSystemContext() {
30 } 33 }
31 34
32 void SandboxedFileSystemContext::Shutdown() {
33 DCHECK(io_message_loop_->BelongsToCurrentThread());
34 path_manager_.reset();
35 quota_manager_.reset();
36 }
37
38 void SandboxedFileSystemContext::DeleteDataForOriginOnFileThread( 35 void SandboxedFileSystemContext::DeleteDataForOriginOnFileThread(
39 const GURL& origin_url) { 36 const GURL& origin_url) {
40 DCHECK(path_manager_.get()); 37 DCHECK(path_manager_.get());
41 DCHECK(file_message_loop_->BelongsToCurrentThread()); 38 DCHECK(file_message_loop_->BelongsToCurrentThread());
42 39
43 std::string storage_identifier = 40 std::string storage_identifier =
44 FileSystemPathManager::GetStorageIdentifierFromURL(origin_url); 41 FileSystemPathManager::GetStorageIdentifierFromURL(origin_url);
45 FilePath path_for_origin = path_manager_->base_path().AppendASCII( 42 FilePath path_for_origin = path_manager_->base_path().AppendASCII(
46 storage_identifier); 43 storage_identifier);
47 44
(...skipping 12 matching lines...) Expand all
60 57
61 void SandboxedFileSystemContext::DeleteOnCorrectThread() const { 58 void SandboxedFileSystemContext::DeleteOnCorrectThread() const {
62 if (!io_message_loop_->BelongsToCurrentThread()) { 59 if (!io_message_loop_->BelongsToCurrentThread()) {
63 io_message_loop_->DeleteSoon(FROM_HERE, this); 60 io_message_loop_->DeleteSoon(FROM_HERE, this);
64 return; 61 return;
65 } 62 }
66 delete this; 63 delete this;
67 } 64 }
68 65
69 } // namespace fileapi 66 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/sandboxed_file_system_context.h ('k') | webkit/fileapi/webkit_fileapi.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698