OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 ~DatabaseLoader() override { } | 307 ~DatabaseLoader() override { } |
308 | 308 |
309 void execute(IDBDatabase* idbDatabase) override | 309 void execute(IDBDatabase* idbDatabase) override |
310 { | 310 { |
311 const IDBDatabaseMetadata databaseMetadata = idbDatabase->metadata(); | 311 const IDBDatabaseMetadata databaseMetadata = idbDatabase->metadata(); |
312 | 312 |
313 std::unique_ptr<protocol::Array<protocol::IndexedDB::ObjectStore>> objec
tStores = protocol::Array<protocol::IndexedDB::ObjectStore>::create(); | 313 std::unique_ptr<protocol::Array<protocol::IndexedDB::ObjectStore>> objec
tStores = protocol::Array<protocol::IndexedDB::ObjectStore>::create(); |
314 | 314 |
315 for (const auto& storeMapEntry : databaseMetadata.objectStores) { | 315 for (const auto& storeMapEntry : databaseMetadata.objectStores) { |
316 const IDBObjectStoreMetadata& objectStoreMetadata = storeMapEntry.va
lue; | 316 const IDBObjectStoreMetadata& objectStoreMetadata = *storeMapEntry.v
alue; |
317 | 317 |
318 std::unique_ptr<protocol::Array<protocol::IndexedDB::ObjectStoreInde
x>> indexes = protocol::Array<protocol::IndexedDB::ObjectStoreIndex>::create(); | 318 std::unique_ptr<protocol::Array<protocol::IndexedDB::ObjectStoreInde
x>> indexes = protocol::Array<protocol::IndexedDB::ObjectStoreIndex>::create(); |
319 | 319 |
320 for (const auto& metadataMapEntry : objectStoreMetadata.indexes) { | 320 for (const auto& metadataMapEntry : objectStoreMetadata.indexes) { |
321 const IDBIndexMetadata& indexMetadata = metadataMapEntry.value; | 321 const IDBIndexMetadata& indexMetadata = *metadataMapEntry.value; |
322 | 322 |
323 std::unique_ptr<ObjectStoreIndex> objectStoreIndex = ObjectStore
Index::create() | 323 std::unique_ptr<ObjectStoreIndex> objectStoreIndex = ObjectStore
Index::create() |
324 .setName(indexMetadata.name) | 324 .setName(indexMetadata.name) |
325 .setKeyPath(keyPathFromIDBKeyPath(indexMetadata.keyPath)) | 325 .setKeyPath(keyPathFromIDBKeyPath(indexMetadata.keyPath)) |
326 .setUnique(indexMetadata.unique) | 326 .setUnique(indexMetadata.unique) |
327 .setMultiEntry(indexMetadata.multiEntry).build(); | 327 .setMultiEntry(indexMetadata.multiEntry).build(); |
328 indexes->addItem(std::move(objectStoreIndex)); | 328 indexes->addItem(std::move(objectStoreIndex)); |
329 } | 329 } |
330 | 330 |
331 std::unique_ptr<ObjectStore> objectStore = ObjectStore::create() | 331 std::unique_ptr<ObjectStore> objectStore = ObjectStore::create() |
332 .setName(objectStoreMetadata.name) | 332 .setName(objectStoreMetadata.own.name) |
333 .setKeyPath(keyPathFromIDBKeyPath(objectStoreMetadata.keyPath)) | 333 .setKeyPath(keyPathFromIDBKeyPath(objectStoreMetadata.own.keyPat
h)) |
334 .setAutoIncrement(objectStoreMetadata.autoIncrement) | 334 .setAutoIncrement(objectStoreMetadata.own.autoIncrement) |
335 .setIndexes(std::move(indexes)).build(); | 335 .setIndexes(std::move(indexes)).build(); |
336 objectStores->addItem(std::move(objectStore)); | 336 objectStores->addItem(std::move(objectStore)); |
337 } | 337 } |
338 std::unique_ptr<DatabaseWithObjectStores> result = DatabaseWithObjectSto
res::create() | 338 std::unique_ptr<DatabaseWithObjectStores> result = DatabaseWithObjectSto
res::create() |
339 .setName(databaseMetadata.name) | 339 .setName(databaseMetadata.own.name) |
340 .setVersion(databaseMetadata.version) | 340 .setVersion(databaseMetadata.own.version) |
341 .setObjectStores(std::move(objectStores)).build(); | 341 .setObjectStores(std::move(objectStores)).build(); |
342 | 342 |
343 m_requestCallback->sendSuccess(std::move(result)); | 343 m_requestCallback->sendSuccess(std::move(result)); |
344 } | 344 } |
345 | 345 |
346 RequestCallback* getRequestCallback() override { return m_requestCallback.ge
t(); } | 346 RequestCallback* getRequestCallback() override { return m_requestCallback.ge
t(); } |
347 private: | 347 private: |
348 DatabaseLoader(ScriptState* scriptState, std::unique_ptr<RequestDatabaseCall
back> requestCallback) | 348 DatabaseLoader(ScriptState* scriptState, std::unique_ptr<RequestDatabaseCall
back> requestCallback) |
349 : ExecutableWithDatabase(scriptState) | 349 : ExecutableWithDatabase(scriptState) |
350 , m_requestCallback(std::move(requestCallback)) { } | 350 , m_requestCallback(std::move(requestCallback)) { } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 clearObjectStore->start(idbFactory, document->getSecurityOrigin(), databaseN
ame); | 826 clearObjectStore->start(idbFactory, document->getSecurityOrigin(), databaseN
ame); |
827 } | 827 } |
828 | 828 |
829 DEFINE_TRACE(InspectorIndexedDBAgent) | 829 DEFINE_TRACE(InspectorIndexedDBAgent) |
830 { | 830 { |
831 visitor->trace(m_inspectedFrames); | 831 visitor->trace(m_inspectedFrames); |
832 InspectorBaseAgent::trace(visitor); | 832 InspectorBaseAgent::trace(visitor); |
833 } | 833 } |
834 | 834 |
835 } // namespace blink | 835 } // namespace blink |
OLD | NEW |