| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 for (size_t i = 0; array && i < array->length(); ++i) | 386 for (size_t i = 0; array && i < array->length(); ++i) |
| 387 keyArray.append(idbKeyFromInspectorObject(array->get(i))); | 387 keyArray.append(idbKeyFromInspectorObject(array->get(i))); |
| 388 idbKey = IDBKey::createArray(keyArray); | 388 idbKey = IDBKey::createArray(keyArray); |
| 389 } else { | 389 } else { |
| 390 return nullptr; | 390 return nullptr; |
| 391 } | 391 } |
| 392 | 392 |
| 393 return idbKey; | 393 return idbKey; |
| 394 } | 394 } |
| 395 | 395 |
| 396 static IDBKeyRange* idbKeyRangeFromKeyRange(PassOwnPtr<protocol::IndexedDB::KeyR
ange> keyRange) | 396 static IDBKeyRange* idbKeyRangeFromKeyRange(protocol::IndexedDB::KeyRange* keyRa
nge) |
| 397 { | 397 { |
| 398 IDBKey* idbLower = idbKeyFromInspectorObject(keyRange->getLower(nullptr)); | 398 IDBKey* idbLower = idbKeyFromInspectorObject(keyRange->getLower(nullptr)); |
| 399 if (keyRange->hasLower() && !idbLower) | 399 if (keyRange->hasLower() && !idbLower) |
| 400 return nullptr; | 400 return nullptr; |
| 401 | 401 |
| 402 IDBKey* idbUpper = idbKeyFromInspectorObject(keyRange->getUpper(nullptr)); | 402 IDBKey* idbUpper = idbKeyFromInspectorObject(keyRange->getUpper(nullptr)); |
| 403 if (keyRange->hasUpper() && !idbUpper) | 403 if (keyRange->hasUpper() && !idbUpper) |
| 404 return nullptr; | 404 return nullptr; |
| 405 | 405 |
| 406 if (!keyRange->hasLowerOpen()) | 406 if (!keyRange->hasLowerOpen()) |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 return; | 679 return; |
| 680 | 680 |
| 681 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 681 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 682 if (!scriptState) | 682 if (!scriptState) |
| 683 return; | 683 return; |
| 684 ScriptState::Scope scope(scriptState); | 684 ScriptState::Scope scope(scriptState); |
| 685 RefPtr<DatabaseLoader> databaseLoader = DatabaseLoader::create(scriptState,
requestCallback); | 685 RefPtr<DatabaseLoader> databaseLoader = DatabaseLoader::create(scriptState,
requestCallback); |
| 686 databaseLoader->start(idbFactory, document->securityOrigin(), databaseName); | 686 databaseLoader->start(idbFactory, document->securityOrigin(), databaseName); |
| 687 } | 687 } |
| 688 | 688 |
| 689 void InspectorIndexedDBAgent::requestData(ErrorString* errorString, const String
& securityOrigin, const String& databaseName, const String& objectStoreName, con
st String& indexName, int skipCount, int pageSize, PassOwnPtr<protocol::IndexedD
B::KeyRange> keyRange, const PassRefPtr<RequestDataCallback> requestCallback) | 689 void InspectorIndexedDBAgent::requestData(ErrorString* errorString, |
| 690 const String& securityOrigin, |
| 691 const String& databaseName, |
| 692 const String& objectStoreName, |
| 693 const String& indexName, |
| 694 int skipCount, |
| 695 int pageSize, |
| 696 const Maybe<protocol::IndexedDB::KeyRange>& keyRange, |
| 697 const PassRefPtr<RequestDataCallback> requestCallback) |
| 690 { | 698 { |
| 691 LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigi
n); | 699 LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigi
n); |
| 692 Document* document = assertDocument(errorString, frame); | 700 Document* document = assertDocument(errorString, frame); |
| 693 if (!document) | 701 if (!document) |
| 694 return; | 702 return; |
| 695 IDBFactory* idbFactory = assertIDBFactory(errorString, document); | 703 IDBFactory* idbFactory = assertIDBFactory(errorString, document); |
| 696 if (!idbFactory) | 704 if (!idbFactory) |
| 697 return; | 705 return; |
| 698 | 706 |
| 699 IDBKeyRange* idbKeyRange = keyRange ? idbKeyRangeFromKeyRange(keyRange) : nu
llptr; | 707 IDBKeyRange* idbKeyRange = keyRange.isJust() ? idbKeyRangeFromKeyRange(keyRa
nge.fromJust()) : nullptr; |
| 700 if (keyRange && !idbKeyRange) { | 708 if (keyRange.isJust() && !idbKeyRange) { |
| 701 *errorString = "Can not parse key range."; | 709 *errorString = "Can not parse key range."; |
| 702 return; | 710 return; |
| 703 } | 711 } |
| 704 | 712 |
| 705 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 713 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 706 if (!scriptState) | 714 if (!scriptState) |
| 707 return; | 715 return; |
| 708 ScriptState::Scope scope(scriptState); | 716 ScriptState::Scope scope(scriptState); |
| 709 RefPtr<DataLoader> dataLoader = DataLoader::create(scriptState, requestCallb
ack, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); | 717 RefPtr<DataLoader> dataLoader = DataLoader::create(scriptState, requestCallb
ack, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); |
| 710 dataLoader->start(idbFactory, document->securityOrigin(), databaseName); | 718 dataLoader->start(idbFactory, document->securityOrigin(), databaseName); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); | 825 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); |
| 818 } | 826 } |
| 819 | 827 |
| 820 DEFINE_TRACE(InspectorIndexedDBAgent) | 828 DEFINE_TRACE(InspectorIndexedDBAgent) |
| 821 { | 829 { |
| 822 visitor->trace(m_inspectedFrames); | 830 visitor->trace(m_inspectedFrames); |
| 823 InspectorBaseAgent::trace(visitor); | 831 InspectorBaseAgent::trace(visitor); |
| 824 } | 832 } |
| 825 | 833 |
| 826 } // namespace blink | 834 } // namespace blink |
| OLD | NEW |