| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #include "modules/indexeddb/IDBKeyRange.h" | 53 #include "modules/indexeddb/IDBKeyRange.h" |
| 54 #include "modules/indexeddb/IDBMetadata.h" | 54 #include "modules/indexeddb/IDBMetadata.h" |
| 55 #include "modules/indexeddb/IDBObjectStore.h" | 55 #include "modules/indexeddb/IDBObjectStore.h" |
| 56 #include "modules/indexeddb/IDBOpenDBRequest.h" | 56 #include "modules/indexeddb/IDBOpenDBRequest.h" |
| 57 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" | 57 #include "modules/indexeddb/IDBPendingTransactionMonitor.h" |
| 58 #include "modules/indexeddb/IDBRequest.h" | 58 #include "modules/indexeddb/IDBRequest.h" |
| 59 #include "modules/indexeddb/IDBTransaction.h" | 59 #include "modules/indexeddb/IDBTransaction.h" |
| 60 #include "platform/JSONValues.h" | 60 #include "platform/JSONValues.h" |
| 61 #include "platform/weborigin/SecurityOrigin.h" | 61 #include "platform/weborigin/SecurityOrigin.h" |
| 62 #include "public/platform/WebIDBCursor.h" | 62 #include "public/platform/WebIDBCursor.h" |
| 63 #include "public/platform/WebIDBTypes.h" |
| 63 #include "wtf/Vector.h" | 64 #include "wtf/Vector.h" |
| 64 | 65 |
| 65 using WebCore::TypeBuilder::Array; | 66 using WebCore::TypeBuilder::Array; |
| 66 using WebCore::TypeBuilder::IndexedDB::DatabaseWithObjectStores; | 67 using WebCore::TypeBuilder::IndexedDB::DatabaseWithObjectStores; |
| 67 using WebCore::TypeBuilder::IndexedDB::DataEntry; | 68 using WebCore::TypeBuilder::IndexedDB::DataEntry; |
| 68 using WebCore::TypeBuilder::IndexedDB::Key; | 69 using WebCore::TypeBuilder::IndexedDB::Key; |
| 69 using WebCore::TypeBuilder::IndexedDB::KeyPath; | 70 using WebCore::TypeBuilder::IndexedDB::KeyPath; |
| 70 using WebCore::TypeBuilder::IndexedDB::KeyRange; | 71 using WebCore::TypeBuilder::IndexedDB::KeyRange; |
| 71 using WebCore::TypeBuilder::IndexedDB::ObjectStore; | 72 using WebCore::TypeBuilder::IndexedDB::ObjectStore; |
| 72 using WebCore::TypeBuilder::IndexedDB::ObjectStoreIndex; | 73 using WebCore::TypeBuilder::IndexedDB::ObjectStoreIndex; |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 RefPtr<OpenCursorCallback> openCursorCallback = OpenCursorCallback::crea
te(scriptState(), m_requestCallback, m_skipCount, m_pageSize); | 504 RefPtr<OpenCursorCallback> openCursorCallback = OpenCursorCallback::crea
te(scriptState(), m_requestCallback, m_skipCount, m_pageSize); |
| 504 | 505 |
| 505 IDBRequest* idbRequest; | 506 IDBRequest* idbRequest; |
| 506 if (!m_indexName.isEmpty()) { | 507 if (!m_indexName.isEmpty()) { |
| 507 IDBIndex* idbIndex = indexForObjectStore(idbObjectStore, m_indexName
); | 508 IDBIndex* idbIndex = indexForObjectStore(idbObjectStore, m_indexName
); |
| 508 if (!idbIndex) { | 509 if (!idbIndex) { |
| 509 m_requestCallback->sendFailure("Could not get index"); | 510 m_requestCallback->sendFailure("Could not get index"); |
| 510 return; | 511 return; |
| 511 } | 512 } |
| 512 | 513 |
| 513 idbRequest = idbIndex->openCursor(scriptState(), m_idbKeyRange.get()
, blink::WebIDBCursor::Next); | 514 idbRequest = idbIndex->openCursor(scriptState(), m_idbKeyRange.get()
, blink::WebIDBCursorDirectionNext); |
| 514 } else { | 515 } else { |
| 515 idbRequest = idbObjectStore->openCursor(scriptState(), m_idbKeyRange
.get(), blink::WebIDBCursor::Next); | 516 idbRequest = idbObjectStore->openCursor(scriptState(), m_idbKeyRange
.get(), blink::WebIDBCursorDirectionNext); |
| 516 } | 517 } |
| 517 idbRequest->addEventListener(EventTypeNames::success, openCursorCallback
, false); | 518 idbRequest->addEventListener(EventTypeNames::success, openCursorCallback
, false); |
| 518 } | 519 } |
| 519 | 520 |
| 520 virtual RequestCallback* requestCallback() OVERRIDE { return m_requestCallba
ck.get(); } | 521 virtual RequestCallback* requestCallback() OVERRIDE { return m_requestCallba
ck.get(); } |
| 521 DataLoader(ScriptState* scriptState, PassRefPtr<RequestDataCallback> request
Callback, const String& objectStoreName, const String& indexName, IDBKeyRange* i
dbKeyRange, int skipCount, unsigned pageSize) | 522 DataLoader(ScriptState* scriptState, PassRefPtr<RequestDataCallback> request
Callback, const String& objectStoreName, const String& indexName, IDBKeyRange* i
dbKeyRange, int skipCount, unsigned pageSize) |
| 522 : ExecutableWithDatabase(scriptState) | 523 : ExecutableWithDatabase(scriptState) |
| 523 , m_requestCallback(requestCallback) | 524 , m_requestCallback(requestCallback) |
| 524 , m_objectStoreName(objectStoreName) | 525 , m_objectStoreName(objectStoreName) |
| 525 , m_indexName(indexName) | 526 , m_indexName(indexName) |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 if (!idbFactory) | 768 if (!idbFactory) |
| 768 return; | 769 return; |
| 769 | 770 |
| 770 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 771 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 771 ScriptState::Scope scope(scriptState); | 772 ScriptState::Scope scope(scriptState); |
| 772 RefPtr<ClearObjectStore> clearObjectStore = ClearObjectStore::create(scriptS
tate, objectStoreName, requestCallback); | 773 RefPtr<ClearObjectStore> clearObjectStore = ClearObjectStore::create(scriptS
tate, objectStoreName, requestCallback); |
| 773 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); | 774 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); |
| 774 } | 775 } |
| 775 | 776 |
| 776 } // namespace WebCore | 777 } // namespace WebCore |
| OLD | NEW |