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

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: Use IPC macros rather than introducing new classes 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
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..71b7fe5cdb18e94694acc1ad36ef8106e4cc7cf4 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,7 +20,10 @@ using WebKit::WebExceptionCode;
using WebKit::WebFrame;
using WebKit::WebIDBCallbacks;
using WebKit::WebIDBDatabaseCallbacks;
+using WebKit::WebIDBDatabaseMetadata;
+using WebKit::WebIDBIndexMetadata;
using WebKit::WebIDBKeyPath;
+using WebKit::WebIDBObjectStoreMetadata;
using WebKit::WebIDBTransaction;
using WebKit::WebString;
using WebKit::WebVector;
@@ -38,6 +42,45 @@ RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() {
idb_database_id_));
}
+WebIDBDatabaseMetadata RendererWebIDBDatabaseImpl::metadata() const {
+ IndexedDBDatabaseMetadata idb_metadata;
+ IndexedDBDispatcher::Send(
+ new IndexedDBHostMsg_DatabaseMetadata(idb_database_id_, &idb_metadata));
+
+ WebIDBDatabaseMetadata web_db_metadata;
+ web_db_metadata.name = idb_metadata.name;
+ web_db_metadata.version = idb_metadata.version;
+ web_db_metadata.objectStores = WebVector<WebIDBObjectStoreMetadata>(
+ 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];
+ WebIDBObjectStoreMetadata& web_store_metadata =
+ web_db_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<WebIDBIndexMetadata>(
+ 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];
+ WebIDBIndexMetadata& 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_db_metadata;
+}
+
WebString RendererWebIDBDatabaseImpl::name() const {
string16 result;
IndexedDBDispatcher::Send(

Powered by Google App Engine
This is Rietveld 408576698