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

Unified Diff: content/common/indexed_db/proxy_webidbdatabase_impl.cc

Issue 10533057: IPC plumbing for IndexedDB to snapshot metadata to the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified naming on WK side Created 8 years, 6 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
« no previous file with comments | « content/common/indexed_db/proxy_webidbdatabase_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/indexed_db/proxy_webidbdatabase_impl.cc
diff --git a/content/common/indexed_db/proxy_webidbdatabase_impl.cc b/content/common/indexed_db/proxy_webidbdatabase_impl.cc
index 5e53f7b635c7738c57a94cffb850325c930cb556..0a8f9c4e1795b51c72255092c1b71e278a62fce3 100644
--- a/content/common/indexed_db/proxy_webidbdatabase_impl.cc
+++ b/content/common/indexed_db/proxy_webidbdatabase_impl.cc
@@ -10,6 +10,7 @@
#include "content/common/indexed_db/proxy_webidbobjectstore_impl.h"
#include "content/common/indexed_db/proxy_webidbtransaction_impl.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
#include "webkit/glue/worker_task_runner.h"
@@ -19,6 +20,7 @@ using WebKit::WebExceptionCode;
using WebKit::WebFrame;
using WebKit::WebIDBCallbacks;
using WebKit::WebIDBDatabaseCallbacks;
+using WebKit::WebIDBMetadata;
using WebKit::WebIDBKeyPath;
using WebKit::WebIDBTransaction;
using WebKit::WebString;
@@ -38,6 +40,45 @@ RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() {
idb_database_id_));
}
+WebIDBMetadata RendererWebIDBDatabaseImpl::metadata() const {
+ IndexedDBDatabaseMetadata idb_metadata;
+ IndexedDBDispatcher::Send(
+ new IndexedDBHostMsg_DatabaseMetadata(idb_database_id_, &idb_metadata));
+
+ WebIDBMetadata web_metadata;
+ web_metadata.name = idb_metadata.name;
+ web_metadata.version = idb_metadata.version;
+ web_metadata.objectStores = WebVector<WebIDBMetadata::ObjectStore>(
+ idb_metadata.object_stores.size());
+
+ for (size_t i = 0; i < idb_metadata.object_stores.size(); ++i) {
+ const IndexedDBObjectStoreMetadata& idb_store_metadata =
+ idb_metadata.object_stores[i];
+ WebIDBMetadata::ObjectStore& web_store_metadata =
+ web_metadata.objectStores[i];
+
+ web_store_metadata.name = idb_store_metadata.name;
+ web_store_metadata.keyPath = idb_store_metadata.keyPath;
+ web_store_metadata.autoIncrement = idb_store_metadata.autoIncrement;
+ web_store_metadata.indexes = WebVector<WebIDBMetadata::Index>(
+ idb_store_metadata.indexes.size());
+
+ for (size_t j = 0; j < idb_store_metadata.indexes.size(); ++j) {
+ const IndexedDBIndexMetadata& idb_index_metadata =
+ idb_store_metadata.indexes[j];
+ WebIDBMetadata::Index& web_index_metadata =
+ web_store_metadata.indexes[j];
+
+ web_index_metadata.name = idb_index_metadata.name;
+ web_index_metadata.keyPath = idb_index_metadata.keyPath;
+ web_index_metadata.unique = idb_index_metadata.unique;
+ web_index_metadata.multiEntry = idb_index_metadata.multiEntry;
+ }
+ }
+
+ return web_metadata;
+}
+
WebString RendererWebIDBDatabaseImpl::name() const {
string16 result;
IndexedDBDispatcher::Send(
« no previous file with comments | « content/common/indexed_db/proxy_webidbdatabase_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698