Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBDatabaseObserverImpl.cpp

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698