| 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 24 matching lines...) Expand all Loading... |
| 35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 36 #include "bindings/core/v8/ScriptController.h" | 36 #include "bindings/core/v8/ScriptController.h" |
| 37 #include "bindings/core/v8/ScriptState.h" | 37 #include "bindings/core/v8/ScriptState.h" |
| 38 #include "core/dom/DOMStringList.h" | 38 #include "core/dom/DOMStringList.h" |
| 39 #include "core/dom/Document.h" | 39 #include "core/dom/Document.h" |
| 40 #include "core/events/EventListener.h" | 40 #include "core/events/EventListener.h" |
| 41 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 42 #include "core/inspector/InspectorController.h" | 42 #include "core/inspector/InspectorController.h" |
| 43 #include "core/inspector/InspectorState.h" | 43 #include "core/inspector/InspectorState.h" |
| 44 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
| 45 #include "modules/IndexedDBNames.h" |
| 45 #include "modules/indexeddb/DOMWindowIndexedDatabase.h" | 46 #include "modules/indexeddb/DOMWindowIndexedDatabase.h" |
| 46 #include "modules/indexeddb/IDBCursor.h" | 47 #include "modules/indexeddb/IDBCursor.h" |
| 47 #include "modules/indexeddb/IDBCursorWithValue.h" | 48 #include "modules/indexeddb/IDBCursorWithValue.h" |
| 48 #include "modules/indexeddb/IDBDatabase.h" | 49 #include "modules/indexeddb/IDBDatabase.h" |
| 49 #include "modules/indexeddb/IDBFactory.h" | 50 #include "modules/indexeddb/IDBFactory.h" |
| 50 #include "modules/indexeddb/IDBIndex.h" | 51 #include "modules/indexeddb/IDBIndex.h" |
| 51 #include "modules/indexeddb/IDBKey.h" | 52 #include "modules/indexeddb/IDBKey.h" |
| 52 #include "modules/indexeddb/IDBKeyPath.h" | 53 #include "modules/indexeddb/IDBKeyPath.h" |
| 53 #include "modules/indexeddb/IDBKeyRange.h" | 54 #include "modules/indexeddb/IDBKeyRange.h" |
| 54 #include "modules/indexeddb/IDBMetadata.h" | 55 #include "modules/indexeddb/IDBMetadata.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 RefPtr<OpenDatabaseCallback> callback = OpenDatabaseCallback::create(this); | 194 RefPtr<OpenDatabaseCallback> callback = OpenDatabaseCallback::create(this); |
| 194 TrackExceptionState exceptionState; | 195 TrackExceptionState exceptionState; |
| 195 IDBOpenDBRequest* idbOpenDBRequest = idbFactory->open(scriptState(), databas
eName, exceptionState); | 196 IDBOpenDBRequest* idbOpenDBRequest = idbFactory->open(scriptState(), databas
eName, exceptionState); |
| 196 if (exceptionState.hadException()) { | 197 if (exceptionState.hadException()) { |
| 197 requestCallback()->sendFailure("Could not open database."); | 198 requestCallback()->sendFailure("Could not open database."); |
| 198 return; | 199 return; |
| 199 } | 200 } |
| 200 idbOpenDBRequest->addEventListener(EventTypeNames::success, callback, false)
; | 201 idbOpenDBRequest->addEventListener(EventTypeNames::success, callback, false)
; |
| 201 } | 202 } |
| 202 | 203 |
| 203 static IDBTransaction* transactionForDatabase(ExecutionContext* executionContext
, IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode =
IDBTransaction::modeReadOnly()) | 204 static IDBTransaction* transactionForDatabase(ExecutionContext* executionContext
, IDBDatabase* idbDatabase, const String& objectStoreName, const String& mode =
IndexedDBNames::readonly) |
| 204 { | 205 { |
| 205 TrackExceptionState exceptionState; | 206 TrackExceptionState exceptionState; |
| 206 IDBTransaction* idbTransaction = idbDatabase->transaction(executionContext,
objectStoreName, mode, exceptionState); | 207 IDBTransaction* idbTransaction = idbDatabase->transaction(executionContext,
objectStoreName, mode, exceptionState); |
| 207 if (exceptionState.hadException()) | 208 if (exceptionState.hadException()) |
| 208 return 0; | 209 return 0; |
| 209 return idbTransaction; | 210 return idbTransaction; |
| 210 } | 211 } |
| 211 | 212 |
| 212 static IDBObjectStore* objectStoreForTransaction(IDBTransaction* idbTransaction,
const String& objectStoreName) | 213 static IDBObjectStore* objectStoreForTransaction(IDBTransaction* idbTransaction,
const String& objectStoreName) |
| 213 { | 214 { |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 : ExecutableWithDatabase(scriptState) | 724 : ExecutableWithDatabase(scriptState) |
| 724 , m_objectStoreName(objectStoreName) | 725 , m_objectStoreName(objectStoreName) |
| 725 , m_requestCallback(requestCallback) | 726 , m_requestCallback(requestCallback) |
| 726 { | 727 { |
| 727 } | 728 } |
| 728 | 729 |
| 729 virtual void execute(IDBDatabase* idbDatabase) OVERRIDE | 730 virtual void execute(IDBDatabase* idbDatabase) OVERRIDE |
| 730 { | 731 { |
| 731 if (!requestCallback()->isActive()) | 732 if (!requestCallback()->isActive()) |
| 732 return; | 733 return; |
| 733 IDBTransaction* idbTransaction = transactionForDatabase(context(), idbDa
tabase, m_objectStoreName, IDBTransaction::modeReadWrite()); | 734 IDBTransaction* idbTransaction = transactionForDatabase(context(), idbDa
tabase, m_objectStoreName, IndexedDBNames::readwrite); |
| 734 if (!idbTransaction) { | 735 if (!idbTransaction) { |
| 735 m_requestCallback->sendFailure("Could not get transaction"); | 736 m_requestCallback->sendFailure("Could not get transaction"); |
| 736 return; | 737 return; |
| 737 } | 738 } |
| 738 IDBObjectStore* idbObjectStore = objectStoreForTransaction(idbTransactio
n, m_objectStoreName); | 739 IDBObjectStore* idbObjectStore = objectStoreForTransaction(idbTransactio
n, m_objectStoreName); |
| 739 if (!idbObjectStore) { | 740 if (!idbObjectStore) { |
| 740 m_requestCallback->sendFailure("Could not get object store"); | 741 m_requestCallback->sendFailure("Could not get object store"); |
| 741 return; | 742 return; |
| 742 } | 743 } |
| 743 | 744 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 774 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); | 775 clearObjectStore->start(idbFactory, document->securityOrigin(), databaseName
); |
| 775 } | 776 } |
| 776 | 777 |
| 777 void InspectorIndexedDBAgent::trace(Visitor* visitor) | 778 void InspectorIndexedDBAgent::trace(Visitor* visitor) |
| 778 { | 779 { |
| 779 visitor->trace(m_page); | 780 visitor->trace(m_page); |
| 780 InspectorBaseAgent::trace(visitor); | 781 InspectorBaseAgent::trace(visitor); |
| 781 } | 782 } |
| 782 | 783 |
| 783 } // namespace blink | 784 } // namespace blink |
| OLD | NEW |