| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 401 |
| 402 IDBKeyRange::LowerBoundType lowerBoundType = keyRange->getLowerOpen() ? IDBK
eyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed; | 402 IDBKeyRange::LowerBoundType lowerBoundType = keyRange->getLowerOpen() ? IDBK
eyRange::LowerBoundOpen : IDBKeyRange::LowerBoundClosed; |
| 403 IDBKeyRange::UpperBoundType upperBoundType = keyRange->getUpperOpen() ? IDBK
eyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed; | 403 IDBKeyRange::UpperBoundType upperBoundType = keyRange->getUpperOpen() ? IDBK
eyRange::UpperBoundOpen : IDBKeyRange::UpperBoundClosed; |
| 404 return IDBKeyRange::create(idbLower, idbUpper, lowerBoundType, upperBoundTyp
e); | 404 return IDBKeyRange::create(idbLower, idbUpper, lowerBoundType, upperBoundTyp
e); |
| 405 } | 405 } |
| 406 | 406 |
| 407 class DataLoader; | 407 class DataLoader; |
| 408 | 408 |
| 409 class OpenCursorCallback final : public EventListener { | 409 class OpenCursorCallback final : public EventListener { |
| 410 public: | 410 public: |
| 411 static OpenCursorCallback* create(V8InspectorSession* v8Session, ScriptState
* scriptState, std::unique_ptr<RequestDataCallback> requestCallback, int skipCou
nt, unsigned pageSize) | 411 static OpenCursorCallback* create(v8_inspector::V8InspectorSession* v8Sessio
n, ScriptState* scriptState, std::unique_ptr<RequestDataCallback> requestCallbac
k, int skipCount, unsigned pageSize) |
| 412 { | 412 { |
| 413 return new OpenCursorCallback(v8Session, scriptState, std::move(requestC
allback), skipCount, pageSize); | 413 return new OpenCursorCallback(v8Session, scriptState, std::move(requestC
allback), skipCount, pageSize); |
| 414 } | 414 } |
| 415 | 415 |
| 416 ~OpenCursorCallback() override { } | 416 ~OpenCursorCallback() override { } |
| 417 | 417 |
| 418 bool operator==(const EventListener& other) const override | 418 bool operator==(const EventListener& other) const override |
| 419 { | 419 { |
| 420 return this == &other; | 420 return this == &other; |
| 421 } | 421 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 { | 480 { |
| 481 m_requestCallback->sendSuccess(std::move(m_result), hasMore); | 481 m_requestCallback->sendSuccess(std::move(m_result), hasMore); |
| 482 } | 482 } |
| 483 | 483 |
| 484 DEFINE_INLINE_VIRTUAL_TRACE() | 484 DEFINE_INLINE_VIRTUAL_TRACE() |
| 485 { | 485 { |
| 486 EventListener::trace(visitor); | 486 EventListener::trace(visitor); |
| 487 } | 487 } |
| 488 | 488 |
| 489 private: | 489 private: |
| 490 OpenCursorCallback(V8InspectorSession* v8Session, ScriptState* scriptState,
std::unique_ptr<RequestDataCallback> requestCallback, int skipCount, unsigned pa
geSize) | 490 OpenCursorCallback(v8_inspector::V8InspectorSession* v8Session, ScriptState*
scriptState, std::unique_ptr<RequestDataCallback> requestCallback, int skipCoun
t, unsigned pageSize) |
| 491 : EventListener(EventListener::CPPEventListenerType) | 491 : EventListener(EventListener::CPPEventListenerType) |
| 492 , m_v8Session(v8Session) | 492 , m_v8Session(v8Session) |
| 493 , m_scriptState(scriptState) | 493 , m_scriptState(scriptState) |
| 494 , m_requestCallback(std::move(requestCallback)) | 494 , m_requestCallback(std::move(requestCallback)) |
| 495 , m_skipCount(skipCount) | 495 , m_skipCount(skipCount) |
| 496 , m_pageSize(pageSize) | 496 , m_pageSize(pageSize) |
| 497 { | 497 { |
| 498 m_result = Array<DataEntry>::create(); | 498 m_result = Array<DataEntry>::create(); |
| 499 } | 499 } |
| 500 | 500 |
| 501 V8InspectorSession* m_v8Session; | 501 v8_inspector::V8InspectorSession* m_v8Session; |
| 502 RefPtr<ScriptState> m_scriptState; | 502 RefPtr<ScriptState> m_scriptState; |
| 503 std::unique_ptr<RequestDataCallback> m_requestCallback; | 503 std::unique_ptr<RequestDataCallback> m_requestCallback; |
| 504 int m_skipCount; | 504 int m_skipCount; |
| 505 unsigned m_pageSize; | 505 unsigned m_pageSize; |
| 506 std::unique_ptr<Array<DataEntry>> m_result; | 506 std::unique_ptr<Array<DataEntry>> m_result; |
| 507 }; | 507 }; |
| 508 | 508 |
| 509 class DataLoader final : public ExecutableWithDatabase { | 509 class DataLoader final : public ExecutableWithDatabase { |
| 510 public: | 510 public: |
| 511 static PassRefPtr<DataLoader> create(V8InspectorSession* v8Session, ScriptSt
ate* scriptState, std::unique_ptr<RequestDataCallback> requestCallback, const St
ring& objectStoreName, const String& indexName, IDBKeyRange* idbKeyRange, int sk
ipCount, unsigned pageSize) | 511 static PassRefPtr<DataLoader> create(v8_inspector::V8InspectorSession* v8Ses
sion, ScriptState* scriptState, std::unique_ptr<RequestDataCallback> requestCall
back, const String& objectStoreName, const String& indexName, IDBKeyRange* idbKe
yRange, int skipCount, unsigned pageSize) |
| 512 { | 512 { |
| 513 return adoptRef(new DataLoader(v8Session, scriptState, std::move(request
Callback), objectStoreName, indexName, idbKeyRange, skipCount, pageSize)); | 513 return adoptRef(new DataLoader(v8Session, scriptState, std::move(request
Callback), objectStoreName, indexName, idbKeyRange, skipCount, pageSize)); |
| 514 } | 514 } |
| 515 | 515 |
| 516 ~DataLoader() override { } | 516 ~DataLoader() override { } |
| 517 | 517 |
| 518 void execute(IDBDatabase* idbDatabase) override | 518 void execute(IDBDatabase* idbDatabase) override |
| 519 { | 519 { |
| 520 IDBTransaction* idbTransaction = transactionForDatabase(getScriptState()
, idbDatabase, m_objectStoreName); | 520 IDBTransaction* idbTransaction = transactionForDatabase(getScriptState()
, idbDatabase, m_objectStoreName); |
| 521 if (!idbTransaction) { | 521 if (!idbTransaction) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 538 | 538 |
| 539 idbRequest = idbIndex->openCursor(getScriptState(), m_idbKeyRange.ge
t(), WebIDBCursorDirectionNext); | 539 idbRequest = idbIndex->openCursor(getScriptState(), m_idbKeyRange.ge
t(), WebIDBCursorDirectionNext); |
| 540 } else { | 540 } else { |
| 541 idbRequest = idbObjectStore->openCursor(getScriptState(), m_idbKeyRa
nge.get(), WebIDBCursorDirectionNext); | 541 idbRequest = idbObjectStore->openCursor(getScriptState(), m_idbKeyRa
nge.get(), WebIDBCursorDirectionNext); |
| 542 } | 542 } |
| 543 OpenCursorCallback* openCursorCallback = OpenCursorCallback::create(m_v8
Session, getScriptState(), std::move(m_requestCallback), m_skipCount, m_pageSize
); | 543 OpenCursorCallback* openCursorCallback = OpenCursorCallback::create(m_v8
Session, getScriptState(), std::move(m_requestCallback), m_skipCount, m_pageSize
); |
| 544 idbRequest->addEventListener(EventTypeNames::success, openCursorCallback
, false); | 544 idbRequest->addEventListener(EventTypeNames::success, openCursorCallback
, false); |
| 545 } | 545 } |
| 546 | 546 |
| 547 RequestCallback* getRequestCallback() override { return m_requestCallback.ge
t(); } | 547 RequestCallback* getRequestCallback() override { return m_requestCallback.ge
t(); } |
| 548 DataLoader(V8InspectorSession* v8Session, ScriptState* scriptState, std::uni
que_ptr<RequestDataCallback> requestCallback, const String& objectStoreName, con
st String& indexName, IDBKeyRange* idbKeyRange, int skipCount, unsigned pageSize
) | 548 DataLoader(v8_inspector::V8InspectorSession* v8Session, ScriptState* scriptS
tate, std::unique_ptr<RequestDataCallback> requestCallback, const String& object
StoreName, const String& indexName, IDBKeyRange* idbKeyRange, int skipCount, uns
igned pageSize) |
| 549 : ExecutableWithDatabase(scriptState) | 549 : ExecutableWithDatabase(scriptState) |
| 550 , m_v8Session(v8Session) | 550 , m_v8Session(v8Session) |
| 551 , m_requestCallback(std::move(requestCallback)) | 551 , m_requestCallback(std::move(requestCallback)) |
| 552 , m_objectStoreName(objectStoreName) | 552 , m_objectStoreName(objectStoreName) |
| 553 , m_indexName(indexName) | 553 , m_indexName(indexName) |
| 554 , m_idbKeyRange(idbKeyRange) | 554 , m_idbKeyRange(idbKeyRange) |
| 555 , m_skipCount(skipCount) | 555 , m_skipCount(skipCount) |
| 556 , m_pageSize(pageSize) | 556 , m_pageSize(pageSize) |
| 557 { | 557 { |
| 558 } | 558 } |
| 559 | 559 |
| 560 V8InspectorSession* m_v8Session; | 560 v8_inspector::V8InspectorSession* m_v8Session; |
| 561 std::unique_ptr<RequestDataCallback> m_requestCallback; | 561 std::unique_ptr<RequestDataCallback> m_requestCallback; |
| 562 String m_objectStoreName; | 562 String m_objectStoreName; |
| 563 String m_indexName; | 563 String m_indexName; |
| 564 Persistent<IDBKeyRange> m_idbKeyRange; | 564 Persistent<IDBKeyRange> m_idbKeyRange; |
| 565 int m_skipCount; | 565 int m_skipCount; |
| 566 unsigned m_pageSize; | 566 unsigned m_pageSize; |
| 567 }; | 567 }; |
| 568 | 568 |
| 569 } // namespace | 569 } // namespace |
| 570 | 570 |
| 571 // static | 571 // static |
| 572 InspectorIndexedDBAgent::InspectorIndexedDBAgent(InspectedFrames* inspectedFrame
s, V8InspectorSession* v8Session) | 572 InspectorIndexedDBAgent::InspectorIndexedDBAgent(InspectedFrames* inspectedFrame
s, v8_inspector::V8InspectorSession* v8Session) |
| 573 : m_inspectedFrames(inspectedFrames) | 573 : m_inspectedFrames(inspectedFrames) |
| 574 , m_v8Session(v8Session) | 574 , m_v8Session(v8Session) |
| 575 { | 575 { |
| 576 } | 576 } |
| 577 | 577 |
| 578 InspectorIndexedDBAgent::~InspectorIndexedDBAgent() | 578 InspectorIndexedDBAgent::~InspectorIndexedDBAgent() |
| 579 { | 579 { |
| 580 } | 580 } |
| 581 | 581 |
| 582 void InspectorIndexedDBAgent::restore() | 582 void InspectorIndexedDBAgent::restore() |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 clearObjectStore->start(idbFactory, document->getSecurityOrigin(), databaseN
ame); | 825 clearObjectStore->start(idbFactory, document->getSecurityOrigin(), databaseN
ame); |
| 826 } | 826 } |
| 827 | 827 |
| 828 DEFINE_TRACE(InspectorIndexedDBAgent) | 828 DEFINE_TRACE(InspectorIndexedDBAgent) |
| 829 { | 829 { |
| 830 visitor->trace(m_inspectedFrames); | 830 visitor->trace(m_inspectedFrames); |
| 831 InspectorBaseAgent::trace(visitor); | 831 InspectorBaseAgent::trace(visitor); |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace blink | 834 } // namespace blink |
| OLD | NEW |