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

Unified Diff: content/browser/in_process_webkit/indexed_db_dispatcher_host.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
Index: content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
index 1f5112509ef6803422e23de14ff2fd322e4095d8..79ce4d980a871eae029b4f255b8d15d172279fd4 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -26,6 +26,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBIndex.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
@@ -51,6 +52,7 @@ using WebKit::WebIDBIndex;
using WebKit::WebIDBKey;
using WebKit::WebIDBKeyPath;
using WebKit::WebIDBKeyRange;
+using WebKit::WebIDBMetadata;
using WebKit::WebIDBObjectStore;
using WebKit::WebIDBTransaction;
using WebKit::WebSecurityOrigin;
@@ -324,6 +326,7 @@ bool IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(IndexedDBDispatcherHost::DatabaseDispatcherHost,
message, *msg_is_ok)
+ IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseMetadata, OnMetadata)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseName, OnName)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseVersion, OnVersion)
IPC_MESSAGE_HANDLER(IndexedDBHostMsg_DatabaseObjectStoreNames,
@@ -347,6 +350,39 @@ void IndexedDBDispatcherHost::DatabaseDispatcherHost::Send(
parent_->Send(message);
}
+void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnMetadata(
+ int32 idb_database_id, IndexedDBDatabaseMetadata* metadata) {
+ WebIDBDatabase* idb_database = parent_->GetOrTerminateProcess(
+ &map_, idb_database_id);
+ if (!idb_database)
+ return;
+
+ WebIDBMetadata web_metadata = idb_database->metadata();
+ metadata->name = web_metadata.name;
+ metadata->version = web_metadata.version;
+
+ for (size_t i = 0; i < web_metadata.objectStores.size(); ++i) {
+ const WebIDBMetadata::ObjectStore& web_store_metadata =
+ web_metadata.objectStores[i];
+ IndexedDBObjectStoreMetadata idb_store_metadata;
+ idb_store_metadata.name = web_store_metadata.name;
+ idb_store_metadata.keyPath = IndexedDBKeyPath(web_store_metadata.keyPath);
+ idb_store_metadata.autoIncrement = web_store_metadata.autoIncrement;
+
+ for (size_t j = 0; j < web_store_metadata.indexes.size(); ++j) {
+ const WebIDBMetadata::Index& web_index_metadata =
+ web_store_metadata.indexes[j];
+ IndexedDBIndexMetadata idb_index_metadata;
+ idb_index_metadata.name = web_index_metadata.name;
+ idb_index_metadata.keyPath = IndexedDBKeyPath(web_index_metadata.keyPath);
+ idb_index_metadata.unique = web_index_metadata.unique;
+ idb_index_metadata.multiEntry = web_index_metadata.multiEntry;
+ idb_store_metadata.indexes.push_back(idb_index_metadata);
+ }
+ metadata->object_stores.push_back(idb_store_metadata);
+ }
+}
+
void IndexedDBDispatcherHost::DatabaseDispatcherHost::OnName(
int32 object_id, string16* name) {
parent_->SyncGetter<string16>(&map_, object_id, name, &WebIDBDatabase::name);
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.h ('k') | content/common/indexed_db/indexed_db_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698