Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: Source/modules/indexeddb/IDBTransaction.h

Issue 23653024: IndexedDB: Have IDBCursor and IDBRequest explicitly break ref cycles (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 bool isReadOnly() const { return m_mode == IndexedDB::TransactionReadOnly; } 72 bool isReadOnly() const { return m_mode == IndexedDB::TransactionReadOnly; }
73 bool isVersionChange() const { return m_mode == IndexedDB::TransactionVersio nChange; } 73 bool isVersionChange() const { return m_mode == IndexedDB::TransactionVersio nChange; }
74 74
75 // Implement the IDBTransaction IDL 75 // Implement the IDBTransaction IDL
76 const String& mode() const; 76 const String& mode() const;
77 IDBDatabase* db() const { return m_database.get(); } 77 IDBDatabase* db() const { return m_database.get(); }
78 PassRefPtr<DOMError> error() const { return m_error; } 78 PassRefPtr<DOMError> error() const { return m_error; }
79 PassRefPtr<IDBObjectStore> objectStore(const String& name, ExceptionState&); 79 PassRefPtr<IDBObjectStore> objectStore(const String& name, ExceptionState&);
80 void abort(ExceptionState&); 80 void abort(ExceptionState&);
81 81
82 class OpenCursorNotifier {
83 public:
84 OpenCursorNotifier(PassRefPtr<IDBTransaction>, IDBCursor*);
85 ~OpenCursorNotifier();
86 void cursorFinished();
87 private:
88 RefPtr<IDBTransaction> m_transaction;
89 IDBCursor* m_cursor;
90 };
91
92 void registerRequest(IDBRequest*); 82 void registerRequest(IDBRequest*);
93 void unregisterRequest(IDBRequest*); 83 void unregisterRequest(IDBRequest*);
94 void objectStoreCreated(const String&, PassRefPtr<IDBObjectStore>); 84 void objectStoreCreated(const String&, PassRefPtr<IDBObjectStore>);
95 void objectStoreDeleted(const String&); 85 void objectStoreDeleted(const String&);
96 void setActive(bool); 86 void setActive(bool);
97 void setError(PassRefPtr<DOMError>); 87 void setError(PassRefPtr<DOMError>);
98 88
99 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); 89 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort);
100 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete);
101 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
(...skipping 13 matching lines...) Expand all
115 virtual bool canSuspend() const OVERRIDE; 105 virtual bool canSuspend() const OVERRIDE;
116 virtual void stop() OVERRIDE; 106 virtual void stop() OVERRIDE;
117 107
118 using RefCounted<IDBTransaction>::ref; 108 using RefCounted<IDBTransaction>::ref;
119 using RefCounted<IDBTransaction>::deref; 109 using RefCounted<IDBTransaction>::deref;
120 110
121 private: 111 private:
122 IDBTransaction(ScriptExecutionContext*, int64_t, const Vector<String>&, Inde xedDB::TransactionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetada ta&); 112 IDBTransaction(ScriptExecutionContext*, int64_t, const Vector<String>&, Inde xedDB::TransactionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetada ta&);
123 113
124 void enqueueEvent(PassRefPtr<Event>); 114 void enqueueEvent(PassRefPtr<Event>);
125 void closeOpenCursors();
126
127 void registerOpenCursor(IDBCursor*);
128 void unregisterOpenCursor(IDBCursor*);
129 115
130 // EventTarget 116 // EventTarget
131 virtual void refEventTarget() { ref(); } 117 virtual void refEventTarget() { ref(); }
132 virtual void derefEventTarget() { deref(); } 118 virtual void derefEventTarget() { deref(); }
133 virtual EventTargetData* eventTargetData(); 119 virtual EventTargetData* eventTargetData();
134 virtual EventTargetData* ensureEventTargetData(); 120 virtual EventTargetData* ensureEventTargetData();
135 121
136 enum State { 122 enum State {
137 Inactive, // Created or started, but not in an event callback 123 Inactive, // Created or started, but not in an event callback
138 Active, // Created or started, in creation scope or an event callback 124 Active, // Created or started, in creation scope or an event callback
(...skipping 16 matching lines...) Expand all
155 typedef HashMap<String, RefPtr<IDBObjectStore> > IDBObjectStoreMap; 141 typedef HashMap<String, RefPtr<IDBObjectStore> > IDBObjectStoreMap;
156 IDBObjectStoreMap m_objectStoreMap; 142 IDBObjectStoreMap m_objectStoreMap;
157 143
158 typedef HashSet<RefPtr<IDBObjectStore> > IDBObjectStoreSet; 144 typedef HashSet<RefPtr<IDBObjectStore> > IDBObjectStoreSet;
159 IDBObjectStoreSet m_deletedObjectStores; 145 IDBObjectStoreSet m_deletedObjectStores;
160 146
161 typedef HashMap<RefPtr<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjectSto reMetadataMap; 147 typedef HashMap<RefPtr<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjectSto reMetadataMap;
162 IDBObjectStoreMetadataMap m_objectStoreCleanupMap; 148 IDBObjectStoreMetadataMap m_objectStoreCleanupMap;
163 IDBDatabaseMetadata m_previousMetadata; 149 IDBDatabaseMetadata m_previousMetadata;
164 150
165 HashSet<IDBCursor*> m_openCursors;
166
167 EventTargetData m_eventTargetData; 151 EventTargetData m_eventTargetData;
168 }; 152 };
169 153
170 } // namespace WebCore 154 } // namespace WebCore
171 155
172 #endif // IDBTransaction_h 156 #endif // IDBTransaction_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698