| Index: third_party/WebKit/Source/modules/indexeddb/IDBDatabaseObserverImpl.cpp
|
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabaseObserverImpl.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabaseObserverImpl.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7a39fd7a8ee76961eeac906f565dae1025ff741f
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabaseObserverImpl.cpp
|
| @@ -0,0 +1,65 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "modules/indexeddb/IDBDatabaseObserverImpl.h"
|
| +
|
| +#include "core/dom/DOMException.h"
|
| +#include "modules/indexeddb/IDBDatabase.h"
|
| +#include "modules/indexeddb/IDBOpenDBRequest.h"
|
| +
|
| +namespace blink {
|
| +
|
| +indexed_db::mojom::blink::DatabaseObserverPtr IDBDatabaseObserverImpl::Create(IDBOpenDBRequest* request)
|
| +{
|
| + indexed_db::mojom::blink::DatabaseObserverPtr observer;
|
| + // TODO(cmumford): Comment why this doesn't leak.
|
| + new IDBDatabaseObserverImpl(GetProxy(&observer), request);
|
| + return observer;
|
| +}
|
| +
|
| +IDBDatabaseObserverImpl::IDBDatabaseObserverImpl(indexed_db::mojom::blink::DatabaseObserverRequest request, IDBOpenDBRequest* openRequest)
|
| + : m_request(openRequest)
|
| + , m_binding(this, std::move(request))
|
| +{
|
| +}
|
| +
|
| +IDBDatabaseObserverImpl::~IDBDatabaseObserverImpl()
|
| +{
|
| + // TODO(cmumford): Implement this.
|
| +}
|
| +
|
| +void IDBDatabaseObserverImpl::OnTransactionAborted(int64_t hostTransactionId, indexed_db::mojom::blink::ErrorInfoPtr error)
|
| +{
|
| + if (!m_request->getDatabase())
|
| + return;
|
| + // use type-mapping to get correct values.
|
| + DOMException* exception = DOMException::create(error->code,
|
| + error->message,
|
| + error->message);
|
| + m_request->getDatabase()->onAbort(hostTransactionId, exception);
|
| +}
|
| +
|
| +void IDBDatabaseObserverImpl::OnTransactionCompleted(int64_t hostTransactionId)
|
| +{
|
| + if (!m_request->getDatabase())
|
| + return;
|
| + m_request->getDatabase()->onComplete(hostTransactionId);
|
| +}
|
| +
|
| +void IDBDatabaseObserverImpl::OnForcedClosed()
|
| +{
|
| + NOTREACHED();
|
| +}
|
| +
|
| +void IDBDatabaseObserverImpl::OnVersionChange(int64_t oldVersion, int64_t newVersion)
|
| +{
|
| + NOTREACHED();
|
| +}
|
| +
|
| +DEFINE_TRACE(IDBDatabaseObserverImpl)
|
| +{
|
| + visitor->trace(m_request);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|