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

Side by Side Diff: content/browser/quota/mock_quota_manager_proxy.cc

Issue 1636613002: [CacheStorage] Check quota before put operations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set quota per origin and fix order of operations error Created 4 years, 11 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
OLDNEW
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 "content/browser/quota/mock_quota_manager_proxy.h" 5 #include "content/browser/quota/mock_quota_manager_proxy.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 18 matching lines...) Expand all
29 29
30 void MockQuotaManagerProxy::SimulateQuotaManagerDestroyed() { 30 void MockQuotaManagerProxy::SimulateQuotaManagerDestroyed() {
31 if (registered_client_) { 31 if (registered_client_) {
32 // We cannot call this in the destructor as the client (indirectly) 32 // We cannot call this in the destructor as the client (indirectly)
33 // holds a refptr of the proxy. 33 // holds a refptr of the proxy.
34 registered_client_->OnQuotaManagerDestroyed(); 34 registered_client_->OnQuotaManagerDestroyed();
35 registered_client_ = NULL; 35 registered_client_ = NULL;
36 } 36 }
37 } 37 }
38 38
39 void MockQuotaManagerProxy::GetUsageAndQuota(
40 base::SequencedTaskRunner* original_task_runner,
41 const GURL& origin,
42 StorageType type,
43 const QuotaManager::GetUsageAndQuotaCallback& callback) {
44 if (mock_manager()) {
45 mock_manager()->GetUsageAndQuota(origin, type, callback);
46 }
47 }
48
39 void MockQuotaManagerProxy::NotifyStorageAccessed( 49 void MockQuotaManagerProxy::NotifyStorageAccessed(
40 QuotaClient::ID client_id, const GURL& origin, StorageType type) { 50 QuotaClient::ID client_id, const GURL& origin, StorageType type) {
41 ++storage_accessed_count_; 51 ++storage_accessed_count_;
42 last_notified_origin_ = origin; 52 last_notified_origin_ = origin;
43 last_notified_type_ = type; 53 last_notified_type_ = type;
44 } 54 }
45 55
46 void MockQuotaManagerProxy::NotifyStorageModified(QuotaClient::ID client_id, 56 void MockQuotaManagerProxy::NotifyStorageModified(QuotaClient::ID client_id,
47 const GURL& origin, 57 const GURL& origin,
48 StorageType type, 58 StorageType type,
49 int64_t delta) { 59 int64_t delta) {
50 ++storage_modified_count_; 60 ++storage_modified_count_;
51 last_notified_origin_ = origin; 61 last_notified_origin_ = origin;
52 last_notified_type_ = type; 62 last_notified_type_ = type;
53 last_notified_delta_ = delta; 63 last_notified_delta_ = delta;
54 if (mock_manager()) 64 if (mock_manager())
55 mock_manager()->UpdateUsage(origin, type, delta); 65 mock_manager()->UpdateUsage(origin, type, delta);
56 } 66 }
57 67
58 MockQuotaManagerProxy::~MockQuotaManagerProxy() { 68 MockQuotaManagerProxy::~MockQuotaManagerProxy() {
59 DCHECK(!registered_client_); 69 DCHECK(!registered_client_);
60 } 70 }
61 71
62 } // namespace content 72 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/quota/mock_quota_manager_proxy.h ('k') | content/common/cache_storage/cache_storage_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698