Skip to content

Commit 3bc6bbc

Browse files
author
Jeff Brown
committed
Clean up CursorWindow code.
Bug: 5332296 The code is functionally equivalent, but a little more efficient and much easier to maintain. Change-Id: I90670a13799df05831843a5137ab234929281b7c
1 parent 3b2faf6 commit 3bc6bbc

File tree

8 files changed

+815
-858
lines changed

8 files changed

+815
-858
lines changed

core/java/android/database/CursorWindow.java

Lines changed: 426 additions & 366 deletions
Large diffs are not rendered by default.

core/java/android/database/CursorWindowAllocationException.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,12 @@
1818

1919
/**
2020
* This exception is thrown when a CursorWindow couldn't be allocated,
21-
* most probably due to memory not being available
21+
* most probably due to memory not being available.
22+
*
23+
* @hide
2224
*/
23-
class CursorWindowAllocationException extends java.lang.RuntimeException
24-
{
25-
public CursorWindowAllocationException()
26-
{
27-
super();
28-
}
29-
30-
public CursorWindowAllocationException(String description)
31-
{
25+
public class CursorWindowAllocationException extends RuntimeException {
26+
public CursorWindowAllocationException(String description) {
3227
super(description);
3328
}
3429
}

core/java/android/database/sqlite/SQLiteQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public class SQLiteQuery extends SQLiteProgram {
7979
// if the start pos is not equal to 0, then most likely window is
8080
// too small for the data set, loading by another thread
8181
// is not safe in this situation. the native code will ignore maxRead
82-
int numRows = native_fill_window(window, window.getStartPosition(),
82+
int numRows = native_fill_window(window.mWindowPtr, window.getStartPosition(),
8383
mOffsetIndex, maxRead, lastPos);
8484
mDatabase.logTimeStat(mSql, timeStart);
8585
return numRows;
@@ -154,7 +154,7 @@ public void close() {
154154
compileAndbindAllArgs();
155155
}
156156

157-
private final native int native_fill_window(CursorWindow window,
157+
private final native int native_fill_window(int windowPtr,
158158
int startPos, int offsetParam, int maxRead, int lastPos);
159159

160160
private final native int native_column_count();

0 commit comments

Comments
 (0)