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

Side by Side Diff: content/browser/indexed_db/indexed_db_cursor.cc

Issue 2745703002: [IndexedDB] Added IndexedDBCursor lifetime tracing (Closed)
Patch Set: Trace end on close Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/browser/indexed_db/indexed_db_cursor.h" 5 #include "content/browser/indexed_db/indexed_db_cursor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 IndexedDBCursor::IndexedDBCursor( 58 IndexedDBCursor::IndexedDBCursor(
59 std::unique_ptr<IndexedDBBackingStore::Cursor> cursor, 59 std::unique_ptr<IndexedDBBackingStore::Cursor> cursor,
60 indexed_db::CursorType cursor_type, 60 indexed_db::CursorType cursor_type,
61 blink::WebIDBTaskType task_type, 61 blink::WebIDBTaskType task_type,
62 IndexedDBTransaction* transaction) 62 IndexedDBTransaction* transaction)
63 : task_type_(task_type), 63 : task_type_(task_type),
64 cursor_type_(cursor_type), 64 cursor_type_(cursor_type),
65 transaction_(transaction), 65 transaction_(transaction),
66 cursor_(std::move(cursor)), 66 cursor_(std::move(cursor)),
67 closed_(false), 67 closed_(false),
68 ptr_factory_(this) {} 68 ptr_factory_(this) {
69 IDB_ASYNC_TRACE_BEGIN("IndexedDBCursor::lifetime", this);
70 }
69 71
70 IndexedDBCursor::~IndexedDBCursor() {} 72 IndexedDBCursor::~IndexedDBCursor() {
73 if (!closed_) {
cmumford 2017/03/14 16:30:56 Nit: How about Having ::Close() to a: if (close
dmurph 2017/03/29 23:02:19 Done.
74 // Call to make sure we complete our lifetime trace.
75 Close();
76 }
77 }
71 78
72 void IndexedDBCursor::Continue(std::unique_ptr<IndexedDBKey> key, 79 void IndexedDBCursor::Continue(std::unique_ptr<IndexedDBKey> key,
73 std::unique_ptr<IndexedDBKey> primary_key, 80 std::unique_ptr<IndexedDBKey> primary_key,
74 scoped_refptr<IndexedDBCallbacks> callbacks) { 81 scoped_refptr<IndexedDBCallbacks> callbacks) {
75 IDB_TRACE("IndexedDBCursor::Continue"); 82 IDB_TRACE("IndexedDBCursor::Continue");
76 83
77 if (closed_) { 84 if (closed_) {
78 callbacks->OnError(CreateCursorClosedError()); 85 callbacks->OnError(CreateCursorClosedError());
79 return; 86 return;
80 } 87 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 for (int i = 0; i < used_prefetches - 1; ++i) { 268 for (int i = 0; i < used_prefetches - 1; ++i) {
262 bool ok = cursor_->Continue(&s); 269 bool ok = cursor_->Continue(&s);
263 DCHECK(ok); 270 DCHECK(ok);
264 } 271 }
265 } 272 }
266 273
267 return s; 274 return s;
268 } 275 }
269 276
270 void IndexedDBCursor::Close() { 277 void IndexedDBCursor::Close() {
278 IDB_ASYNC_TRACE_END("IndexedDBCursor::lifetime", this);
cmumford 2017/03/14 16:30:56 ::lifetime is better called from the destructor si
dmurph 2017/03/29 23:02:19 Changed to ::open
271 IDB_TRACE("IndexedDBCursor::Close"); 279 IDB_TRACE("IndexedDBCursor::Close");
272 closed_ = true; 280 closed_ = true;
273 cursor_.reset(); 281 cursor_.reset();
274 saved_cursor_.reset(); 282 saved_cursor_.reset();
275 transaction_ = nullptr; 283 transaction_ = nullptr;
276 } 284 }
277 285
278 } // namespace content 286 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698