OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * | 10 * |
(...skipping 15 matching lines...) Expand all Loading... | |
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #include "config.h" | 29 #include "config.h" |
30 #include "modules/indexeddb/WebIDBCallbacksImpl.h" | 30 #include "modules/indexeddb/WebIDBCallbacksImpl.h" |
31 | 31 |
32 #include "core/dom/DOMError.h" | 32 #include "core/dom/DOMError.h" |
33 #include "modules/indexeddb/IDBMetadata.h" | 33 #include "modules/indexeddb/IDBMetadata.h" |
34 #include "modules/indexeddb/IDBRequest.h" | 34 #include "modules/indexeddb/IDBRequest.h" |
35 #include "platform/SharedBuffer.h" | 35 #include "platform/SharedBuffer.h" |
36 #include "public/platform/WebBlobInfo.h" | |
36 #include "public/platform/WebData.h" | 37 #include "public/platform/WebData.h" |
37 #include "public/platform/WebIDBCursor.h" | 38 #include "public/platform/WebIDBCursor.h" |
38 #include "public/platform/WebIDBDatabase.h" | 39 #include "public/platform/WebIDBDatabase.h" |
39 #include "public/platform/WebIDBDatabaseError.h" | 40 #include "public/platform/WebIDBDatabaseError.h" |
40 #include "public/platform/WebIDBKey.h" | 41 #include "public/platform/WebIDBKey.h" |
41 | 42 |
43 using blink::WebBlobInfo; | |
42 using blink::WebData; | 44 using blink::WebData; |
43 using blink::WebIDBCursor; | 45 using blink::WebIDBCursor; |
44 using blink::WebIDBDatabase; | 46 using blink::WebIDBDatabase; |
45 using blink::WebIDBDatabaseError; | 47 using blink::WebIDBDatabaseError; |
46 using blink::WebIDBIndex; | 48 using blink::WebIDBIndex; |
47 using blink::WebIDBKey; | 49 using blink::WebIDBKey; |
48 using blink::WebIDBKeyPath; | 50 using blink::WebIDBKeyPath; |
49 using blink::WebIDBMetadata; | 51 using blink::WebIDBMetadata; |
52 using blink::WebVector; | |
50 | 53 |
51 namespace WebCore { | 54 namespace WebCore { |
52 | 55 |
56 | |
jsbell
2014/04/15 18:29:07
Remove this extra blank line
ericu
2014/04/16 23:04:14
Done.
| |
53 // static | 57 // static |
54 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(PassRefPtr<IDBReques t> request) | 58 PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(PassRefPtr<IDBReques t> request) |
55 { | 59 { |
56 return adoptPtr(new WebIDBCallbacksImpl(request)); | 60 return adoptPtr(new WebIDBCallbacksImpl(request)); |
57 } | 61 } |
58 | 62 |
59 WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBRequest> request) | 63 WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBRequest> request) |
60 : m_request(request) | 64 : m_request(request) |
61 { | 65 { |
62 } | 66 } |
63 | 67 |
64 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() | 68 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() |
65 { | 69 { |
66 } | 70 } |
67 | 71 |
72 static PassOwnPtr<Vector<WebBlobInfo> > ConvertBlobInfo(const WebVector<WebBlobI nfo>& webBlobInfo) | |
73 { | |
74 OwnPtr<Vector<WebBlobInfo> > blobInfo = adoptPtr(new Vector<WebBlobInfo>(web BlobInfo.size())); | |
75 for (size_t i = 0; i < webBlobInfo.size(); ++i) | |
76 (*blobInfo)[i] = webBlobInfo[i]; | |
77 return blobInfo.release(); | |
78 } | |
79 | |
68 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) | 80 void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error) |
69 { | 81 { |
70 m_request->onError(error); | 82 m_request->onError(error); |
71 } | 83 } |
72 | 84 |
73 void WebIDBCallbacksImpl::onSuccess(const blink::WebVector<blink::WebString>& we bStringList) | 85 void WebIDBCallbacksImpl::onSuccess(const WebVector<blink::WebString>& webString List) |
74 { | 86 { |
75 Vector<String> stringList; | 87 Vector<String> stringList; |
76 for (size_t i = 0; i < webStringList.size(); ++i) | 88 for (size_t i = 0; i < webStringList.size(); ++i) |
77 stringList.append(webStringList[i]); | 89 stringList.append(webStringList[i]); |
78 m_request->onSuccess(stringList); | 90 m_request->onSuccess(stringList); |
79 } | 91 } |
80 | 92 |
81 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebData& value) | 93 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebData& value) |
82 { | 94 { |
83 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, value); | 95 OwnPtr<Vector<blink::WebBlobInfo> > blobInfo(adoptPtr(new Vector<blink::WebB lobInfo>())); |
96 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, value, blobInfo.rele ase()); | |
97 } | |
98 | |
99 void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebData& value, const WebVector<WebBlobInfo>& webBlobInfo) | |
100 { | |
101 m_request->onSuccess(adoptPtr(cursor), key, primaryKey, value, ConvertBlobIn fo(webBlobInfo)); | |
84 } | 102 } |
85 | 103 |
86 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat a& metadata) | 104 void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadat a& metadata) |
87 { | 105 { |
88 m_request->onSuccess(adoptPtr(backend), metadata); | 106 m_request->onSuccess(adoptPtr(backend), metadata); |
89 } | 107 } |
90 | 108 |
91 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) | 109 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key) |
92 { | 110 { |
93 m_request->onSuccess(key); | 111 m_request->onSuccess(key); |
94 } | 112 } |
95 | 113 |
96 void WebIDBCallbacksImpl::onSuccess(const WebData& value) | 114 void WebIDBCallbacksImpl::onSuccess(const WebData& value) |
97 { | 115 { |
98 m_request->onSuccess(value); | 116 OwnPtr<Vector<blink::WebBlobInfo> > blobInfo(adoptPtr(new Vector<blink::WebB lobInfo>())); |
117 m_request->onSuccess(value, blobInfo.release()); | |
118 } | |
119 | |
120 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebVector<WebBlo bInfo>& webBlobInfo) | |
121 { | |
122 m_request->onSuccess(value, ConvertBlobInfo(webBlobInfo)); | |
99 } | 123 } |
100 | 124 |
101 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebIDBKey& key, const WebIDBKeyPath& keyPath) | 125 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebIDBKey& key, const WebIDBKeyPath& keyPath) |
102 { | 126 { |
103 m_request->onSuccess(value, key, keyPath); | 127 OwnPtr<Vector<blink::WebBlobInfo> > blobInfo(adoptPtr(new Vector<blink::WebB lobInfo>())); |
128 m_request->onSuccess(value, blobInfo.release(), key, keyPath); | |
129 } | |
130 | |
131 void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebVector<WebBlo bInfo>& webBlobInfo, const WebIDBKey& key, const WebIDBKeyPath& keyPath) | |
132 { | |
133 m_request->onSuccess(value, ConvertBlobInfo(webBlobInfo), key, keyPath); | |
104 } | 134 } |
105 | 135 |
106 void WebIDBCallbacksImpl::onSuccess(long long value) | 136 void WebIDBCallbacksImpl::onSuccess(long long value) |
107 { | 137 { |
108 m_request->onSuccess(value); | 138 m_request->onSuccess(value); |
109 } | 139 } |
110 | 140 |
111 void WebIDBCallbacksImpl::onSuccess() | 141 void WebIDBCallbacksImpl::onSuccess() |
112 { | 142 { |
113 m_request->onSuccess(); | 143 m_request->onSuccess(); |
114 } | 144 } |
115 | 145 |
116 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima ryKey, const WebData& value) | 146 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima ryKey, const WebData& value) |
117 { | 147 { |
118 m_request->onSuccess(key, primaryKey, value); | 148 OwnPtr<Vector<blink::WebBlobInfo> > blobInfo(adoptPtr(new Vector<blink::WebB lobInfo>())); |
149 m_request->onSuccess(key, primaryKey, value, blobInfo.release()); | |
150 } | |
151 | |
152 void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& prima ryKey, const WebData& value, const WebVector<WebBlobInfo>& webBlobInfo) | |
153 { | |
154 m_request->onSuccess(key, primaryKey, value, ConvertBlobInfo(webBlobInfo)); | |
119 } | 155 } |
120 | 156 |
121 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) | 157 void WebIDBCallbacksImpl::onBlocked(long long oldVersion) |
122 { | 158 { |
123 m_request->onBlocked(oldVersion); | 159 m_request->onBlocked(oldVersion); |
124 } | 160 } |
125 | 161 |
126 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, blink::WebStr ing dataLossMessage) | 162 void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, blink::WebStr ing dataLossMessage) |
127 { | 163 { |
128 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), metadata, static_ cast<blink::WebIDBDataLoss>(dataLoss), dataLossMessage); | 164 m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), metadata, static_ cast<blink::WebIDBDataLoss>(dataLoss), dataLossMessage); |
129 } | 165 } |
130 | 166 |
131 } // namespace blink | 167 } // namespace blink |
OLD | NEW |