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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef IDBTransaction_h | 26 #ifndef IDBTransaction_h |
27 #define IDBTransaction_h | 27 #define IDBTransaction_h |
28 | 28 |
| 29 #include "bindings/core/v8/ScriptState.h" |
29 #include "core/dom/ActiveDOMObject.h" | 30 #include "core/dom/ActiveDOMObject.h" |
30 #include "core/dom/DOMError.h" | 31 #include "core/dom/DOMError.h" |
31 #include "core/events/EventListener.h" | 32 #include "core/events/EventListener.h" |
32 #include "modules/EventModules.h" | 33 #include "modules/EventModules.h" |
33 #include "modules/EventTargetModules.h" | 34 #include "modules/EventTargetModules.h" |
34 #include "modules/indexeddb/IDBMetadata.h" | 35 #include "modules/indexeddb/IDBMetadata.h" |
35 #include "modules/indexeddb/IndexedDB.h" | 36 #include "modules/indexeddb/IndexedDB.h" |
36 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
37 #include "public/platform/WebIDBDatabase.h" | 38 #include "public/platform/WebIDBDatabase.h" |
38 #include "public/platform/WebIDBTypes.h" | 39 #include "public/platform/WebIDBTypes.h" |
(...skipping 10 matching lines...) Expand all Loading... |
49 struct IDBObjectStoreMetadata; | 50 struct IDBObjectStoreMetadata; |
50 | 51 |
51 class IDBTransaction FINAL | 52 class IDBTransaction FINAL |
52 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBTransa
ction> | 53 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBTransa
ction> |
53 , public EventTargetWithInlineData | 54 , public EventTargetWithInlineData |
54 , public ActiveDOMObject { | 55 , public ActiveDOMObject { |
55 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBTransaction>); | 56 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBTransaction>); |
56 DEFINE_WRAPPERTYPEINFO(); | 57 DEFINE_WRAPPERTYPEINFO(); |
57 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); | 58 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); |
58 public: | 59 public: |
59 static IDBTransaction* create(ExecutionContext*, int64_t, const Vector<Strin
g>& objectStoreNames, WebIDBTransactionMode, IDBDatabase*); | 60 static IDBTransaction* create(ScriptState*, int64_t, const Vector<String>& o
bjectStoreNames, WebIDBTransactionMode, IDBDatabase*); |
60 static IDBTransaction* create(ExecutionContext*, int64_t, IDBDatabase*, IDBO
penDBRequest*, const IDBDatabaseMetadata& previousMetadata); | 61 static IDBTransaction* create(ScriptState*, int64_t, IDBDatabase*, IDBOpenDB
Request*, const IDBDatabaseMetadata& previousMetadata); |
61 virtual ~IDBTransaction(); | 62 virtual ~IDBTransaction(); |
62 virtual void trace(Visitor*) OVERRIDE; | 63 virtual void trace(Visitor*) OVERRIDE; |
63 | 64 |
64 static WebIDBTransactionMode stringToMode(const String&, ExceptionState&); | 65 static WebIDBTransactionMode stringToMode(const String&, ExceptionState&); |
65 | 66 |
66 // When the connection is closed backend will be 0. | 67 // When the connection is closed backend will be 0. |
67 WebIDBDatabase* backendDB() const; | 68 WebIDBDatabase* backendDB() const; |
68 | 69 |
69 int64_t id() const { return m_id; } | 70 int64_t id() const { return m_id; } |
70 bool isActive() const { return m_state == Active; } | 71 bool isActive() const { return m_state == Active; } |
(...skipping 28 matching lines...) Expand all Loading... |
99 virtual ExecutionContext* executionContext() const OVERRIDE; | 100 virtual ExecutionContext* executionContext() const OVERRIDE; |
100 | 101 |
101 using EventTarget::dispatchEvent; | 102 using EventTarget::dispatchEvent; |
102 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; | 103 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; |
103 | 104 |
104 // ActiveDOMObject | 105 // ActiveDOMObject |
105 virtual bool hasPendingActivity() const OVERRIDE; | 106 virtual bool hasPendingActivity() const OVERRIDE; |
106 virtual void stop() OVERRIDE; | 107 virtual void stop() OVERRIDE; |
107 | 108 |
108 private: | 109 private: |
109 IDBTransaction(ExecutionContext*, int64_t, const Vector<String>&, WebIDBTran
sactionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&); | 110 IDBTransaction(ScriptState*, int64_t, const Vector<String>&, WebIDBTransacti
onMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&); |
110 | 111 |
111 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 112 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
112 | 113 |
113 enum State { | 114 enum State { |
114 Inactive, // Created or started, but not in an event callback | 115 Inactive, // Created or started, but not in an event callback |
115 Active, // Created or started, in creation scope or an event callback | 116 Active, // Created or started, in creation scope or an event callback |
116 Finishing, // In the process of aborting or completing. | 117 Finishing, // In the process of aborting or completing. |
117 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. |
118 }; | 119 }; |
119 | 120 |
(...skipping 16 matching lines...) Expand all Loading... |
136 IDBObjectStoreSet m_deletedObjectStores; | 137 IDBObjectStoreSet m_deletedObjectStores; |
137 | 138 |
138 typedef HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjec
tStoreMetadataMap; | 139 typedef HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjec
tStoreMetadataMap; |
139 IDBObjectStoreMetadataMap m_objectStoreCleanupMap; | 140 IDBObjectStoreMetadataMap m_objectStoreCleanupMap; |
140 IDBDatabaseMetadata m_previousMetadata; | 141 IDBDatabaseMetadata m_previousMetadata; |
141 }; | 142 }; |
142 | 143 |
143 } // namespace blink | 144 } // namespace blink |
144 | 145 |
145 #endif // IDBTransaction_h | 146 #endif // IDBTransaction_h |
OLD | NEW |