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 27 matching lines...) Expand all Loading... |
38 #include "modules/indexeddb/IDBCursor.h" | 38 #include "modules/indexeddb/IDBCursor.h" |
39 #include "modules/indexeddb/IDBDatabaseBackendInterface.h" | 39 #include "modules/indexeddb/IDBDatabaseBackendInterface.h" |
40 #include "modules/indexeddb/IDBKeyRange.h" | 40 #include "modules/indexeddb/IDBKeyRange.h" |
41 #include "modules/indexeddb/IDBMetadata.h" | 41 #include "modules/indexeddb/IDBMetadata.h" |
42 #include "public/WebData.h" | 42 #include "public/WebData.h" |
43 | 43 |
44 using namespace WebCore; | 44 using namespace WebCore; |
45 | 45 |
46 namespace WebKit { | 46 namespace WebKit { |
47 | 47 |
48 WebIDBDatabaseImpl::WebIDBDatabaseImpl(PassRefPtr<IDBDatabaseBackendInterface> d
atabaseBackend, WTF::PassRefPtr<IDBDatabaseCallbacksProxy> databaseCallbacks) | 48 WebIDBDatabaseImpl::WebIDBDatabaseImpl(IDBDatabaseBackendInterface* databaseBack
end, IDBDatabaseCallbacksProxy* databaseCallbacks) |
49 : m_databaseBackend(databaseBackend) | 49 : m_databaseBackend(databaseBackend) |
50 , m_databaseCallbacks(databaseCallbacks) | 50 , m_databaseCallbacks(databaseCallbacks) |
51 { | 51 { |
52 } | 52 } |
53 | 53 |
54 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() | 54 WebIDBDatabaseImpl::~WebIDBDatabaseImpl() |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 void WebIDBDatabaseImpl::createObjectStore(long long transactionId, long long ob
jectStoreId, const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncre
ment) | 58 void WebIDBDatabaseImpl::createObjectStore(long long transactionId, long long ob
jectStoreId, const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncre
ment) |
59 { | 59 { |
60 m_databaseBackend->createObjectStore(transactionId, objectStoreId, name, key
Path, autoIncrement); | 60 m_databaseBackend->createObjectStore(transactionId, objectStoreId, name, key
Path, autoIncrement); |
61 } | 61 } |
62 | 62 |
63 void WebIDBDatabaseImpl::deleteObjectStore(long long transactionId, long long ob
jectStoreId) | 63 void WebIDBDatabaseImpl::deleteObjectStore(long long transactionId, long long ob
jectStoreId) |
64 { | 64 { |
65 m_databaseBackend->deleteObjectStore(transactionId, objectStoreId); | 65 m_databaseBackend->deleteObjectStore(transactionId, objectStoreId); |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 void WebIDBDatabaseImpl::createTransaction(long long id, WebIDBDatabaseCallbacks
* callbacks, const WebVector<long long>& objectStoreIds, unsigned short mode) | 69 void WebIDBDatabaseImpl::createTransaction(long long id, WebIDBDatabaseCallbacks
* callbacks, const WebVector<long long>& objectStoreIds, unsigned short mode) |
70 { | 70 { |
71 Vector<int64_t> objectStoreIdList(objectStoreIds.size()); | 71 Vector<int64_t> objectStoreIdList(objectStoreIds.size()); |
72 for (size_t i = 0; i < objectStoreIds.size(); ++i) | 72 for (size_t i = 0; i < objectStoreIds.size(); ++i) |
73 objectStoreIdList[i] = objectStoreIds[i]; | 73 objectStoreIdList[i] = objectStoreIds[i]; |
74 RefPtr<IDBDatabaseCallbacksProxy> databaseCallbacksProxy = IDBDatabaseCallba
cksProxy::create(adoptPtr(callbacks)); | 74 IDBDatabaseCallbacksProxy* databaseCallbacksProxy = IDBDatabaseCallbacksProx
y::create(adoptPtr(callbacks)); |
75 m_databaseBackend->createTransaction(id, databaseCallbacksProxy.get(), objec
tStoreIdList, mode); | 75 m_databaseBackend->createTransaction(id, databaseCallbacksProxy, objectStore
IdList, mode); |
76 } | 76 } |
77 | 77 |
78 void WebIDBDatabaseImpl::close() | 78 void WebIDBDatabaseImpl::close() |
79 { | 79 { |
80 // Use the callbacks passed in to the constructor so that the backend in | 80 // Use the callbacks passed in to the constructor so that the backend in |
81 // multi-process chromium knows which database connection is closing. | 81 // multi-process chromium knows which database connection is closing. |
82 if (!m_databaseCallbacks) | 82 if (!m_databaseCallbacks) |
83 return; | 83 return; |
84 m_databaseBackend->close(m_databaseCallbacks.release()); | 84 m_databaseBackend->close(m_databaseCallbacks.clear()); |
85 } | 85 } |
86 | 86 |
87 void WebIDBDatabaseImpl::forceClose() | 87 void WebIDBDatabaseImpl::forceClose() |
88 { | 88 { |
89 if (!m_databaseCallbacks) | 89 if (!m_databaseCallbacks) |
90 return; | 90 return; |
91 RefPtr<IDBDatabaseCallbacksProxy> callbacks = m_databaseCallbacks.release(); | 91 IDBDatabaseCallbacksProxy* callbacks = m_databaseCallbacks.clear(); |
92 m_databaseBackend->close(callbacks); | 92 m_databaseBackend->close(callbacks); |
93 callbacks->onForcedClose(); | 93 callbacks->onForcedClose(); |
94 } | 94 } |
95 | 95 |
96 void WebIDBDatabaseImpl::abort(long long transactionId) | 96 void WebIDBDatabaseImpl::abort(long long transactionId) |
97 { | 97 { |
98 if (m_databaseBackend) | 98 if (m_databaseBackend) |
99 m_databaseBackend->abort(transactionId); | 99 m_databaseBackend->abort(transactionId); |
100 } | 100 } |
101 | 101 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 m_databaseBackend->createIndex(transactionId, objectStoreId, indexId, na
me, keyPath, unique, multiEntry); | 201 m_databaseBackend->createIndex(transactionId, objectStoreId, indexId, na
me, keyPath, unique, multiEntry); |
202 } | 202 } |
203 | 203 |
204 void WebIDBDatabaseImpl::deleteIndex(long long transactionId, long long objectSt
oreId, long long indexId) | 204 void WebIDBDatabaseImpl::deleteIndex(long long transactionId, long long objectSt
oreId, long long indexId) |
205 { | 205 { |
206 if (m_databaseBackend) | 206 if (m_databaseBackend) |
207 m_databaseBackend->deleteIndex(transactionId, objectStoreId, indexId); | 207 m_databaseBackend->deleteIndex(transactionId, objectStoreId, indexId); |
208 } | 208 } |
209 | 209 |
210 } // namespace WebKit | 210 } // namespace WebKit |
OLD | NEW |