Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/quota/quota_manager.h" | 5 #include "webkit/quota/quota_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 QuotaManager* manager, const std::string& host, StorageType type); | 78 QuotaManager* manager, const std::string& host, StorageType type); |
| 79 | 79 |
| 80 // Returns true if it is the first call for this task; which means | 80 // Returns true if it is the first call for this task; which means |
| 81 // the caller needs to call Start(). | 81 // the caller needs to call Start(). |
| 82 bool AddCallback(GetUsageAndQuotaCallback* callback) { | 82 bool AddCallback(GetUsageAndQuotaCallback* callback) { |
| 83 callbacks_.push_back(callback); | 83 callbacks_.push_back(callback); |
| 84 return (callbacks_.size() == 1); | 84 return (callbacks_.size() == 1); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void DidGetGlobalUsage(int64 usage) { | 87 void DidGetGlobalUsage(int64 usage) { |
| 88 DCHECK_GE(usage, 0); | |
|
kinuko
2011/05/24 05:31:36
fyi: the latest manager code can handle usage <= 0
| |
| 88 global_usage_ = usage; | 89 global_usage_ = usage; |
| 89 CheckCompleted(); | 90 CheckCompleted(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void DidGetHostUsage(const std::string& host_unused, int64 usage) { | 93 void DidGetHostUsage(const std::string& host_unused, int64 usage) { |
| 94 DCHECK_GE(usage, 0); | |
| 93 host_usage_ = usage; | 95 host_usage_ = usage; |
| 94 CheckCompleted(); | 96 CheckCompleted(); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void DidGetGlobalQuota(QuotaStatusCode status, int64 quota) { | 99 void DidGetGlobalQuota(QuotaStatusCode status, int64 quota) { |
| 98 quota_status_ = status; | 100 quota_status_ = status; |
| 99 quota_ = quota; | 101 quota_ = quota; |
| 100 CheckCompleted(); | 102 CheckCompleted(); |
| 101 } | 103 } |
| 102 | 104 |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1119 | 1121 |
| 1120 QuotaManagerProxy::QuotaManagerProxy( | 1122 QuotaManagerProxy::QuotaManagerProxy( |
| 1121 QuotaManager* manager, base::MessageLoopProxy* io_thread) | 1123 QuotaManager* manager, base::MessageLoopProxy* io_thread) |
| 1122 : manager_(manager), io_thread_(io_thread) { | 1124 : manager_(manager), io_thread_(io_thread) { |
| 1123 } | 1125 } |
| 1124 | 1126 |
| 1125 QuotaManagerProxy::~QuotaManagerProxy() { | 1127 QuotaManagerProxy::~QuotaManagerProxy() { |
| 1126 } | 1128 } |
| 1127 | 1129 |
| 1128 } // namespace quota | 1130 } // namespace quota |
| OLD | NEW |