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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 class ScriptExecutionContext; | 46 class ScriptExecutionContext; |
47 | 47 |
48 typedef int ExceptionCode; | 48 typedef int ExceptionCode; |
49 | 49 |
50 class IDBDatabase : public RefCountedHeapAllocated<IDBDatabase>, public ScriptWr
appable, public EventTarget, public ActiveDOMObject { | 50 class IDBDatabase : public RefCountedHeapAllocated<IDBDatabase>, public ScriptWr
appable, public EventTarget, public ActiveDOMObject { |
51 DECLARE_GC_INFO | 51 DECLARE_GC_INFO |
52 DEFINE_SELF_HANDLE(IDBDatabase) | 52 DEFINE_SELF_HANDLE(IDBDatabase) |
53 public: | 53 public: |
54 static PassRefPtr<IDBDatabase> create(ScriptExecutionContext*, PassRefPtr<ID
BDatabaseBackendInterface>, PassRefPtr<IDBDatabaseCallbacks>); | 54 static IDBDatabase* create(ScriptExecutionContext*, IDBDatabaseBackendInterf
ace*, IDBDatabaseCallbacks*); |
55 ~IDBDatabase(); | 55 ~IDBDatabase(); |
56 | 56 |
57 virtual void trace(Visitor*) { } | 57 virtual void trace(Visitor*); |
58 | 58 |
59 virtual void visitWith(Visitor* visitor) const OVERRIDE | 59 virtual void visitWith(Visitor* visitor) const OVERRIDE |
60 { | 60 { |
61 visitor->visit(this); | 61 visitor->visit(this); |
62 } | 62 } |
63 | 63 |
64 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } | 64 void setMetadata(const IDBDatabaseMetadata& metadata) { m_metadata = metadat
a; } |
65 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); | 65 void indexCreated(int64_t objectStoreId, const IDBIndexMetadata&); |
66 void indexDeleted(int64_t objectStoreId, int64_t indexId); | 66 void indexDeleted(int64_t objectStoreId, int64_t indexId); |
67 void transactionCreated(IDBTransaction*); | 67 void transactionCreated(IDBTransaction*); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 using EventTarget::dispatchEvent; | 105 using EventTarget::dispatchEvent; |
106 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; | 106 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; |
107 | 107 |
108 int64_t findObjectStoreId(const String& name) const; | 108 int64_t findObjectStoreId(const String& name) const; |
109 bool containsObjectStore(const String& name) const | 109 bool containsObjectStore(const String& name) const |
110 { | 110 { |
111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; | 111 return findObjectStoreId(name) != IDBObjectStoreMetadata::InvalidId; |
112 } | 112 } |
113 | 113 |
114 IDBDatabaseBackendInterface* backend() const { return m_backend.get(); } | 114 IDBDatabaseBackendInterface* backend() const { return m_backend; } |
115 | 115 |
116 static int64_t nextTransactionId(); | 116 static int64_t nextTransactionId(); |
117 | 117 |
118 using RefCountedHeapAllocated<IDBDatabase>::ref; | 118 using RefCountedHeapAllocated<IDBDatabase>::ref; |
119 using RefCountedHeapAllocated<IDBDatabase>::deref; | 119 using RefCountedHeapAllocated<IDBDatabase>::deref; |
120 | 120 |
121 private: | 121 private: |
122 IDBDatabase(ScriptExecutionContext*, PassRefPtr<IDBDatabaseBackendInterface>
, PassRefPtr<IDBDatabaseCallbacks>); | 122 IDBDatabase(ScriptExecutionContext*, IDBDatabaseBackendInterface*, IDBDataba
seCallbacks*); |
123 | 123 |
124 // EventTarget | 124 // EventTarget |
125 virtual EventTargetData* eventTargetData(); | 125 virtual EventTargetData* eventTargetData(); |
126 virtual EventTargetData* ensureEventTargetData(); | 126 virtual EventTargetData* ensureEventTargetData(); |
127 | 127 |
128 void closeConnection(); | 128 void closeConnection(); |
129 | 129 |
130 IDBDatabaseMetadata m_metadata; | 130 IDBDatabaseMetadata m_metadata; |
131 RefPtr<IDBDatabaseBackendInterface> m_backend; | 131 Member<IDBDatabaseBackendInterface> m_backend; |
132 RefPtr<IDBTransaction> m_versionChangeTransaction; | 132 RefPtr<IDBTransaction> m_versionChangeTransaction; |
133 typedef HashMap<int64_t, RefPtr<IDBTransaction> > TransactionMap; | 133 typedef HashMap<int64_t, RefPtr<IDBTransaction> > TransactionMap; |
134 TransactionMap m_transactions; | 134 TransactionMap m_transactions; |
135 | 135 |
136 bool m_closePending; | 136 bool m_closePending; |
137 bool m_contextStopped; | 137 bool m_contextStopped; |
138 | 138 |
139 EventTargetData m_eventTargetData; | 139 EventTargetData m_eventTargetData; |
140 | 140 |
141 // Keep track of the versionchange events waiting to be fired on this | 141 // Keep track of the versionchange events waiting to be fired on this |
142 // database so that we can cancel them if the database closes. | 142 // database so that we can cancel them if the database closes. |
143 Vector<RefPtr<Event> > m_enqueuedEvents; | 143 Vector<RefPtr<Event> > m_enqueuedEvents; |
144 | 144 |
145 RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks; | 145 Member<IDBDatabaseCallbacks> m_databaseCallbacks; |
146 }; | 146 }; |
147 | 147 |
148 } // namespace WebCore | 148 } // namespace WebCore |
149 | 149 |
150 #endif // IDBDatabase_h | 150 #endif // IDBDatabase_h |
OLD | NEW |