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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class IDBOpenDBRequest; | 48 class IDBOpenDBRequest; |
49 struct IDBObjectStoreMetadata; | 49 struct IDBObjectStoreMetadata; |
50 | 50 |
51 class IDBTransaction FINAL | 51 class IDBTransaction FINAL |
52 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBTransa
ction> | 52 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<IDBTransa
ction> |
53 , public EventTargetWithInlineData | 53 , public EventTargetWithInlineData |
54 , public ActiveDOMObject { | 54 , public ActiveDOMObject { |
55 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBTransaction>); | 55 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<I
DBTransaction>); |
56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); | 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); |
57 public: | 57 public: |
58 static IDBTransaction* create(ExecutionContext*, int64_t, const Vector<Strin
g>& objectStoreNames, blink::WebIDBTransactionMode, IDBDatabase*); | 58 static IDBTransaction* create(ExecutionContext*, int64_t, const Vector<Strin
g>& objectStoreNames, WebIDBTransactionMode, IDBDatabase*); |
59 static IDBTransaction* create(ExecutionContext*, int64_t, IDBDatabase*, IDBO
penDBRequest*, const IDBDatabaseMetadata& previousMetadata); | 59 static IDBTransaction* create(ExecutionContext*, int64_t, IDBDatabase*, IDBO
penDBRequest*, const IDBDatabaseMetadata& previousMetadata); |
60 virtual ~IDBTransaction(); | 60 virtual ~IDBTransaction(); |
61 virtual void trace(Visitor*) OVERRIDE; | 61 virtual void trace(Visitor*) OVERRIDE; |
62 | 62 |
63 static const AtomicString& modeReadOnly(); | 63 static const AtomicString& modeReadOnly(); |
64 static const AtomicString& modeReadWrite(); | 64 static const AtomicString& modeReadWrite(); |
65 static const AtomicString& modeVersionChange(); | 65 static const AtomicString& modeVersionChange(); |
66 | 66 |
67 static blink::WebIDBTransactionMode stringToMode(const String&, ExceptionSta
te&); | 67 static WebIDBTransactionMode stringToMode(const String&, ExceptionState&); |
68 static const AtomicString& modeToString(blink::WebIDBTransactionMode); | 68 static const AtomicString& modeToString(WebIDBTransactionMode); |
69 | 69 |
70 // When the connection is closed backend will be 0. | 70 // When the connection is closed backend will be 0. |
71 blink::WebIDBDatabase* backendDB() const; | 71 WebIDBDatabase* backendDB() const; |
72 | 72 |
73 int64_t id() const { return m_id; } | 73 int64_t id() const { return m_id; } |
74 bool isActive() const { return m_state == Active; } | 74 bool isActive() const { return m_state == Active; } |
75 bool isFinished() const { return m_state == Finished; } | 75 bool isFinished() const { return m_state == Finished; } |
76 bool isFinishing() const { return m_state == Finishing; } | 76 bool isFinishing() const { return m_state == Finishing; } |
77 bool isReadOnly() const { return m_mode == blink::WebIDBTransactionModeReadO
nly; } | 77 bool isReadOnly() const { return m_mode == WebIDBTransactionModeReadOnly; } |
78 bool isVersionChange() const { return m_mode == blink::WebIDBTransactionMode
VersionChange; } | 78 bool isVersionChange() const { return m_mode == WebIDBTransactionModeVersion
Change; } |
79 | 79 |
80 // Implement the IDBTransaction IDL | 80 // Implement the IDBTransaction IDL |
81 const String& mode() const; | 81 const String& mode() const; |
82 IDBDatabase* db() const { return m_database.get(); } | 82 IDBDatabase* db() const { return m_database.get(); } |
83 PassRefPtrWillBeRawPtr<DOMError> error() const { return m_error; } | 83 PassRefPtrWillBeRawPtr<DOMError> error() const { return m_error; } |
84 IDBObjectStore* objectStore(const String& name, ExceptionState&); | 84 IDBObjectStore* objectStore(const String& name, ExceptionState&); |
85 void abort(ExceptionState&); | 85 void abort(ExceptionState&); |
86 | 86 |
87 void registerRequest(IDBRequest*); | 87 void registerRequest(IDBRequest*); |
88 void unregisterRequest(IDBRequest*); | 88 void unregisterRequest(IDBRequest*); |
(...skipping 14 matching lines...) Expand all Loading... |
103 virtual ExecutionContext* executionContext() const OVERRIDE; | 103 virtual ExecutionContext* executionContext() const OVERRIDE; |
104 | 104 |
105 using EventTarget::dispatchEvent; | 105 using EventTarget::dispatchEvent; |
106 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; | 106 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; |
107 | 107 |
108 // ActiveDOMObject | 108 // ActiveDOMObject |
109 virtual bool hasPendingActivity() const OVERRIDE; | 109 virtual bool hasPendingActivity() const OVERRIDE; |
110 virtual void stop() OVERRIDE; | 110 virtual void stop() OVERRIDE; |
111 | 111 |
112 private: | 112 private: |
113 IDBTransaction(ExecutionContext*, int64_t, const Vector<String>&, blink::Web
IDBTransactionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&)
; | 113 IDBTransaction(ExecutionContext*, int64_t, const Vector<String>&, WebIDBTran
sactionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata&); |
114 | 114 |
115 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 115 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
116 | 116 |
117 enum State { | 117 enum State { |
118 Inactive, // Created or started, but not in an event callback | 118 Inactive, // Created or started, but not in an event callback |
119 Active, // Created or started, in creation scope or an event callback | 119 Active, // Created or started, in creation scope or an event callback |
120 Finishing, // In the process of aborting or completing. | 120 Finishing, // In the process of aborting or completing. |
121 Finished, // No more events will fire and no new requests may be filed. | 121 Finished, // No more events will fire and no new requests may be filed. |
122 }; | 122 }; |
123 | 123 |
124 int64_t m_id; | 124 int64_t m_id; |
125 Member<IDBDatabase> m_database; | 125 Member<IDBDatabase> m_database; |
126 const Vector<String> m_objectStoreNames; | 126 const Vector<String> m_objectStoreNames; |
127 Member<IDBOpenDBRequest> m_openDBRequest; | 127 Member<IDBOpenDBRequest> m_openDBRequest; |
128 const blink::WebIDBTransactionMode m_mode; | 128 const WebIDBTransactionMode m_mode; |
129 State m_state; | 129 State m_state; |
130 bool m_hasPendingActivity; | 130 bool m_hasPendingActivity; |
131 bool m_contextStopped; | 131 bool m_contextStopped; |
132 RefPtrWillBeMember<DOMError> m_error; | 132 RefPtrWillBeMember<DOMError> m_error; |
133 | 133 |
134 HeapListHashSet<Member<IDBRequest> > m_requestList; | 134 HeapListHashSet<Member<IDBRequest> > m_requestList; |
135 | 135 |
136 typedef HeapHashMap<String, Member<IDBObjectStore> > IDBObjectStoreMap; | 136 typedef HeapHashMap<String, Member<IDBObjectStore> > IDBObjectStoreMap; |
137 IDBObjectStoreMap m_objectStoreMap; | 137 IDBObjectStoreMap m_objectStoreMap; |
138 | 138 |
139 typedef HeapHashSet<Member<IDBObjectStore> > IDBObjectStoreSet; | 139 typedef HeapHashSet<Member<IDBObjectStore> > IDBObjectStoreSet; |
140 IDBObjectStoreSet m_deletedObjectStores; | 140 IDBObjectStoreSet m_deletedObjectStores; |
141 | 141 |
142 typedef HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjec
tStoreMetadataMap; | 142 typedef HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjec
tStoreMetadataMap; |
143 IDBObjectStoreMetadataMap m_objectStoreCleanupMap; | 143 IDBObjectStoreMetadataMap m_objectStoreCleanupMap; |
144 IDBDatabaseMetadata m_previousMetadata; | 144 IDBDatabaseMetadata m_previousMetadata; |
145 }; | 145 }; |
146 | 146 |
147 } // namespace blink | 147 } // namespace blink |
148 | 148 |
149 #endif // IDBTransaction_h | 149 #endif // IDBTransaction_h |
OLD | NEW |