OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "modules/indexeddb/IDBDatabaseObserverImpl.h" |
| 6 |
| 7 #include "core/dom/DOMException.h" |
| 8 #include "modules/indexeddb/IDBDatabase.h" |
| 9 #include "modules/indexeddb/IDBOpenDBRequest.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 indexed_db::mojom::blink::DatabaseObserverPtr IDBDatabaseObserverImpl::Create(ID
BOpenDBRequest* request) |
| 14 { |
| 15 indexed_db::mojom::blink::DatabaseObserverPtr observer; |
| 16 // TODO(cmumford): Comment why this doesn't leak. |
| 17 new IDBDatabaseObserverImpl(GetProxy(&observer), request); |
| 18 return observer; |
| 19 } |
| 20 |
| 21 IDBDatabaseObserverImpl::IDBDatabaseObserverImpl(indexed_db::mojom::blink::Datab
aseObserverRequest request, IDBOpenDBRequest* openRequest) |
| 22 : m_request(openRequest) |
| 23 , m_binding(this, std::move(request)) |
| 24 { |
| 25 } |
| 26 |
| 27 IDBDatabaseObserverImpl::~IDBDatabaseObserverImpl() |
| 28 { |
| 29 // TODO(cmumford): Implement this. |
| 30 } |
| 31 |
| 32 void IDBDatabaseObserverImpl::OnTransactionAborted(int64_t hostTransactionId, in
dexed_db::mojom::blink::ErrorInfoPtr error) |
| 33 { |
| 34 if (!m_request->getDatabase()) |
| 35 return; |
| 36 // use type-mapping to get correct values. |
| 37 DOMException* exception = DOMException::create(error->code, |
| 38 error->message, |
| 39 error->message); |
| 40 m_request->getDatabase()->onAbort(hostTransactionId, exception); |
| 41 } |
| 42 |
| 43 void IDBDatabaseObserverImpl::OnTransactionCompleted(int64_t hostTransactionId) |
| 44 { |
| 45 if (!m_request->getDatabase()) |
| 46 return; |
| 47 m_request->getDatabase()->onComplete(hostTransactionId); |
| 48 } |
| 49 |
| 50 void IDBDatabaseObserverImpl::OnForcedClosed() |
| 51 { |
| 52 NOTREACHED(); |
| 53 } |
| 54 |
| 55 void IDBDatabaseObserverImpl::OnVersionChange(int64_t oldVersion, int64_t newVer
sion) |
| 56 { |
| 57 NOTREACHED(); |
| 58 } |
| 59 |
| 60 DEFINE_TRACE(IDBDatabaseObserverImpl) |
| 61 { |
| 62 visitor->trace(m_request); |
| 63 } |
| 64 |
| 65 } // namespace blink |
OLD | NEW |