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

Unified Diff: chrome/browser/android/thumbnail/thumbnail_cache.cc

Issue 2823003002: SkBitmap and SkPixelRef no longer need lock/unlock (Closed)
Patch Set: win fix after rebase Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/thumbnail/thumbnail_cache.cc
diff --git a/chrome/browser/android/thumbnail/thumbnail_cache.cc b/chrome/browser/android/thumbnail/thumbnail_cache.cc
index ab430d29055735b51d0b7ea391c0321e8c973415..c75c19e653074f11247064bc850e5a58d25951aa 100644
--- a/chrome/browser/android/thumbnail/thumbnail_cache.cc
+++ b/chrome/browser/android/thumbnail/thumbnail_cache.cc
@@ -502,8 +502,6 @@ bool WriteToFile(base::File& file,
return false;
// Write ETC1 header.
- compressed_data->lockPixels();
-
unsigned char etc1_buffer[ETC_PKM_HEADER_SIZE];
etc1_pkm_format_header(etc1_buffer,
compressed_data->info().width(),
@@ -523,8 +521,6 @@ bool WriteToFile(base::File& file,
if (pixel_bytes_written != data_size)
return false;
- compressed_data->unlockPixels();
-
if (!WriteBigEndianToFile(file, kCurrentExtraVersion))
return false;
@@ -575,7 +571,6 @@ void ThumbnailCache::CompressionTask(
gfx::Size content_size;
if (!raw_data.empty()) {
- SkAutoLockPixels raw_data_lock(raw_data);
gfx::Size raw_data_size(raw_data.width(), raw_data.height());
size_t pixel_size = 4; // Pixel size is 4 bytes for kARGB_8888_Config.
size_t stride = pixel_size * raw_data_size.width();
@@ -590,7 +585,6 @@ void ThumbnailCache::CompressionTask(
sk_sp<SkPixelRef> etc1_pixel_ref(SkMallocPixelRef::MakeWithData(
info, 0, NULL, std::move(etc1_pixel_data)));
- etc1_pixel_ref->lockPixels();
bool success = etc1_encode_image(
reinterpret_cast<unsigned char*>(raw_data.getPixels()),
raw_data_size.width(),
@@ -601,7 +595,6 @@ void ThumbnailCache::CompressionTask(
encoded_size.width(),
encoded_size.height());
etc1_pixel_ref->setImmutable();
- etc1_pixel_ref->unlockPixels();
if (success) {
compressed_data = std::move(etc1_pixel_ref);
@@ -860,8 +853,6 @@ void ThumbnailCache::DecompressionTask(
buffer_size.height(),
kRGBA_8888_SkColorType,
kOpaque_SkAlphaType));
- SkAutoLockPixels raw_data_lock(raw_data);
- compressed_data->lockPixels();
success = etc1_decode_image(
reinterpret_cast<unsigned char*>(compressed_data->pixels()),
reinterpret_cast<unsigned char*>(raw_data.getPixels()),
@@ -869,7 +860,6 @@ void ThumbnailCache::DecompressionTask(
buffer_size.height(),
raw_data.bytesPerPixel(),
raw_data.rowBytes());
- compressed_data->unlockPixels();
raw_data.setImmutable();
if (!success) {
@@ -884,7 +874,6 @@ void ThumbnailCache::DecompressionTask(
content_size.height(),
kRGBA_8888_SkColorType,
kOpaque_SkAlphaType));
- SkAutoLockPixels raw_data_small_lock(raw_data_small);
SkCanvas small_canvas(raw_data_small);
small_canvas.drawBitmap(raw_data, 0, 0);
raw_data_small.setImmutable();
@@ -911,7 +900,6 @@ std::pair<SkBitmap, float> ThumbnailCache::CreateApproximation(
float scale) {
DCHECK(!bitmap.empty());
DCHECK_GT(scale, 0);
- SkAutoLockPixels bitmap_lock(bitmap);
float new_scale = 1.f / kApproximationScaleFactor;
gfx::Size dst_size = gfx::ScaleToFlooredSize(
@@ -922,8 +910,6 @@ std::pair<SkBitmap, float> ThumbnailCache::CreateApproximation(
bitmap.info().colorType(),
bitmap.info().alphaType()));
dst_bitmap.eraseColor(0);
- SkAutoLockPixels dst_bitmap_lock(dst_bitmap);
-
SkCanvas canvas(dst_bitmap);
canvas.scale(new_scale, new_scale);
canvas.drawBitmap(bitmap, 0, 0, NULL);

Powered by Google App Engine
This is Rietveld 408576698