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_quota_observer.h" | 5 #include "webkit/browser/fileapi/sandbox_quota_observer.h" |
6 | 6 |
7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
8 #include "webkit/browser/fileapi/file_system_url.h" | 8 #include "webkit/browser/fileapi/file_system_url.h" |
9 #include "webkit/browser/fileapi/file_system_usage_cache.h" | 9 #include "webkit/browser/fileapi/file_system_usage_cache.h" |
10 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h" | 10 #include "webkit/browser/fileapi/sandbox_mount_point_provider.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 FileSystemTypeToQuotaStorageType(url.type()), | 46 FileSystemTypeToQuotaStorageType(url.type()), |
47 delta); | 47 delta); |
48 } | 48 } |
49 | 49 |
50 base::FilePath usage_file_path = GetUsageCachePath(url); | 50 base::FilePath usage_file_path = GetUsageCachePath(url); |
51 if (usage_file_path.empty()) | 51 if (usage_file_path.empty()) |
52 return; | 52 return; |
53 | 53 |
54 pending_update_notification_[usage_file_path] += delta; | 54 pending_update_notification_[usage_file_path] += delta; |
55 if (!delayed_cache_update_helper_) { | 55 if (!delayed_cache_update_helper_) { |
56 delayed_cache_update_helper_.reset(new TimedTaskHelper( | 56 delayed_cache_update_helper_.reset( |
57 update_notify_runner_)); | 57 new TimedTaskHelper(update_notify_runner_.get())); |
58 delayed_cache_update_helper_->Start( | 58 delayed_cache_update_helper_->Start( |
59 FROM_HERE, | 59 FROM_HERE, |
60 base::TimeDelta(), // No delay. | 60 base::TimeDelta(), // No delay. |
61 base::Bind(&SandboxQuotaObserver::ApplyPendingUsageUpdate, | 61 base::Bind(&SandboxQuotaObserver::ApplyPendingUsageUpdate, |
62 base::Unretained(this))); | 62 base::Unretained(this))); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 void SandboxQuotaObserver::OnEndUpdate(const FileSystemURL& url) { | 66 void SandboxQuotaObserver::OnEndUpdate(const FileSystemURL& url) { |
67 DCHECK(update_notify_runner_->RunsTasksOnCurrentThread()); | 67 DCHECK(update_notify_runner_->RunsTasksOnCurrentThread()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 void SandboxQuotaObserver::UpdateUsageCacheFile( | 131 void SandboxQuotaObserver::UpdateUsageCacheFile( |
132 const base::FilePath& usage_file_path, | 132 const base::FilePath& usage_file_path, |
133 int64 delta) { | 133 int64 delta) { |
134 DCHECK(!usage_file_path.empty()); | 134 DCHECK(!usage_file_path.empty()); |
135 if (!usage_file_path.empty() && delta != 0) | 135 if (!usage_file_path.empty() && delta != 0) |
136 file_system_usage_cache_->AtomicUpdateUsageByDelta(usage_file_path, delta); | 136 file_system_usage_cache_->AtomicUpdateUsageByDelta(usage_file_path, delta); |
137 } | 137 } |
138 | 138 |
139 } // namespace fileapi | 139 } // namespace fileapi |
OLD | NEW |