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/mock_storage_client.h" | 5 #include "webkit/quota/mock_storage_client.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 MockStorageClient::~MockStorageClient() { | 58 MockStorageClient::~MockStorageClient() { |
59 STLDeleteContainerPointers(usage_callbacks_.begin(), usage_callbacks_.end()); | 59 STLDeleteContainerPointers(usage_callbacks_.begin(), usage_callbacks_.end()); |
60 STLDeleteContainerPointers( | 60 STLDeleteContainerPointers( |
61 origins_callbacks_.begin(), origins_callbacks_.end()); | 61 origins_callbacks_.begin(), origins_callbacks_.end()); |
62 STLDeleteContainerPointers( | 62 STLDeleteContainerPointers( |
63 deletion_callbacks_.begin(), deletion_callbacks_.end()); | 63 deletion_callbacks_.begin(), deletion_callbacks_.end()); |
64 } | 64 } |
65 | 65 |
| 66 void MockStorageClient::NotifyAllOrigins() { |
| 67 for (OriginDataMap::const_iterator itr = origin_data_.begin(); |
| 68 itr != origin_data_.end(); |
| 69 ++itr) { |
| 70 quota_manager_proxy_->quota_manager()->NotifyStorageModifiedInternal( |
| 71 id(), itr->first.first, itr->first.second, 0, IncrementMockTime()); |
| 72 } |
| 73 } |
| 74 |
66 void MockStorageClient::AddOriginAndNotify( | 75 void MockStorageClient::AddOriginAndNotify( |
67 const GURL& origin_url, StorageType type, int64 size) { | 76 const GURL& origin_url, StorageType type, int64 size) { |
68 DCHECK(origin_data_.find(make_pair(origin_url, type)) == origin_data_.end()); | 77 DCHECK(origin_data_.find(make_pair(origin_url, type)) == origin_data_.end()); |
69 DCHECK_GE(size, 0); | 78 DCHECK_GE(size, 0); |
70 origin_data_[make_pair(origin_url, type)] = size; | 79 origin_data_[make_pair(origin_url, type)] = size; |
71 quota_manager_proxy_->quota_manager()->NotifyStorageModifiedInternal( | 80 quota_manager_proxy_->quota_manager()->NotifyStorageModifiedInternal( |
72 id(), origin_url, type, size, IncrementMockTime()); | 81 id(), origin_url, type, size, IncrementMockTime()); |
73 } | 82 } |
74 | 83 |
75 void MockStorageClient::ModifyOriginAndNotify( | 84 void MockStorageClient::ModifyOriginAndNotify( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 quota_manager_proxy_-> | 210 quota_manager_proxy_-> |
202 NotifyStorageModified(id(), origin_url, type, -delta); | 211 NotifyStorageModified(id(), origin_url, type, -delta); |
203 origin_data_.erase(itr); | 212 origin_data_.erase(itr); |
204 } | 213 } |
205 | 214 |
206 deletion_callbacks_.erase(callback_ptr); | 215 deletion_callbacks_.erase(callback_ptr); |
207 callback->Run(kQuotaStatusOk); | 216 callback->Run(kQuotaStatusOk); |
208 } | 217 } |
209 | 218 |
210 } // namespace quota | 219 } // namespace quota |
OLD | NEW |