OLD | NEW |
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" | 9 #include "wtf/Forward.h" |
10 #include "wtf/OwnPtr.h" | 10 #include "wtf/OwnPtr.h" |
11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
12 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
13 #include "wtf/RefCounted.h" | 13 #include "wtf/RefCounted.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class WebStorageQuotaCallbacksPrivate : public RefCounted<WebStorageQuotaCallbac
ksPrivate> { | 17 class WebStorageQuotaCallbacksPrivate : public RefCounted<WebStorageQuotaCallbac
ksPrivate> { |
18 public: | 18 public: |
19 static PassRefPtr<WebStorageQuotaCallbacksPrivate> create(const PassOwnPtr<b
link::StorageQuotaCallbacks>& callbacks) | 19 static PassRefPtr<WebStorageQuotaCallbacksPrivate> create(const PassOwnPtr<S
torageQuotaCallbacks>& callbacks) |
20 { | 20 { |
21 return adoptRef(new WebStorageQuotaCallbacksPrivate(callbacks)); | 21 return adoptRef(new WebStorageQuotaCallbacksPrivate(callbacks)); |
22 } | 22 } |
23 | 23 |
24 blink::StorageQuotaCallbacks* callbacks() { return m_callbacks.get(); } | 24 StorageQuotaCallbacks* callbacks() { return m_callbacks.get(); } |
25 | 25 |
26 private: | 26 private: |
27 WebStorageQuotaCallbacksPrivate(const PassOwnPtr<blink::StorageQuotaCallback
s>& callbacks) : m_callbacks(callbacks) { } | 27 WebStorageQuotaCallbacksPrivate(const PassOwnPtr<StorageQuotaCallbacks>& cal
lbacks) : m_callbacks(callbacks) { } |
28 OwnPtr<blink::StorageQuotaCallbacks> m_callbacks; | 28 OwnPtr<StorageQuotaCallbacks> m_callbacks; |
29 }; | 29 }; |
30 | 30 |
31 WebStorageQuotaCallbacks::WebStorageQuotaCallbacks(const PassOwnPtr<blink::Stora
geQuotaCallbacks>& callbacks) | 31 WebStorageQuotaCallbacks::WebStorageQuotaCallbacks(const PassOwnPtr<StorageQuota
Callbacks>& callbacks) |
32 { | 32 { |
33 m_private = WebStorageQuotaCallbacksPrivate::create(callbacks); | 33 m_private = WebStorageQuotaCallbacksPrivate::create(callbacks); |
34 } | 34 } |
35 | 35 |
36 void WebStorageQuotaCallbacks::reset() | 36 void WebStorageQuotaCallbacks::reset() |
37 { | 37 { |
38 m_private.reset(); | 38 m_private.reset(); |
39 } | 39 } |
40 | 40 |
41 void WebStorageQuotaCallbacks::assign(const WebStorageQuotaCallbacks& other) | 41 void WebStorageQuotaCallbacks::assign(const WebStorageQuotaCallbacks& other) |
(...skipping 16 matching lines...) Expand all Loading... |
58 } | 58 } |
59 | 59 |
60 void WebStorageQuotaCallbacks::didFail(WebStorageQuotaError error) | 60 void WebStorageQuotaCallbacks::didFail(WebStorageQuotaError error) |
61 { | 61 { |
62 ASSERT(!m_private.isNull()); | 62 ASSERT(!m_private.isNull()); |
63 m_private->callbacks()->didFail(error); | 63 m_private->callbacks()->didFail(error); |
64 m_private.reset(); | 64 m_private.reset(); |
65 } | 65 } |
66 | 66 |
67 } // namespace blink | 67 } // namespace blink |
OLD | NEW |