OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "IDBDatabaseBackendProxy.h" | 27 #include "IDBDatabaseBackendProxy.h" |
28 | 28 |
29 #include "WebFrameImpl.h" | 29 #include "WebFrameImpl.h" |
30 #include "WebIDBCallbacksImpl.h" | 30 #include "WebIDBCallbacksImpl.h" |
31 #include "WebIDBDatabaseCallbacksImpl.h" | 31 #include "WebIDBDatabaseCallbacksImpl.h" |
32 #include "core/dom/DOMError.h" | 32 #include "core/dom/DOMError.h" |
33 #include "modules/indexeddb/IDBCallbacks.h" | 33 #include "modules/indexeddb/IDBCallbacks.h" |
34 #include "modules/indexeddb/IDBDatabaseCallbacks.h" | 34 #include "modules/indexeddb/IDBDatabaseCallbacks.h" |
35 #include "modules/indexeddb/IDBKeyRange.h" | 35 #include "modules/indexeddb/IDBKeyRange.h" |
36 #include "modules/indexeddb/IDBMetadata.h" | 36 #include "modules/indexeddb/IDBMetadata.h" |
| 37 #include "public/platform/WebBlobInfo.h" |
37 #include "public/platform/WebData.h" | 38 #include "public/platform/WebData.h" |
38 #include "public/platform/WebIDBCursor.h" | 39 #include "public/platform/WebIDBCursor.h" |
39 #include "public/platform/WebIDBDatabase.h" | 40 #include "public/platform/WebIDBDatabase.h" |
40 #include "public/platform/WebIDBDatabaseError.h" | 41 #include "public/platform/WebIDBDatabaseError.h" |
41 #include "public/platform/WebIDBKeyRange.h" | 42 #include "public/platform/WebIDBKeyRange.h" |
42 | 43 |
43 using namespace WebCore; | 44 using namespace WebCore; |
44 | 45 |
45 namespace WebKit { | 46 namespace WebKit { |
46 | 47 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if (m_webIDBDatabase) | 97 if (m_webIDBDatabase) |
97 m_webIDBDatabase->count(transactionId, objectStoreId, indexId, keyRange,
new WebIDBCallbacksImpl(callbacks)); | 98 m_webIDBDatabase->count(transactionId, objectStoreId, indexId, keyRange,
new WebIDBCallbacksImpl(callbacks)); |
98 } | 99 } |
99 | 100 |
100 void IDBDatabaseBackendProxy::get(int64_t transactionId, int64_t objectStoreId,
int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBC
allbacks> callbacks) | 101 void IDBDatabaseBackendProxy::get(int64_t transactionId, int64_t objectStoreId,
int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBC
allbacks> callbacks) |
101 { | 102 { |
102 if (m_webIDBDatabase) | 103 if (m_webIDBDatabase) |
103 m_webIDBDatabase->get(transactionId, objectStoreId, indexId, keyRange, k
eyOnly, new WebIDBCallbacksImpl(callbacks)); | 104 m_webIDBDatabase->get(transactionId, objectStoreId, indexId, keyRange, k
eyOnly, new WebIDBCallbacksImpl(callbacks)); |
104 } | 105 } |
105 | 106 |
106 void IDBDatabaseBackendProxy::put(int64_t transactionId, int64_t objectStoreId,
PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRef
Ptr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<Index
Keys>& indexKeys) | 107 void IDBDatabaseBackendProxy::put(int64_t transactionId, int64_t objectStoreId,
PassRefPtr<SharedBuffer> value, const Vector<WebCore::BlobInfo>* blobInfo, PassR
efPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Ve
ctor<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys) |
107 { | 108 { |
108 if (m_webIDBDatabase) { | 109 if (m_webIDBDatabase) { |
109 m_webIDBDatabase->put(transactionId, objectStoreId, WebData(value), key,
static_cast<WebIDBDatabase::PutMode>(putMode), new WebIDBCallbacksImpl(callback
s), indexIds, indexKeys); | 110 size_t blobCount = blobInfo ? blobInfo->size() : 0; |
| 111 WebVector<WebBlobInfo> webBlobInfo(blobCount); |
| 112 for (size_t i = 0; i < blobCount; ++i) { |
| 113 const WebCore::BlobInfo& info = (*blobInfo)[i]; |
| 114 if (info.isFile()) |
| 115 webBlobInfo[i] = WebBlobInfo(WebString(), info.filePath(), info.
fileName(), info.type()); |
| 116 else |
| 117 webBlobInfo[i] = WebBlobInfo(info.url(), info.type(), info.size(
)); |
| 118 } |
| 119 |
| 120 m_webIDBDatabase->put(transactionId, objectStoreId, WebData(value), webB
lobInfo, key, static_cast<WebIDBDatabase::PutMode>(putMode), new WebIDBCallbacks
Impl(callbacks), indexIds, indexKeys); |
110 } | 121 } |
111 } | 122 } |
112 | 123 |
113 void IDBDatabaseBackendProxy::setIndexKeys(int64_t transactionId, int64_t object
StoreId, PassRefPtr<IDBKey> primaryKey, const Vector<int64_t>& indexIds, const V
ector<IndexKeys>& indexKeys) | 124 void IDBDatabaseBackendProxy::setIndexKeys(int64_t transactionId, int64_t object
StoreId, PassRefPtr<IDBKey> primaryKey, const Vector<int64_t>& indexIds, const V
ector<IndexKeys>& indexKeys) |
114 { | 125 { |
115 if (m_webIDBDatabase) | 126 if (m_webIDBDatabase) |
116 m_webIDBDatabase->setIndexKeys(transactionId, objectStoreId, primaryKey,
indexIds, indexKeys); | 127 m_webIDBDatabase->setIndexKeys(transactionId, objectStoreId, primaryKey,
indexIds, indexKeys); |
117 } | 128 } |
118 | 129 |
119 void IDBDatabaseBackendProxy::setIndexesReady(int64_t transactionId, int64_t obj
ectStoreId, const Vector<int64_t>& indexIds) | 130 void IDBDatabaseBackendProxy::setIndexesReady(int64_t transactionId, int64_t obj
ectStoreId, const Vector<int64_t>& indexIds) |
(...skipping 25 matching lines...) Expand all Loading... |
145 if (m_webIDBDatabase) | 156 if (m_webIDBDatabase) |
146 m_webIDBDatabase->deleteIndex(transactionId, objectStoreId, indexId); | 157 m_webIDBDatabase->deleteIndex(transactionId, objectStoreId, indexId); |
147 } | 158 } |
148 | 159 |
149 void IDBDatabaseBackendProxy::close(PassRefPtr<IDBDatabaseCallbacks>) | 160 void IDBDatabaseBackendProxy::close(PassRefPtr<IDBDatabaseCallbacks>) |
150 { | 161 { |
151 m_webIDBDatabase->close(); | 162 m_webIDBDatabase->close(); |
152 } | 163 } |
153 | 164 |
154 } // namespace WebKit | 165 } // namespace WebKit |
OLD | NEW |