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

Unified Diff: Source/modules/indexeddb/WebIDBCallbacksImpl.cpp

Issue 67463006: IndexedDB: Simplify WebIDBCallbacks exports, strip IDBFactoryBackend (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Re-up Created 7 years, 1 month 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
« no previous file with comments | « Source/modules/indexeddb/WebIDBCallbacksImpl.h ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
diff --git a/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp b/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..9fa9f2fd6abc13996a4a2f8a68c0ae161cd1f8b3
--- /dev/null
+++ b/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2013 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. 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 GOOGLE INC.
+ * 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 "config.h"
+#include "modules/indexeddb/WebIDBCallbacksImpl.h"
+
+#include "core/dom/DOMError.h"
+#include "modules/indexeddb/IDBMetadata.h"
+#include "modules/indexeddb/IDBRequest.h"
+#include "platform/SharedBuffer.h"
+#include "public/platform/WebData.h"
+#include "public/platform/WebIDBCursor.h"
+#include "public/platform/WebIDBDatabase.h"
+#include "public/platform/WebIDBDatabaseError.h"
+#include "public/platform/WebIDBKey.h"
+
+using blink::WebData;
+using blink::WebIDBCursor;
+using blink::WebIDBDatabase;
+using blink::WebIDBDatabaseError;
+using blink::WebIDBIndex;
+using blink::WebIDBKey;
+using blink::WebIDBKeyPath;
+using blink::WebIDBMetadata;
+
+namespace WebCore {
+
+// static
+PassOwnPtr<WebIDBCallbacksImpl> WebIDBCallbacksImpl::create(PassRefPtr<IDBRequest> request)
+{
+ return adoptPtr(new WebIDBCallbacksImpl(request));
+}
+
+WebIDBCallbacksImpl::WebIDBCallbacksImpl(PassRefPtr<IDBRequest> request)
+ : m_request(request)
+{
+}
+
+WebIDBCallbacksImpl::~WebIDBCallbacksImpl()
+{
+}
+
+void WebIDBCallbacksImpl::onError(const WebIDBDatabaseError& error)
+{
+ m_request->onError(error);
+}
+
+void WebIDBCallbacksImpl::onSuccess(const blink::WebVector<blink::WebString>& webStringList)
+{
+ Vector<String> stringList;
+ for (size_t i = 0; i < webStringList.size(); ++i)
+ stringList.append(webStringList[i]);
+ m_request->onSuccess(stringList);
+}
+
+void WebIDBCallbacksImpl::onSuccess(WebIDBCursor* cursor, const WebIDBKey& key, const WebIDBKey& primaryKey, const WebData& value)
+{
+ m_request->onSuccess(adoptPtr(cursor), key, primaryKey, value);
+}
+
+void WebIDBCallbacksImpl::onSuccess(WebIDBDatabase* backend, const WebIDBMetadata& metadata)
+{
+ m_request->onSuccess(adoptPtr(backend), metadata);
+}
+
+void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key)
+{
+ m_request->onSuccess(key);
+}
+
+void WebIDBCallbacksImpl::onSuccess(const WebData& value)
+{
+ m_request->onSuccess(value);
+}
+
+void WebIDBCallbacksImpl::onSuccess(const WebData& value, const WebIDBKey& key, const WebIDBKeyPath& keyPath)
+{
+ m_request->onSuccess(value, key, keyPath);
+}
+
+void WebIDBCallbacksImpl::onSuccess(long long value)
+{
+ m_request->onSuccess(value);
+}
+
+void WebIDBCallbacksImpl::onSuccess()
+{
+ m_request->onSuccess();
+}
+
+void WebIDBCallbacksImpl::onSuccess(const WebIDBKey& key, const WebIDBKey& primaryKey, const WebData& value)
+{
+ m_request->onSuccess(key, primaryKey, value);
+}
+
+void WebIDBCallbacksImpl::onBlocked(long long oldVersion)
+{
+ m_request->onBlocked(oldVersion);
+}
+
+void WebIDBCallbacksImpl::onUpgradeNeeded(long long oldVersion, WebIDBDatabase* database, const WebIDBMetadata& metadata, unsigned short dataLoss, blink::WebString dataLossMessage)
+{
+ m_request->onUpgradeNeeded(oldVersion, adoptPtr(database), metadata, static_cast<blink::WebIDBDataLoss>(dataLoss), dataLossMessage);
+}
+
+} // namespace blink
« no previous file with comments | « Source/modules/indexeddb/WebIDBCallbacksImpl.h ('k') | Source/modules/modules.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698