diff options
author | John Reck <jreck@google.com> | 2011-10-07 16:00:12 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-10-07 19:21:47 -0700 |
commit | 9c5004e6d5645cdf32fff3a3f04817a307b84dd6 (patch) | |
tree | 2fa369a23802c025ad79afcdd5cb5a0c933fb3c3 /src/com/android/browser/Tab.java | |
parent | 983dae2d94c2b90f471138471955875f438670c4 (diff) | |
download | packages_apps_Browser-9c5004e6d5645cdf32fff3a3f04817a307b84dd6.zip packages_apps_Browser-9c5004e6d5645cdf32fff3a3f04817a307b84dd6.tar.gz packages_apps_Browser-9c5004e6d5645cdf32fff3a3f04817a307b84dd6.tar.bz2 |
Improve tab switcher open perf
Bug: 5379115
Change-Id: I5e5bfcfead4c54deb49af94de6f6526bd2710567
Diffstat (limited to 'src/com/android/browser/Tab.java')
-rw-r--r-- | src/com/android/browser/Tab.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index f2aa529..839280e 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -2181,13 +2181,20 @@ class Tab implements PictureListener { } } + private static final ThreadLocal<ByteBuffer> sBuffer = new ThreadLocal<ByteBuffer>(); + private byte[] getCaptureBlob() { synchronized (Tab.this) { if (mCapture == null) { return null; } - ByteBuffer buffer = ByteBuffer.allocate(mCapture.getByteCount()); + ByteBuffer buffer = sBuffer.get(); + if (buffer == null || buffer.limit() < mCapture.getByteCount()) { + buffer = ByteBuffer.allocate(mCapture.getByteCount()); + sBuffer.set(buffer); + } mCapture.copyPixelsToBuffer(buffer); + buffer.rewind(); return buffer.array(); } } |