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

Side by Side Diff: Source/platform/exported/WebStorageQuotaCallbacks.cpp

Issue 676183002: Oilpan: simplify quota storage callbacks objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/platform/StorageQuotaCallbacks.h ('k') | Source/web/StorageQuotaClientImpl.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 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 "config.h" 5 #include "config.h"
6 #include "public/platform/WebStorageQuotaCallbacks.h" 6 #include "public/platform/WebStorageQuotaCallbacks.h"
7 7
8 #include "platform/StorageQuotaCallbacks.h" 8 #include "platform/StorageQuotaCallbacks.h"
9 #include "wtf/Forward.h"
10 #include "wtf/OwnPtr.h"
11 #include "wtf/PassOwnPtr.h"
12 #include "wtf/PassRefPtr.h"
13 #include "wtf/RefCounted.h"
14 9
15 namespace blink { 10 namespace blink {
16 11
17 class WebStorageQuotaCallbacksPrivate final : public RefCountedWillBeGarbageColl ected<WebStorageQuotaCallbacksPrivate> { 12 WebStorageQuotaCallbacks::WebStorageQuotaCallbacks(StorageQuotaCallbacks* callba cks)
18 public: 13 : m_private(callbacks)
19 static PassRefPtrWillBeRawPtr<WebStorageQuotaCallbacksPrivate> create(const PassOwnPtrWillBeRawPtr<StorageQuotaCallbacks>& callbacks)
20 {
21 return adoptRefWillBeNoop(new WebStorageQuotaCallbacksPrivate(callbacks) );
22 }
23
24 void trace(Visitor*);
25
26 StorageQuotaCallbacks* callbacks() { return m_callbacks.get(); }
27
28 private:
29 WebStorageQuotaCallbacksPrivate(const PassOwnPtrWillBeRawPtr<StorageQuotaCal lbacks>& callbacks) : m_callbacks(callbacks) { }
30 OwnPtrWillBeMember<StorageQuotaCallbacks> m_callbacks;
31 };
32
33 void WebStorageQuotaCallbacksPrivate::trace(Visitor* visitor)
34 { 14 {
35 visitor->trace(m_callbacks);
36 }
37
38 WebStorageQuotaCallbacks::WebStorageQuotaCallbacks(const PassOwnPtrWillBeRawPtr< StorageQuotaCallbacks>& callbacks)
39 {
40 m_private = WebStorageQuotaCallbacksPrivate::create(callbacks);
41 } 15 }
42 16
43 void WebStorageQuotaCallbacks::reset() 17 void WebStorageQuotaCallbacks::reset()
44 { 18 {
45 m_private.reset(); 19 m_private.reset();
46 } 20 }
47 21
48 void WebStorageQuotaCallbacks::assign(const WebStorageQuotaCallbacks& other) 22 void WebStorageQuotaCallbacks::assign(const WebStorageQuotaCallbacks& other)
49 { 23 {
50 m_private = other.m_private; 24 m_private = other.m_private;
51 } 25 }
52 26
53 void WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota(unsigned long long u sageInBytes, unsigned long long quotaInBytes) 27 void WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota(unsigned long long u sageInBytes, unsigned long long quotaInBytes)
54 { 28 {
55 ASSERT(!m_private.isNull()); 29 ASSERT(!m_private.isNull());
56 m_private->callbacks()->didQueryStorageUsageAndQuota(usageInBytes, quotaInBy tes); 30 m_private->didQueryStorageUsageAndQuota(usageInBytes, quotaInBytes);
57 m_private.reset(); 31 m_private.reset();
58 } 32 }
59 33
60 void WebStorageQuotaCallbacks::didGrantStorageQuota(unsigned long long usageInBy tes, unsigned long long grantedQuotaInBytes) 34 void WebStorageQuotaCallbacks::didGrantStorageQuota(unsigned long long usageInBy tes, unsigned long long grantedQuotaInBytes)
61 { 35 {
62 ASSERT(!m_private.isNull()); 36 ASSERT(!m_private.isNull());
63 m_private->callbacks()->didGrantStorageQuota(usageInBytes, grantedQuotaInByt es); 37 m_private->didGrantStorageQuota(usageInBytes, grantedQuotaInBytes);
64 m_private.reset(); 38 m_private.reset();
65 } 39 }
66 40
67 void WebStorageQuotaCallbacks::didFail(WebStorageQuotaError error) 41 void WebStorageQuotaCallbacks::didFail(WebStorageQuotaError error)
68 { 42 {
69 ASSERT(!m_private.isNull()); 43 ASSERT(!m_private.isNull());
70 m_private->callbacks()->didFail(error); 44 m_private->didFail(error);
71 m_private.reset(); 45 m_private.reset();
72 } 46 }
73 47
74 } // namespace blink 48 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/StorageQuotaCallbacks.h ('k') | Source/web/StorageQuotaClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698