| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class IDBDatabase; | 47 class IDBDatabase; |
| 48 class IDBObjectStore; | 48 class IDBObjectStore; |
| 49 class IDBOpenDBRequest; | 49 class IDBOpenDBRequest; |
| 50 struct IDBObjectStoreMetadata; | 50 struct IDBObjectStoreMetadata; |
| 51 | 51 |
| 52 class MODULES_EXPORT IDBTransaction final | 52 class MODULES_EXPORT IDBTransaction final |
| 53 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBTransaction> | 53 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBTransaction> |
| 54 , public ActiveScriptWrappable | 54 , public ActiveScriptWrappable |
| 55 , public ActiveDOMObject { | 55 , public ActiveDOMObject { |
| 56 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBTransaction); | 56 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBTransaction); |
| 57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); | 57 USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); |
| 58 DEFINE_WRAPPERTYPEINFO(); | 58 DEFINE_WRAPPERTYPEINFO(); |
| 59 public: | 59 public: |
| 60 static IDBTransaction* create(ScriptState*, int64_t, const HashSet<String>&
objectStoreNames, WebIDBTransactionMode, IDBDatabase*); | 60 static IDBTransaction* create(ScriptState*, int64_t, const HashSet<String>&
objectStoreNames, WebIDBTransactionMode, IDBDatabase*); |
| 61 static IDBTransaction* create(ScriptState*, int64_t, IDBDatabase*, IDBOpenDB
Request*, const IDBDatabaseMetadata& previousMetadata); | 61 static IDBTransaction* create(ScriptState*, int64_t, IDBDatabase*, IDBOpenDB
Request*, const IDBDatabaseMetadata& previousMetadata); |
| 62 ~IDBTransaction() override; | 62 ~IDBTransaction() override; |
| 63 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
| 64 | 64 |
| 65 static WebIDBTransactionMode stringToMode(const String&); | 65 static WebIDBTransactionMode stringToMode(const String&); |
| 66 | 66 |
| 67 // When the connection is closed backend will be 0. | 67 // When the connection is closed backend will be 0. |
| 68 WebIDBDatabase* backendDB() const; | 68 WebIDBDatabase* backendDB() const; |
| 69 | 69 |
| 70 int64_t id() const { return m_id; } | 70 int64_t id() const { return m_id; } |
| 71 bool isActive() const { return m_state == Active; } | 71 bool isActive() const { return m_state == Active; } |
| 72 bool isFinished() const { return m_state == Finished; } | 72 bool isFinished() const { return m_state == Finished; } |
| 73 bool isFinishing() const { return m_state == Finishing; } | 73 bool isFinishing() const { return m_state == Finishing; } |
| 74 bool isReadOnly() const { return m_mode == WebIDBTransactionModeReadOnly; } | 74 bool isReadOnly() const { return m_mode == WebIDBTransactionModeReadOnly; } |
| 75 bool isVersionChange() const { return m_mode == WebIDBTransactionModeVersion
Change; } | 75 bool isVersionChange() const { return m_mode == WebIDBTransactionModeVersion
Change; } |
| 76 | 76 |
| 77 // Implement the IDBTransaction IDL | 77 // Implement the IDBTransaction IDL |
| 78 const String& mode() const; | 78 const String& mode() const; |
| 79 PassRefPtrWillBeRawPtr<DOMStringList> objectStoreNames() const; | 79 RawPtr<DOMStringList> objectStoreNames() const; |
| 80 IDBDatabase* db() const { return m_database.get(); } | 80 IDBDatabase* db() const { return m_database.get(); } |
| 81 DOMException* error() const { return m_error; } | 81 DOMException* error() const { return m_error; } |
| 82 IDBObjectStore* objectStore(const String& name, ExceptionState&); | 82 IDBObjectStore* objectStore(const String& name, ExceptionState&); |
| 83 void abort(ExceptionState&); | 83 void abort(ExceptionState&); |
| 84 | 84 |
| 85 void registerRequest(IDBRequest*); | 85 void registerRequest(IDBRequest*); |
| 86 void unregisterRequest(IDBRequest*); | 86 void unregisterRequest(IDBRequest*); |
| 87 void objectStoreCreated(const String&, IDBObjectStore*); | 87 void objectStoreCreated(const String&, IDBObjectStore*); |
| 88 void objectStoreDeleted(const String&); | 88 void objectStoreDeleted(const String&); |
| 89 void setActive(bool); | 89 void setActive(bool); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 101 ExecutionContext* getExecutionContext() const override; | 101 ExecutionContext* getExecutionContext() const override; |
| 102 | 102 |
| 103 // ActiveScriptWrappable | 103 // ActiveScriptWrappable |
| 104 bool hasPendingActivity() const final; | 104 bool hasPendingActivity() const final; |
| 105 | 105 |
| 106 // ActiveDOMObject | 106 // ActiveDOMObject |
| 107 void stop() override; | 107 void stop() override; |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 // EventTarget | 110 // EventTarget |
| 111 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) ove
rride; | 111 DispatchEventResult dispatchEventInternal(RawPtr<Event>) override; |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 IDBTransaction(ScriptState*, int64_t, const HashSet<String>&, WebIDBTransact
ionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&); | 114 IDBTransaction(ScriptState*, int64_t, const HashSet<String>&, WebIDBTransact
ionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&); |
| 115 | 115 |
| 116 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 116 void enqueueEvent(RawPtr<Event>); |
| 117 | 117 |
| 118 enum State { | 118 enum State { |
| 119 Inactive, // Created or started, but not in an event callback | 119 Inactive, // Created or started, but not in an event callback |
| 120 Active, // Created or started, in creation scope or an event callback | 120 Active, // Created or started, in creation scope or an event callback |
| 121 Finishing, // In the process of aborting or completing. | 121 Finishing, // In the process of aborting or completing. |
| 122 Finished, // No more events will fire and no new requests may be filed. | 122 Finished, // No more events will fire and no new requests may be filed. |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 const int64_t m_id; | 125 const int64_t m_id; |
| 126 Member<IDBDatabase> m_database; | 126 Member<IDBDatabase> m_database; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 147 | 147 |
| 148 // Holds stores created, deleted, or used during upgrade transactions to | 148 // Holds stores created, deleted, or used during upgrade transactions to |
| 149 // reset metadata in case of abort. | 149 // reset metadata in case of abort. |
| 150 HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> m_objectStoreCle
anupMap; | 150 HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> m_objectStoreCle
anupMap; |
| 151 IDBDatabaseMetadata m_previousMetadata; | 151 IDBDatabaseMetadata m_previousMetadata; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 } // namespace blink | 154 } // namespace blink |
| 155 | 155 |
| 156 #endif // IDBTransaction_h | 156 #endif // IDBTransaction_h |
| OLD | NEW |