| Index: third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
|
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
|
| index 17d620a93190245874a785fa93c662a853953e0d..ea1915caf55f1d5b01da829ea68dfb961f9cff27 100644
|
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
|
| @@ -115,7 +115,9 @@ IDBRequest* IDBIndex::openCursor(ScriptState* script_state,
|
| const ScriptValue& range,
|
| const String& direction_string,
|
| ExceptionState& exception_state) {
|
| - IDB_TRACE("IDBIndex::openCursor");
|
| + IDB_TRACE("IDBIndex::openCursorCall");
|
| + auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>(
|
| + nullptr, "IDBIndex::openCursor", this);
|
| if (IsDeleted()) {
|
| exception_state.ThrowDOMException(kInvalidStateError,
|
| IDBDatabase::kIndexDeletedErrorMessage);
|
| @@ -139,14 +141,17 @@ IDBRequest* IDBIndex::openCursor(ScriptState* script_state,
|
| return nullptr;
|
| }
|
|
|
| - return openCursor(script_state, key_range, direction);
|
| + return openCursor(script_state, key_range, direction, std::move(metrics));
|
| }
|
|
|
| -IDBRequest* IDBIndex::openCursor(ScriptState* script_state,
|
| - IDBKeyRange* key_range,
|
| - WebIDBCursorDirection direction) {
|
| - IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this),
|
| - transaction_.Get());
|
| +IDBRequest* IDBIndex::openCursor(
|
| + ScriptState* script_state,
|
| + IDBKeyRange* key_range,
|
| + WebIDBCursorDirection direction,
|
| + std::unique_ptr<IDBRequest::ScopedMetricsTracker> metrics) {
|
| + IDBRequest* request =
|
| + IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(),
|
| + std::move(metrics));
|
| request->SetCursorDetails(IndexedDB::kCursorKeyAndValue, direction);
|
| BackendDB()->OpenCursor(transaction_->Id(), object_store_->Id(), Id(),
|
| key_range, direction, false, kWebIDBTaskTypeNormal,
|
| @@ -157,7 +162,9 @@ IDBRequest* IDBIndex::openCursor(ScriptState* script_state,
|
| IDBRequest* IDBIndex::count(ScriptState* script_state,
|
| const ScriptValue& range,
|
| ExceptionState& exception_state) {
|
| - IDB_TRACE("IDBIndex::count");
|
| + IDB_TRACE("IDBIndex::countCall");
|
| + auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>(
|
| + nullptr, "IDBIndex::count", this);
|
| if (IsDeleted()) {
|
| exception_state.ThrowDOMException(kInvalidStateError,
|
| IDBDatabase::kIndexDeletedErrorMessage);
|
| @@ -180,8 +187,9 @@ IDBRequest* IDBIndex::count(ScriptState* script_state,
|
| return nullptr;
|
| }
|
|
|
| - IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this),
|
| - transaction_.Get());
|
| + IDBRequest* request =
|
| + IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(),
|
| + std::move(metrics));
|
| BackendDB()->Count(transaction_->Id(), object_store_->Id(), Id(), key_range,
|
| request->CreateWebCallbacks().release());
|
| return request;
|
| @@ -191,7 +199,9 @@ IDBRequest* IDBIndex::openKeyCursor(ScriptState* script_state,
|
| const ScriptValue& range,
|
| const String& direction_string,
|
| ExceptionState& exception_state) {
|
| - IDB_TRACE("IDBIndex::openKeyCursor");
|
| + IDB_TRACE("IDBIndex::openKeyCursorCall");
|
| + auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>(
|
| + nullptr, "IDBIndex::openKeyCursor", this);
|
| if (IsDeleted()) {
|
| exception_state.ThrowDOMException(kInvalidStateError,
|
| IDBDatabase::kIndexDeletedErrorMessage);
|
| @@ -214,8 +224,9 @@ IDBRequest* IDBIndex::openKeyCursor(ScriptState* script_state,
|
| return nullptr;
|
| }
|
|
|
| - IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this),
|
| - transaction_.Get());
|
| + IDBRequest* request =
|
| + IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(),
|
| + std::move(metrics));
|
| request->SetCursorDetails(IndexedDB::kCursorKeyOnly, direction);
|
| BackendDB()->OpenCursor(transaction_->Id(), object_store_->Id(), Id(),
|
| key_range, direction, true, kWebIDBTaskTypeNormal,
|
| @@ -226,7 +237,7 @@ IDBRequest* IDBIndex::openKeyCursor(ScriptState* script_state,
|
| IDBRequest* IDBIndex::get(ScriptState* script_state,
|
| const ScriptValue& key,
|
| ExceptionState& exception_state) {
|
| - IDB_TRACE("IDBIndex::get");
|
| + IDB_TRACE("IDBIndex::getCall");
|
| return GetInternal(script_state, key, exception_state, false);
|
| }
|
|
|
| @@ -241,7 +252,7 @@ IDBRequest* IDBIndex::getAll(ScriptState* script_state,
|
| const ScriptValue& range,
|
| unsigned long max_count,
|
| ExceptionState& exception_state) {
|
| - IDB_TRACE("IDBIndex::getAll");
|
| + IDB_TRACE("IDBIndex::getAllCall");
|
| return GetAllInternal(script_state, range, max_count, exception_state, false);
|
| }
|
|
|
| @@ -256,7 +267,7 @@ IDBRequest* IDBIndex::getAllKeys(ScriptState* script_state,
|
| const ScriptValue& range,
|
| uint32_t max_count,
|
| ExceptionState& exception_state) {
|
| - IDB_TRACE("IDBIndex::getAllKeys");
|
| + IDB_TRACE("IDBIndex::getAllKeysCall");
|
| return GetAllInternal(script_state, range, max_count, exception_state,
|
| /*key_only=*/true);
|
| }
|
| @@ -264,7 +275,7 @@ IDBRequest* IDBIndex::getAllKeys(ScriptState* script_state,
|
| IDBRequest* IDBIndex::getKey(ScriptState* script_state,
|
| const ScriptValue& key,
|
| ExceptionState& exception_state) {
|
| - IDB_TRACE("IDBIndex::getKey");
|
| + IDB_TRACE("IDBIndex::getKeyCall");
|
| return GetInternal(script_state, key, exception_state, true);
|
| }
|
|
|
| @@ -272,6 +283,8 @@ IDBRequest* IDBIndex::GetInternal(ScriptState* script_state,
|
| const ScriptValue& key,
|
| ExceptionState& exception_state,
|
| bool key_only) {
|
| + auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>(
|
| + nullptr, key_only ? "IDBIndex::getKey" : "IDBIndex::get", this);
|
| if (IsDeleted()) {
|
| exception_state.ThrowDOMException(kInvalidStateError,
|
| IDBDatabase::kIndexDeletedErrorMessage);
|
| @@ -298,8 +311,9 @@ IDBRequest* IDBIndex::GetInternal(ScriptState* script_state,
|
| return nullptr;
|
| }
|
|
|
| - IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this),
|
| - transaction_.Get());
|
| + IDBRequest* request =
|
| + IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(),
|
| + std::move(metrics));
|
| BackendDB()->Get(transaction_->Id(), object_store_->Id(), Id(), key_range,
|
| key_only, request->CreateWebCallbacks().release());
|
| return request;
|
| @@ -310,6 +324,8 @@ IDBRequest* IDBIndex::GetAllInternal(ScriptState* script_state,
|
| unsigned long max_count,
|
| ExceptionState& exception_state,
|
| bool key_only) {
|
| + auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>(
|
| + nullptr, key_only ? "IDBIndex::getAllKeys" : "IDBIndex::getAll", this);
|
| if (!max_count)
|
| max_count = std::numeric_limits<uint32_t>::max();
|
|
|
| @@ -334,8 +350,9 @@ IDBRequest* IDBIndex::GetAllInternal(ScriptState* script_state,
|
| return nullptr;
|
| }
|
|
|
| - IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this),
|
| - transaction_.Get());
|
| + IDBRequest* request =
|
| + IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(),
|
| + std::move(metrics));
|
| BackendDB()->GetAll(transaction_->Id(), object_store_->Id(), Id(), key_range,
|
| max_count, key_only,
|
| request->CreateWebCallbacks().release());
|
|
|