| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/EventNames.h" | 34 #include "core/dom/EventNames.h" |
| 35 #include "core/dom/EventTarget.h" | 35 #include "core/dom/EventTarget.h" |
| 36 #include "modules/indexeddb/IDBMetadata.h" | 36 #include "modules/indexeddb/IDBMetadata.h" |
| 37 #include "modules/indexeddb/IndexedDB.h" | 37 #include "modules/indexeddb/IndexedDB.h" |
| 38 #include "wtf/HashSet.h" | 38 #include "wtf/HashSet.h" |
| 39 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 class DOMError; | 43 class DOMError; |
| 44 class ExceptionState; |
| 44 class IDBCursor; | 45 class IDBCursor; |
| 45 class IDBDatabase; | 46 class IDBDatabase; |
| 46 class IDBDatabaseBackendInterface; | 47 class IDBDatabaseBackendInterface; |
| 47 class IDBObjectStore; | 48 class IDBObjectStore; |
| 48 class IDBOpenDBRequest; | 49 class IDBOpenDBRequest; |
| 49 struct IDBObjectStoreMetadata; | 50 struct IDBObjectStoreMetadata; |
| 50 | 51 |
| 51 class IDBTransaction : public ScriptWrappable, public RefCounted<IDBTransaction>
, public EventTarget, public ActiveDOMObject { | 52 class IDBTransaction : public ScriptWrappable, public RefCounted<IDBTransaction>
, public EventTarget, public ActiveDOMObject { |
| 52 public: | 53 public: |
| 53 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, c
onst Vector<String>& objectStoreNames, IndexedDB::TransactionMode, IDBDatabase*)
; | 54 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, c
onst Vector<String>& objectStoreNames, IndexedDB::TransactionMode, IDBDatabase*)
; |
| 54 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, I
DBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata& previousMetadata); | 55 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, I
DBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata& previousMetadata); |
| 55 virtual ~IDBTransaction(); | 56 virtual ~IDBTransaction(); |
| 56 | 57 |
| 57 static const AtomicString& modeReadOnly(); | 58 static const AtomicString& modeReadOnly(); |
| 58 static const AtomicString& modeReadWrite(); | 59 static const AtomicString& modeReadWrite(); |
| 59 static const AtomicString& modeVersionChange(); | 60 static const AtomicString& modeVersionChange(); |
| 60 static const AtomicString& modeReadOnlyLegacy(); | 61 static const AtomicString& modeReadOnlyLegacy(); |
| 61 static const AtomicString& modeReadWriteLegacy(); | 62 static const AtomicString& modeReadWriteLegacy(); |
| 62 | 63 |
| 63 static IndexedDB::TransactionMode stringToMode(const String&, ExceptionCode&
); | 64 static IndexedDB::TransactionMode stringToMode(const String&, ExceptionState
&); |
| 64 static const AtomicString& modeToString(IndexedDB::TransactionMode); | 65 static const AtomicString& modeToString(IndexedDB::TransactionMode); |
| 65 | 66 |
| 66 IDBDatabaseBackendInterface* backendDB() const; | 67 IDBDatabaseBackendInterface* backendDB() const; |
| 67 | 68 |
| 68 int64_t id() const { return m_id; } | 69 int64_t id() const { return m_id; } |
| 69 bool isActive() const { return m_state == Active; } | 70 bool isActive() const { return m_state == Active; } |
| 70 bool isFinished() const { return m_state == Finished; } | 71 bool isFinished() const { return m_state == Finished; } |
| 71 bool isReadOnly() const { return m_mode == IndexedDB::TransactionReadOnly; } | 72 bool isReadOnly() const { return m_mode == IndexedDB::TransactionReadOnly; } |
| 72 bool isVersionChange() const { return m_mode == IndexedDB::TransactionVersio
nChange; } | 73 bool isVersionChange() const { return m_mode == IndexedDB::TransactionVersio
nChange; } |
| 73 | 74 |
| 74 // Implement the IDBTransaction IDL | 75 // Implement the IDBTransaction IDL |
| 75 const String& mode() const; | 76 const String& mode() const; |
| 76 IDBDatabase* db() const { return m_database.get(); } | 77 IDBDatabase* db() const { return m_database.get(); } |
| 77 PassRefPtr<DOMError> error() const { return m_error; } | 78 PassRefPtr<DOMError> error() const { return m_error; } |
| 78 PassRefPtr<IDBObjectStore> objectStore(const String& name, ExceptionCode&); | 79 PassRefPtr<IDBObjectStore> objectStore(const String& name, ExceptionState&); |
| 79 void abort(ExceptionCode&); | 80 void abort(ExceptionState&); |
| 80 | 81 |
| 81 class OpenCursorNotifier { | 82 class OpenCursorNotifier { |
| 82 public: | 83 public: |
| 83 OpenCursorNotifier(PassRefPtr<IDBTransaction>, IDBCursor*); | 84 OpenCursorNotifier(PassRefPtr<IDBTransaction>, IDBCursor*); |
| 84 ~OpenCursorNotifier(); | 85 ~OpenCursorNotifier(); |
| 85 void cursorFinished(); | 86 void cursorFinished(); |
| 86 private: | 87 private: |
| 87 RefPtr<IDBTransaction> m_transaction; | 88 RefPtr<IDBTransaction> m_transaction; |
| 88 IDBCursor* m_cursor; | 89 IDBCursor* m_cursor; |
| 89 }; | 90 }; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 IDBDatabaseMetadata m_previousMetadata; | 163 IDBDatabaseMetadata m_previousMetadata; |
| 163 | 164 |
| 164 HashSet<IDBCursor*> m_openCursors; | 165 HashSet<IDBCursor*> m_openCursors; |
| 165 | 166 |
| 166 EventTargetData m_eventTargetData; | 167 EventTargetData m_eventTargetData; |
| 167 }; | 168 }; |
| 168 | 169 |
| 169 } // namespace WebCore | 170 } // namespace WebCore |
| 170 | 171 |
| 171 #endif // IDBTransaction_h | 172 #endif // IDBTransaction_h |
| OLD | NEW |