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

Side by Side Diff: webkit/quota/mock_storage_client.cc

Issue 7839029: QuotaManager::DeleteOriginData now allows deletion of specific QuotaClients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kinuko's feedback (modulo kMockStart) Created 8 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/quota/mock_storage_client.h ('k') | webkit/quota/quota_client.h » ('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) 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/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 } // anonymous namespace 44 } // anonymous namespace
45 45
46 MockStorageClient::MockStorageClient( 46 MockStorageClient::MockStorageClient(
47 QuotaManagerProxy* quota_manager_proxy, 47 QuotaManagerProxy* quota_manager_proxy,
48 const MockOriginData* mock_data, size_t mock_data_size) 48 const MockOriginData* mock_data, size_t mock_data_size)
49 : quota_manager_proxy_(quota_manager_proxy), 49 : quota_manager_proxy_(quota_manager_proxy),
50 id_(MockStorageClientIDSequencer::GetInstance()->NextMockID()), 50 id_(MockStorageClientIDSequencer::GetInstance()->NextMockID()),
51 mock_time_counter_(0), 51 mock_time_counter_(0),
52 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 52 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
53 Populate(mock_data, mock_data_size);
54 }
55
56 MockStorageClient::MockStorageClient(
57 QuotaManagerProxy* quota_manager_proxy,
58 const MockOriginData* mock_data, QuotaClient::ID id, size_t mock_data_size)
59 : quota_manager_proxy_(quota_manager_proxy),
60 id_(id),
61 mock_time_counter_(0),
62 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
63 Populate(mock_data, mock_data_size);
64 }
65
66 void MockStorageClient::Populate(
67 const MockOriginData* mock_data,
68 size_t mock_data_size) {
53 for (size_t i = 0; i < mock_data_size; ++i) { 69 for (size_t i = 0; i < mock_data_size; ++i) {
54 origin_data_[make_pair(GURL(mock_data[i].origin), mock_data[i].type)] = 70 origin_data_[make_pair(GURL(mock_data[i].origin), mock_data[i].type)] =
55 mock_data[i].usage; 71 mock_data[i].usage;
56 } 72 }
57 } 73 }
58 74
59 MockStorageClient::~MockStorageClient() {} 75 MockStorageClient::~MockStorageClient() {}
60 76
61 void MockStorageClient::AddOriginAndNotify( 77 void MockStorageClient::AddOriginAndNotify(
62 const GURL& origin_url, StorageType type, int64 size) { 78 const GURL& origin_url, StorageType type, int64 size) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 int64 delta = itr->second; 209 int64 delta = itr->second;
194 quota_manager_proxy_-> 210 quota_manager_proxy_->
195 NotifyStorageModified(id(), origin_url, type, -delta); 211 NotifyStorageModified(id(), origin_url, type, -delta);
196 origin_data_.erase(itr); 212 origin_data_.erase(itr);
197 } 213 }
198 214
199 callback.Run(kQuotaStatusOk); 215 callback.Run(kQuotaStatusOk);
200 } 216 }
201 217
202 } // namespace quota 218 } // namespace quota
OLDNEW
« no previous file with comments | « webkit/quota/mock_storage_client.h ('k') | webkit/quota/quota_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698