OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "storage/browser/quota/quota_manager_proxy.h" | 5 #include "storage/browser/quota/quota_manager_proxy.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
15 #include "base/trace_event/trace_event.h" | 15 #include "base/trace_event/trace_event.h" |
16 | 16 |
17 namespace storage { | 17 namespace storage { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 void DidGetUsageAndQuota( | 21 void DidGetUsageAndQuota( |
22 base::SequencedTaskRunner* original_task_runner, | 22 base::SequencedTaskRunner* original_task_runner, |
23 const QuotaManagerProxy::GetUsageAndQuotaCallback& callback, | 23 const QuotaManagerProxy::UsageAndQuotaCallback& callback, |
24 QuotaStatusCode status, | 24 QuotaStatusCode status, |
25 int64_t usage, | 25 int64_t usage, |
26 int64_t quota) { | 26 int64_t quota) { |
27 if (!original_task_runner->RunsTasksOnCurrentThread()) { | 27 if (!original_task_runner->RunsTasksOnCurrentThread()) { |
28 original_task_runner->PostTask( | 28 original_task_runner->PostTask( |
29 FROM_HERE, base::Bind(&DidGetUsageAndQuota, | 29 FROM_HERE, base::Bind(&DidGetUsageAndQuota, |
30 base::RetainedRef(original_task_runner), callback, | 30 base::RetainedRef(original_task_runner), callback, |
31 status, usage, quota)); | 31 status, usage, quota)); |
32 return; | 32 return; |
33 } | 33 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 return; | 123 return; |
124 } | 124 } |
125 if (manager_) | 125 if (manager_) |
126 manager_->SetUsageCacheEnabled(client_id, origin, type, enabled); | 126 manager_->SetUsageCacheEnabled(client_id, origin, type, enabled); |
127 } | 127 } |
128 | 128 |
129 void QuotaManagerProxy::GetUsageAndQuota( | 129 void QuotaManagerProxy::GetUsageAndQuota( |
130 base::SequencedTaskRunner* original_task_runner, | 130 base::SequencedTaskRunner* original_task_runner, |
131 const GURL& origin, | 131 const GURL& origin, |
132 StorageType type, | 132 StorageType type, |
133 const GetUsageAndQuotaCallback& callback) { | 133 const UsageAndQuotaCallback& callback) { |
134 if (!io_thread_->BelongsToCurrentThread()) { | 134 if (!io_thread_->BelongsToCurrentThread()) { |
135 io_thread_->PostTask( | 135 io_thread_->PostTask( |
136 FROM_HERE, base::Bind(&QuotaManagerProxy::GetUsageAndQuota, this, | 136 FROM_HERE, base::Bind(&QuotaManagerProxy::GetUsageAndQuota, this, |
137 base::RetainedRef(original_task_runner), origin, | 137 base::RetainedRef(original_task_runner), origin, |
138 type, callback)); | 138 type, callback)); |
139 return; | 139 return; |
140 } | 140 } |
141 if (!manager_) { | 141 if (!manager_) { |
142 DidGetUsageAndQuota(original_task_runner, callback, kQuotaErrorAbort, 0, 0); | 142 DidGetUsageAndQuota(original_task_runner, callback, kQuotaErrorAbort, 0, 0); |
143 return; | 143 return; |
(...skipping 16 matching lines...) Expand all Loading... |
160 QuotaManagerProxy::QuotaManagerProxy( | 160 QuotaManagerProxy::QuotaManagerProxy( |
161 QuotaManager* manager, | 161 QuotaManager* manager, |
162 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread) | 162 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread) |
163 : manager_(manager), io_thread_(io_thread) { | 163 : manager_(manager), io_thread_(io_thread) { |
164 } | 164 } |
165 | 165 |
166 QuotaManagerProxy::~QuotaManagerProxy() { | 166 QuotaManagerProxy::~QuotaManagerProxy() { |
167 } | 167 } |
168 | 168 |
169 } // namespace storage | 169 } // namespace storage |
OLD | NEW |