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

Side by Side Diff: content/browser/indexed_db/indexed_db_transaction.h

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unobserve functionality Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 void ScheduleTask(blink::WebIDBTaskType, Operation task); 58 void ScheduleTask(blink::WebIDBTaskType, Operation task);
59 void ScheduleAbortTask(Operation abort_task); 59 void ScheduleAbortTask(Operation abort_task);
60 void RegisterOpenCursor(IndexedDBCursor* cursor); 60 void RegisterOpenCursor(IndexedDBCursor* cursor);
61 void UnregisterOpenCursor(IndexedDBCursor* cursor); 61 void UnregisterOpenCursor(IndexedDBCursor* cursor);
62 void AddPreemptiveEvent() { pending_preemptive_events_++; } 62 void AddPreemptiveEvent() { pending_preemptive_events_++; }
63 void DidCompletePreemptiveEvent() { 63 void DidCompletePreemptiveEvent() {
64 pending_preemptive_events_--; 64 pending_preemptive_events_--;
65 DCHECK_GE(pending_preemptive_events_, 0); 65 DCHECK_GE(pending_preemptive_events_, 0);
66 } 66 }
67 void AddPendingObserver(std::unique_ptr<IndexedDBObserver> observer); 67 void AddPendingObserver(int64_t observer_id, IndexedDBObserver* observer);
68 68
69 IndexedDBBackingStore::Transaction* BackingStoreTransaction() { 69 IndexedDBBackingStore::Transaction* BackingStoreTransaction() {
70 return transaction_.get(); 70 return transaction_.get();
71 } 71 }
72 int64_t id() const { return id_; } 72 int64_t id() const { return id_; }
73 73
74 IndexedDBDatabase* database() const { return database_.get(); } 74 IndexedDBDatabase* database() const { return database_.get(); }
75 IndexedDBDatabaseCallbacks* connection() const { return callbacks_.get(); } 75 IndexedDBDatabaseCallbacks* connection() const { return callbacks_.get(); }
76 76
77 State state() const { return state_; } 77 State state() const { return state_; }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TaskQueue preemptive_task_queue_; 172 TaskQueue preemptive_task_queue_;
173 TaskStack abort_task_stack_; 173 TaskStack abort_task_stack_;
174 174
175 std::unique_ptr<IndexedDBBackingStore::Transaction> transaction_; 175 std::unique_ptr<IndexedDBBackingStore::Transaction> transaction_;
176 bool backing_store_transaction_begun_; 176 bool backing_store_transaction_begun_;
177 177
178 bool should_process_queue_; 178 bool should_process_queue_;
179 int pending_preemptive_events_; 179 int pending_preemptive_events_;
180 180
181 std::set<IndexedDBCursor*> open_cursors_; 181 std::set<IndexedDBCursor*> open_cursors_;
182 std::vector<std::unique_ptr<IndexedDBObserver>> pending_observers_; 182 std::map<int64_t, IndexedDBObserver*> pending_observers_;
183 183
184 // This timer is started after requests have been processed. If no subsequent 184 // This timer is started after requests have been processed. If no subsequent
185 // requests are processed before the timer fires, assume the script is 185 // requests are processed before the timer fires, assume the script is
186 // unresponsive and abort to unblock the transaction queue. 186 // unresponsive and abort to unblock the transaction queue.
187 base::OneShotTimer timeout_timer_; 187 base::OneShotTimer timeout_timer_;
188 188
189 Diagnostics diagnostics_; 189 Diagnostics diagnostics_;
190 }; 190 };
191 191
192 } // namespace content 192 } // namespace content
193 193
194 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_ 194 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698