|
IndexedDB: Have IDBCursor and IDBRequest explicitly break ref cycles
Until (1) a transaction ends or (2) a cursor hits the end of its
range, an IDBRequest holds on to an IDBCursor as its result. Per spec,
calling continue() or advance() on the cursor re-uses the same
IDBRequest, requiring a reference cycle.
Previously, the cycle was broken explicitly on either of those two
conditions, but until that time a cursor-request pair would "leak",
holding on to potentially large script value results.
This patch makes both classes RefCountedBase::deref() and check
to see if they have a partner object and both refcounts are 1. If
so, the cycle is broken.
Special case cruft for condition #1 is removed to simplify the
code - just rely on GC to reclaim the objects if necessary.
R=alecflett@chromium.org,dgrogan@chromium.org
BUG= 225860
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=157382
Total comments: 9
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+163 lines, -113 lines) |
Patch |
 |
A |
LayoutTests/storage/indexeddb/cursor-request-cycle.html
|
View
|
|
1 chunk |
+68 lines, -0 lines |
2 comments
|
Download
|
 |
A + |
LayoutTests/storage/indexeddb/cursor-request-cycle-expected.txt
|
View
|
|
1 chunk |
+16 lines, -10 lines |
2 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBAny.h
|
View
|
|
1 chunk |
+8 lines, -8 lines |
1 comment
|
Download
|
 |
M |
Source/modules/indexeddb/IDBAny.cpp
|
View
|
|
1 chunk |
+16 lines, -16 lines |
0 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBCallbacks.h
|
View
|
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBCursor.h
|
View
|
|
4 chunks |
+11 lines, -2 lines |
2 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBCursor.cpp
|
View
|
|
2 chunks |
+14 lines, -6 lines |
0 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBRequest.h
|
View
|
|
4 chunks |
+13 lines, -5 lines |
0 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBRequest.cpp
|
View
|
|
5 chunks |
+14 lines, -7 lines |
2 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBTransaction.h
|
View
|
|
3 chunks |
+0 lines, -16 lines |
0 comments
|
Download
|
 |
M |
Source/modules/indexeddb/IDBTransaction.cpp
|
View
|
|
3 chunks |
+0 lines, -42 lines |
0 comments
|
Download
|
Total messages: 6 (0 generated)
|