| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 class ExceptionState; | 45 class ExceptionState; |
| 46 class IDBDatabase; | 46 class IDBDatabase; |
| 47 class IDBObjectStore; | 47 class IDBObjectStore; |
| 48 class IDBOpenDBRequest; | 48 class IDBOpenDBRequest; |
| 49 struct IDBObjectStoreMetadata; | 49 struct IDBObjectStoreMetadata; |
| 50 | 50 |
| 51 class MODULES_EXPORT IDBTransaction final | 51 class MODULES_EXPORT IDBTransaction final |
| 52 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBTransaction> | 52 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBTransaction> |
| 53 , public ActiveDOMObject { | 53 , public ActiveDOMObject { |
| 54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBTransaction); | 54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBTransaction); |
| 55 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); | 55 USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); |
| 56 DEFINE_WRAPPERTYPEINFO(); | 56 DEFINE_WRAPPERTYPEINFO(); |
| 57 public: | 57 public: |
| 58 static IDBTransaction* create(ScriptState*, int64_t, const HashSet<String>&
objectStoreNames, WebIDBTransactionMode, IDBDatabase*); | 58 static IDBTransaction* create(ScriptState*, int64_t, const HashSet<String>&
objectStoreNames, WebIDBTransactionMode, IDBDatabase*); |
| 59 static IDBTransaction* create(ScriptState*, int64_t, IDBDatabase*, IDBOpenDB
Request*, const IDBDatabaseMetadata& previousMetadata); | 59 static IDBTransaction* create(ScriptState*, int64_t, IDBDatabase*, IDBOpenDB
Request*, const IDBDatabaseMetadata& previousMetadata); |
| 60 ~IDBTransaction() override; | 60 ~IDBTransaction() override; |
| 61 DECLARE_VIRTUAL_TRACE(); | 61 DECLARE_VIRTUAL_TRACE(); |
| 62 | 62 |
| 63 static WebIDBTransactionMode stringToMode(const String&); | 63 static WebIDBTransactionMode stringToMode(const String&); |
| 64 | 64 |
| 65 // When the connection is closed backend will be 0. | 65 // When the connection is closed backend will be 0. |
| 66 WebIDBDatabase* backendDB() const; | 66 WebIDBDatabase* backendDB() const; |
| 67 | 67 |
| 68 int64_t id() const { return m_id; } | 68 int64_t id() const { return m_id; } |
| 69 bool isActive() const { return m_state == Active; } | 69 bool isActive() const { return m_state == Active; } |
| 70 bool isFinished() const { return m_state == Finished; } | 70 bool isFinished() const { return m_state == Finished; } |
| 71 bool isFinishing() const { return m_state == Finishing; } | 71 bool isFinishing() const { return m_state == Finishing; } |
| 72 bool isReadOnly() const { return m_mode == WebIDBTransactionModeReadOnly; } | 72 bool isReadOnly() const { return m_mode == WebIDBTransactionModeReadOnly; } |
| 73 bool isVersionChange() const { return m_mode == WebIDBTransactionModeVersion
Change; } | 73 bool isVersionChange() const { return m_mode == WebIDBTransactionModeVersion
Change; } |
| 74 | 74 |
| 75 // Implement the IDBTransaction IDL | 75 // Implement the IDBTransaction IDL |
| 76 const String& mode() const; | 76 const String& mode() const; |
| 77 PassRefPtrWillBeRawPtr<DOMStringList> objectStoreNames() const; | 77 RawPtr<DOMStringList> objectStoreNames() const; |
| 78 IDBDatabase* db() const { return m_database.get(); } | 78 IDBDatabase* db() const { return m_database.get(); } |
| 79 DOMException* error() const { return m_error; } | 79 DOMException* error() const { return m_error; } |
| 80 IDBObjectStore* objectStore(const String& name, ExceptionState&); | 80 IDBObjectStore* objectStore(const String& name, ExceptionState&); |
| 81 void abort(ExceptionState&); | 81 void abort(ExceptionState&); |
| 82 | 82 |
| 83 void registerRequest(IDBRequest*); | 83 void registerRequest(IDBRequest*); |
| 84 void unregisterRequest(IDBRequest*); | 84 void unregisterRequest(IDBRequest*); |
| 85 void objectStoreCreated(const String&, IDBObjectStore*); | 85 void objectStoreCreated(const String&, IDBObjectStore*); |
| 86 void objectStoreDeleted(const String&); | 86 void objectStoreDeleted(const String&); |
| 87 void setActive(bool); | 87 void setActive(bool); |
| 88 void setError(DOMException*); | 88 void setError(DOMException*); |
| 89 | 89 |
| 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
| 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); | 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); |
| 92 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 92 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 93 | 93 |
| 94 void onAbort(DOMException*); | 94 void onAbort(DOMException*); |
| 95 void onComplete(); | 95 void onComplete(); |
| 96 | 96 |
| 97 // EventTarget | 97 // EventTarget |
| 98 const AtomicString& interfaceName() const override; | 98 const AtomicString& interfaceName() const override; |
| 99 ExecutionContext* executionContext() const override; | 99 ExecutionContext* executionContext() const override; |
| 100 | 100 |
| 101 // ActiveDOMObject | 101 // ActiveDOMObject |
| 102 bool hasPendingActivity() const override; | 102 bool hasPendingActivity() const override; |
| 103 void stop() override; | 103 void stop() override; |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 // EventTarget | 106 // EventTarget |
| 107 bool dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) override; | 107 bool dispatchEventInternal(RawPtr<Event>) override; |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 IDBTransaction(ScriptState*, int64_t, const HashSet<String>&, WebIDBTransact
ionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&); | 110 IDBTransaction(ScriptState*, int64_t, const HashSet<String>&, WebIDBTransact
ionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&); |
| 111 | 111 |
| 112 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 112 void enqueueEvent(RawPtr<Event>); |
| 113 | 113 |
| 114 enum State { | 114 enum State { |
| 115 Inactive, // Created or started, but not in an event callback | 115 Inactive, // Created or started, but not in an event callback |
| 116 Active, // Created or started, in creation scope or an event callback | 116 Active, // Created or started, in creation scope or an event callback |
| 117 Finishing, // In the process of aborting or completing. | 117 Finishing, // In the process of aborting or completing. |
| 118 Finished, // No more events will fire and no new requests may be filed. | 118 Finished, // No more events will fire and no new requests may be filed. |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 const int64_t m_id; | 121 const int64_t m_id; |
| 122 Member<IDBDatabase> m_database; | 122 Member<IDBDatabase> m_database; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 134 IDBObjectStoreMap m_objectStoreMap; | 134 IDBObjectStoreMap m_objectStoreMap; |
| 135 | 135 |
| 136 HeapHashSet<Member<IDBObjectStore>> m_deletedObjectStores; | 136 HeapHashSet<Member<IDBObjectStore>> m_deletedObjectStores; |
| 137 HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> m_objectStoreCle
anupMap; | 137 HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> m_objectStoreCle
anupMap; |
| 138 IDBDatabaseMetadata m_previousMetadata; | 138 IDBDatabaseMetadata m_previousMetadata; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 } // namespace blink | 141 } // namespace blink |
| 142 | 142 |
| 143 #endif // IDBTransaction_h | 143 #endif // IDBTransaction_h |
| OLD | NEW |