chromium/third_party/blink/renderer/modules/indexeddb/idb_request.cc

/*
 * Copyright (C) 2010 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 *     its contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "third_party/blink/renderer/modules/indexeddb/idb_request.h"

#include <atomic>
#include <memory>
#include <optional>
#include <utility>

#include "base/debug/stack_trace.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "third_party/blink/public/platform/web_blob_info.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_idbcursor_idbindex_idbobjectstore.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_idbindex_idbobjectstore.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/modules/indexed_db_names.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_database.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_event_dispatcher.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_factory_client.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_request_queue_item.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_value.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"

namespace blink {

namespace {

const char* RequestTypeToName(IDBRequest::TypeForMetrics type) {}

void RecordHistogram(IDBRequest::TypeForMetrics type,
                     bool success,
                     base::TimeDelta duration) {}

}  // namespace

IDBRequest::AsyncTraceState::AsyncTraceState(TypeForMetrics type)
    :{}

void IDBRequest::AsyncTraceState::WillDispatchResult(bool success) {}

void IDBRequest::AsyncTraceState::RecordAndReset() {}

IDBRequest::AsyncTraceState::~AsyncTraceState() {}

IDBRequest* IDBRequest::Create(ScriptState* script_state,
                               IDBIndex* source,
                               IDBTransaction* transaction,
                               IDBRequest::AsyncTraceState metrics) {}

IDBRequest* IDBRequest::Create(ScriptState* script_state,
                               IDBObjectStore* source,
                               IDBTransaction* transaction,
                               IDBRequest::AsyncTraceState metrics) {}

IDBRequest* IDBRequest::Create(ScriptState* script_state,
                               IDBCursor* source,
                               IDBTransaction* transaction,
                               IDBRequest::AsyncTraceState metrics) {}

IDBRequest* IDBRequest::Create(ScriptState* script_state,
                               const Source* source,
                               IDBTransaction* transaction,
                               IDBRequest::AsyncTraceState metrics) {}

IDBRequest::IDBRequest(ScriptState* script_state,
                       const Source* source,
                       IDBTransaction* transaction,
                       AsyncTraceState metrics)
    :{}

IDBRequest::~IDBRequest() {}

void IDBRequest::Trace(Visitor* visitor) const {}

ScriptValue IDBRequest::result(ScriptState* script_state,
                               ExceptionState& exception_state) {}

DOMException* IDBRequest::error(ExceptionState& exception_state) const {}

const IDBRequest::Source* IDBRequest::source(ScriptState* script_state) const {}

const String& IDBRequest::readyState() const {}

void IDBRequest::Abort(bool queue_dispatch) {}

void IDBRequest::SetCursorDetails(indexed_db::CursorType cursor_type,
                                  mojom::IDBCursorDirection direction) {}

void IDBRequest::SetPendingCursor(IDBCursor* cursor) {}

IDBCursor* IDBRequest::GetResultCursor() const {}

void IDBRequest::SendResultCursorInternal(IDBCursor* cursor,
                                          std::unique_ptr<IDBKey> key,
                                          std::unique_ptr<IDBKey> primary_key,
                                          std::unique_ptr<IDBValue> value) {}

bool IDBRequest::CanStillSendResult() const {}

void IDBRequest::HandleResponse(std::unique_ptr<IDBKey> key) {}

void IDBRequest::HandleResponse(int64_t value) {}

void IDBRequest::HandleResponse() {}

void IDBRequest::HandleResponse(std::unique_ptr<IDBValue> value) {}

void IDBRequest::HandleResponseAdvanceCursor(
    std::unique_ptr<IDBKey> key,
    std::unique_ptr<IDBKey> primary_key,
    std::unique_ptr<IDBValue> optional_value) {}

void IDBRequest::OnClear(bool success) {}

void IDBRequest::OnGetAll(
    bool key_only,
    mojo::PendingAssociatedReceiver<mojom::blink::IDBDatabaseGetAllResultSink>
        receiver) {}

void IDBRequest::OnDelete(bool success) {}

void IDBRequest::OnCount(bool success, uint32_t count) {}

void IDBRequest::OnPut(mojom::blink::IDBTransactionPutResultPtr result) {}

void IDBRequest::OnGet(mojom::blink::IDBDatabaseGetResultPtr result) {}

void IDBRequest::OnOpenCursor(
    mojom::blink::IDBDatabaseOpenCursorResultPtr result) {}

void IDBRequest::OnAdvanceCursor(mojom::blink::IDBCursorResultPtr result) {}

void IDBRequest::OnGotKeyGeneratorCurrentNumber(
    int64_t number,
    mojom::blink::IDBErrorPtr error) {}

void IDBRequest::SendError(DOMException* error, bool force) {}

void IDBRequest::HandleError(mojom::blink::IDBErrorPtr error) {}

void IDBRequest::SendResultCursor(
    mojo::PendingAssociatedRemote<mojom::blink::IDBCursor>
        pending_remote_cursor,
    std::unique_ptr<IDBKey> key,
    std::unique_ptr<IDBKey> primary_key,
    std::unique_ptr<IDBValue> value) {}

#if DCHECK_IS_ON()
static IDBObjectStore* EffectiveObjectStore(const IDBRequest::Source* source) {}
#endif  // DCHECK_IS_ON()

void IDBRequest::SendResult(IDBAny* result) {}

void IDBRequest::SetResult(IDBAny* result) {}

void IDBRequest::SendResultValue(std::unique_ptr<IDBValue> value) {}

void IDBRequest::SendResultAdvanceCursor(std::unique_ptr<IDBKey> key,
                                         std::unique_ptr<IDBKey> primary_key,
                                         std::unique_ptr<IDBValue> value) {}

bool IDBRequest::HasPendingActivity() const {}

void IDBRequest::ContextDestroyed() {}

const AtomicString& IDBRequest::InterfaceName() const {}

ExecutionContext* IDBRequest::GetExecutionContext() const {}

DispatchEventResult IDBRequest::DispatchEventInternal(Event& event) {}

void IDBRequest::TransactionDidFinishAndDispatch() {}

}  // namespace blink