Chromium Code Reviews| 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(const Maybe<protocol::IndexedDB::Key Range>& maybeRange) |
| 397 { | 397 { |
| 398 protocol::IndexedDB::KeyRange* keyRange = maybeRange.fromJust(); | |
|
dgozman
2016/02/24 23:17:43
Let's pass raw pointer to this method since it alr
pfeldman
2016/02/24 23:38:39
Done.
| |
| 398 IDBKey* idbLower = idbKeyFromInspectorObject(keyRange->getLower(nullptr)); | 399 IDBKey* idbLower = idbKeyFromInspectorObject(keyRange->getLower(nullptr)); |
| 399 if (keyRange->hasLower() && !idbLower) | 400 if (keyRange->hasLower() && !idbLower) |
| 400 return nullptr; | 401 return nullptr; |
| 401 | 402 |
| 402 IDBKey* idbUpper = idbKeyFromInspectorObject(keyRange->getUpper(nullptr)); | 403 IDBKey* idbUpper = idbKeyFromInspectorObject(keyRange->getUpper(nullptr)); |
| 403 if (keyRange->hasUpper() && !idbUpper) | 404 if (keyRange->hasUpper() && !idbUpper) |
| 404 return nullptr; | 405 return nullptr; |
| 405 | 406 |
| 406 if (!keyRange->hasLowerOpen()) | 407 if (!keyRange->hasLowerOpen()) |
| 407 return nullptr; | 408 return nullptr; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 679 return; | 680 return; |
| 680 | 681 |
| 681 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 682 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 682 if (!scriptState) | 683 if (!scriptState) |
| 683 return; | 684 return; |
| 684 ScriptState::Scope scope(scriptState); | 685 ScriptState::Scope scope(scriptState); |
| 685 RefPtr<DatabaseLoader> databaseLoader = DatabaseLoader::create(scriptState, requestCallback); | 686 RefPtr<DatabaseLoader> databaseLoader = DatabaseLoader::create(scriptState, requestCallback); |
| 686 databaseLoader->start(idbFactory, document->securityOrigin(), databaseName); | 687 databaseLoader->start(idbFactory, document->securityOrigin(), databaseName); |
| 687 } | 688 } |
| 688 | 689 |
| 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) | 690 void InspectorIndexedDBAgent::requestData(ErrorString* errorString, |
| 691 const String& securityOrigin, | |
| 692 const String& databaseName, | |
| 693 const String& objectStoreName, | |
| 694 const String& indexName, | |
| 695 int skipCount, | |
| 696 int pageSize, | |
| 697 const Maybe<protocol::IndexedDB::KeyRange>& keyRange, | |
| 698 const PassRefPtr<RequestDataCallback> requestCallback) | |
| 690 { | 699 { |
| 691 LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigi n); | 700 LocalFrame* frame = m_inspectedFrames->frameWithSecurityOrigin(securityOrigi n); |
| 692 Document* document = assertDocument(errorString, frame); | 701 Document* document = assertDocument(errorString, frame); |
| 693 if (!document) | 702 if (!document) |
| 694 return; | 703 return; |
| 695 IDBFactory* idbFactory = assertIDBFactory(errorString, document); | 704 IDBFactory* idbFactory = assertIDBFactory(errorString, document); |
| 696 if (!idbFactory) | 705 if (!idbFactory) |
| 697 return; | 706 return; |
| 698 | 707 |
| 699 IDBKeyRange* idbKeyRange = keyRange ? idbKeyRangeFromKeyRange(keyRange) : nu llptr; | 708 IDBKeyRange* idbKeyRange = keyRange.isJust() ? idbKeyRangeFromKeyRange(keyRa nge) : nullptr; |
| 700 if (keyRange && !idbKeyRange) { | 709 if (keyRange.isJust() && !idbKeyRange) { |
| 701 *errorString = "Can not parse key range."; | 710 *errorString = "Can not parse key range."; |
| 702 return; | 711 return; |
| 703 } | 712 } |
| 704 | 713 |
| 705 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 714 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| 706 if (!scriptState) | 715 if (!scriptState) |
| 707 return; | 716 return; |
| 708 ScriptState::Scope scope(scriptState); | 717 ScriptState::Scope scope(scriptState); |
| 709 RefPtr<DataLoader> dataLoader = DataLoader::create(scriptState, requestCallb ack, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); | 718 RefPtr<DataLoader> dataLoader = DataLoader::create(scriptState, requestCallb ack, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); |
| 710 dataLoader->start(idbFactory, document->securityOrigin(), databaseName); | 719 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 ); | 826 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName ); |
| 818 } | 827 } |
| 819 | 828 |
| 820 DEFINE_TRACE(InspectorIndexedDBAgent) | 829 DEFINE_TRACE(InspectorIndexedDBAgent) |
| 821 { | 830 { |
| 822 visitor->trace(m_inspectedFrames); | 831 visitor->trace(m_inspectedFrames); |
| 823 InspectorBaseAgent::trace(visitor); | 832 InspectorBaseAgent::trace(visitor); |
| 824 } | 833 } |
| 825 | 834 |
| 826 } // namespace blink | 835 } // namespace blink |
| OLD | NEW |