summaryrefslogtreecommitdiff
path: root/chromium/cc/tiles
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/cc/tiles
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-c30a6232df03e1efbd9f3b226777b07e087a1122.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/cc/tiles')
-rw-r--r--chromium/cc/tiles/checker_image_tracker.cc5
-rw-r--r--chromium/cc/tiles/checker_image_tracker_unittest.cc2
-rw-r--r--chromium/cc/tiles/gpu_image_decode_cache.cc21
-rw-r--r--chromium/cc/tiles/gpu_image_decode_cache.h1
-rw-r--r--chromium/cc/tiles/gpu_image_decode_cache_perftest.cc2
-rw-r--r--chromium/cc/tiles/gpu_image_decode_cache_unittest.cc15
-rw-r--r--chromium/cc/tiles/image_controller_unittest.cc2
-rw-r--r--chromium/cc/tiles/image_decode_cache.h23
-rw-r--r--chromium/cc/tiles/software_image_decode_cache.cc23
-rw-r--r--chromium/cc/tiles/software_image_decode_cache_utils.cc1
-rw-r--r--chromium/cc/tiles/tile_priority.cc12
-rw-r--r--chromium/cc/tiles/tile_priority.h6
12 files changed, 55 insertions, 58 deletions
diff --git a/chromium/cc/tiles/checker_image_tracker.cc b/chromium/cc/tiles/checker_image_tracker.cc
index 8495b03dda1..4c932e98d61 100644
--- a/chromium/cc/tiles/checker_image_tracker.cc
+++ b/chromium/cc/tiles/checker_image_tracker.cc
@@ -4,6 +4,8 @@
#include "cc/tiles/checker_image_tracker.h"
+#include <sstream>
+
#include "base/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
@@ -407,8 +409,7 @@ void CheckerImageTracker::ScheduleNextImageDecode() {
draw_image = DrawImage(
candidate, SkIRect::MakeWH(candidate.width(), candidate.height()),
it->second.filter_quality,
- SkMatrix::MakeScale(it->second.scale.width(),
- it->second.scale.height()),
+ SkMatrix::Scale(it->second.scale.width(), it->second.scale.height()),
it->second.frame_index, it->second.color_space);
outstanding_image_decode_.emplace(candidate);
break;
diff --git a/chromium/cc/tiles/checker_image_tracker_unittest.cc b/chromium/cc/tiles/checker_image_tracker_unittest.cc
index 57984cc8d00..100e27a77d2 100644
--- a/chromium/cc/tiles/checker_image_tracker_unittest.cc
+++ b/chromium/cc/tiles/checker_image_tracker_unittest.cc
@@ -470,7 +470,7 @@ TEST_F(CheckerImageTrackerTest, ChoosesMaxScaleAndQuality) {
gfx::ColorSpace());
DrawImage scaled_image2 =
DrawImage(image.paint_image(), image.src_rect(), kHigh_SkFilterQuality,
- SkMatrix::MakeScale(1.8f), PaintImage::kDefaultFrameIndex,
+ SkMatrix::Scale(1.8f, 1.8f), PaintImage::kDefaultFrameIndex,
gfx::ColorSpace());
std::vector<DrawImage> draw_images = {scaled_image1, scaled_image2};
diff --git a/chromium/cc/tiles/gpu_image_decode_cache.cc b/chromium/cc/tiles/gpu_image_decode_cache.cc
index 4a2d6586f27..1ed44f98cb2 100644
--- a/chromium/cc/tiles/gpu_image_decode_cache.cc
+++ b/chromium/cc/tiles/gpu_image_decode_cache.cc
@@ -16,6 +16,7 @@
#include "base/debug/alias.h"
#include "base/feature_list.h"
#include "base/hash/hash.h"
+#include "base/logging.h"
#include "base/memory/discardable_memory_allocator.h"
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_math.h"
@@ -1043,9 +1044,9 @@ GpuImageDecodeCache::GpuImageDecodeCache(
base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
this, "cc::GpuImageDecodeCache", base::ThreadTaskRunnerHandle::Get());
}
- memory_pressure_listener_.reset(
- new base::MemoryPressureListener(base::BindRepeating(
- &GpuImageDecodeCache::OnMemoryPressure, base::Unretained(this))));
+ memory_pressure_listener_ = std::make_unique<base::MemoryPressureListener>(
+ FROM_HERE, base::BindRepeating(&GpuImageDecodeCache::OnMemoryPressure,
+ base::Unretained(this)));
}
GpuImageDecodeCache::~GpuImageDecodeCache() {
@@ -1164,7 +1165,12 @@ ImageDecodeCache::TaskResult GpuImageDecodeCache::GetTaskForImageAndRefInternal(
task = GetImageDecodeTaskAndRef(draw_image, tracing_info, task_type);
}
- return TaskResult(task,
+ if (task) {
+ return TaskResult(task,
+ image_data->decode.can_do_hardware_accelerated_decode());
+ }
+
+ return TaskResult(true /* needs_unref */, false /* is_at_raster_decode */,
image_data->decode.can_do_hardware_accelerated_decode());
}
@@ -1922,7 +1928,8 @@ void GpuImageDecodeCache::DecodeImageIfNecessary(const DrawImage& draw_image,
DLOG(ERROR) << "YUV + Bitmap is unknown and unimplemented!";
NOTREACHED();
} else {
- image_data->decode.SetBitmapImage(draw_image.paint_image().GetSkImage());
+ image_data->decode.SetBitmapImage(
+ draw_image.paint_image().GetRasterSkImage());
}
return;
}
@@ -2086,7 +2093,7 @@ void GpuImageDecodeCache::UploadImageIfNecessary(const DrawImage& draw_image,
// Get the encoded data in a contiguous form.
sk_sp<SkData> encoded_data =
- draw_image.paint_image().GetSkImage()->refEncodedData();
+ draw_image.paint_image().GetRasterSkImage()->refEncodedData();
DCHECK(encoded_data);
const uint32_t transfer_cache_id =
ClientImageTransferCacheEntry::GetNextId();
@@ -2526,7 +2533,7 @@ void GpuImageDecodeCache::FlushYUVImages(
CheckContextLockAcquiredIfNecessary();
lock_.AssertAcquired();
for (auto& image : *yuv_images) {
- image->flush(context_->GrContext());
+ image->flushAndSubmit(context_->GrContext());
}
yuv_images->clear();
}
diff --git a/chromium/cc/tiles/gpu_image_decode_cache.h b/chromium/cc/tiles/gpu_image_decode_cache.h
index 4ee3ae8054e..7c345dbbbd5 100644
--- a/chromium/cc/tiles/gpu_image_decode_cache.h
+++ b/chromium/cc/tiles/gpu_image_decode_cache.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/containers/mru_cache.h"
+#include "base/logging.h"
#include "base/memory/discardable_memory.h"
#include "base/memory/memory_pressure_listener.h"
#include "base/optional.h"
diff --git a/chromium/cc/tiles/gpu_image_decode_cache_perftest.cc b/chromium/cc/tiles/gpu_image_decode_cache_perftest.cc
index 7a9039099bb..416cd8233c8 100644
--- a/chromium/cc/tiles/gpu_image_decode_cache_perftest.cc
+++ b/chromium/cc/tiles/gpu_image_decode_cache_perftest.cc
@@ -157,7 +157,7 @@ TEST_P(GpuImageDecodeCachePerfTestNoSw, DecodeWithMips) {
surface->getCanvas()->drawImageRect(decoded_image.image().get(),
SkRect::MakeWH(1024, 2048),
SkRect::MakeWH(614, 1229), &paint);
- surface->flush();
+ surface->flushAndSubmit();
}
cache_->DrawWithImageFinished(image, decoded_image);
diff --git a/chromium/cc/tiles/gpu_image_decode_cache_unittest.cc b/chromium/cc/tiles/gpu_image_decode_cache_unittest.cc
index 3ed5b0b5b94..3c9db3a438e 100644
--- a/chromium/cc/tiles/gpu_image_decode_cache_unittest.cc
+++ b/chromium/cc/tiles/gpu_image_decode_cache_unittest.cc
@@ -429,7 +429,6 @@ class GpuImageDecodeCacheTest
}
PaintImage CreateBitmapImageInternal(const gfx::Size& size) {
- DCHECK(!do_yuv_decode_);
return CreateBitmapImage(size, color_type_);
}
@@ -2928,6 +2927,20 @@ TEST_P(GpuImageDecodeCacheTest, GetBorderlineLargeDecodedImageForDraw) {
cache->UnrefImage(draw_image);
}
+TEST_P(GpuImageDecodeCacheTest, OutOfRasterDecodeForBitmaps) {
+ auto cache = CreateCache();
+
+ PaintImage image = CreateBitmapImageInternal(GetNormalImageSize());
+ DrawImage draw_image = CreateDrawImageInternal(image);
+ ImageDecodeCache::TaskResult result =
+ cache->GetOutOfRasterDecodeTaskForImageAndRef(draw_image);
+ EXPECT_TRUE(result.need_unref);
+ EXPECT_FALSE(result.task);
+ EXPECT_FALSE(result.is_at_raster_decode);
+ EXPECT_FALSE(result.can_do_hardware_accelerated_decode);
+ cache->UnrefImage(draw_image);
+}
+
SkColorType test_color_types[] = {kN32_SkColorType, kARGB_4444_SkColorType,
kRGBA_F16_SkColorType};
bool false_array[] = {false};
diff --git a/chromium/cc/tiles/image_controller_unittest.cc b/chromium/cc/tiles/image_controller_unittest.cc
index fbe924af6fd..06da97ecd4b 100644
--- a/chromium/cc/tiles/image_controller_unittest.cc
+++ b/chromium/cc/tiles/image_controller_unittest.cc
@@ -202,7 +202,7 @@ class BlockingTask : public TileTask {
EXPECT_FALSE(HasCompleted());
EXPECT_FALSE(thread_checker_.CalledOnValidThread());
base::AutoLock hold(lock_);
- if (!can_run_)
+ while (!can_run_)
run_cv_.Wait();
has_run_ = true;
}
diff --git a/chromium/cc/tiles/image_decode_cache.h b/chromium/cc/tiles/image_decode_cache.h
index 6366a6276f6..bd77daad149 100644
--- a/chromium/cc/tiles/image_decode_cache.h
+++ b/chromium/cc/tiles/image_decode_cache.h
@@ -77,11 +77,24 @@ class CC_EXPORT ImageDecodeCache {
ToScopedImageType(ImageType image_type) {
using ScopedImageType =
devtools_instrumentation::ScopedImageDecodeTask::ImageType;
- if (image_type == ImageType::kWEBP)
- return ScopedImageType::kWebP;
- if (image_type == ImageType::kJPEG)
- return ScopedImageType::kJpeg;
- return ScopedImageType::kOther;
+ switch (image_type) {
+ case ImageType::kAVIF:
+ return ScopedImageType::kAvif;
+ case ImageType::kBMP:
+ return ScopedImageType::kBmp;
+ case ImageType::kGIF:
+ return ScopedImageType::kGif;
+ case ImageType::kICO:
+ return ScopedImageType::kIco;
+ case ImageType::kJPEG:
+ return ScopedImageType::kJpeg;
+ case ImageType::kPNG:
+ return ScopedImageType::kPng;
+ case ImageType::kWEBP:
+ return ScopedImageType::kWebP;
+ case ImageType::kInvalid:
+ return ScopedImageType::kOther;
+ }
}
virtual ~ImageDecodeCache() {}
diff --git a/chromium/cc/tiles/software_image_decode_cache.cc b/chromium/cc/tiles/software_image_decode_cache.cc
index c674a447206..412c1b02c3c 100644
--- a/chromium/cc/tiles/software_image_decode_cache.cc
+++ b/chromium/cc/tiles/software_image_decode_cache.cc
@@ -82,7 +82,7 @@ class SoftwareImageDecodeTaskImpl : public TileTask {
const ImageType image_type =
image_metadata ? image_metadata->image_type : ImageType::kInvalid;
devtools_instrumentation::ScopedImageDecodeTask image_decode_task(
- paint_image_.GetSkImage().get(),
+ paint_image_.GetRasterSkImage().get(),
devtools_instrumentation::ScopedImageDecodeTask::kSoftware,
ImageDecodeCache::ToScopedTaskType(tracing_info_.task_type),
ImageDecodeCache::ToScopedImageType(image_type));
@@ -134,24 +134,6 @@ SkFilterQuality GetDecodedFilterQuality(
: kLow_SkFilterQuality;
}
-void RecordLockExistingCachedImageHistogram(TilePriority::PriorityBin bin,
- bool success) {
- switch (bin) {
- case TilePriority::NOW:
- UMA_HISTOGRAM_BOOLEAN("Renderer4.LockExistingCachedImage.Software.NOW",
- success);
- break;
- case TilePriority::SOON:
- UMA_HISTOGRAM_BOOLEAN("Renderer4.LockExistingCachedImage.Software.SOON",
- success);
- break;
- case TilePriority::EVENTUALLY:
- UMA_HISTOGRAM_BOOLEAN(
- "Renderer4.LockExistingCachedImage.Software.EVENTUALLY", success);
- break;
- }
-}
-
} // namespace
SoftwareImageDecodeCache::SoftwareImageDecodeCache(
@@ -357,9 +339,6 @@ SoftwareImageDecodeCache::DecodeImageIfNecessary(const CacheKey& key,
return TaskProcessingResult::kLockOnly;
bool lock_succeeded = entry->Lock();
- // TODO(vmpstr): Deprecate the prepaint split, since it doesn't matter.
- RecordLockExistingCachedImageHistogram(TilePriority::NOW, lock_succeeded);
-
if (lock_succeeded)
return TaskProcessingResult::kLockOnly;
}
diff --git a/chromium/cc/tiles/software_image_decode_cache_utils.cc b/chromium/cc/tiles/software_image_decode_cache_utils.cc
index cfd2e8786cf..5cbb20aba61 100644
--- a/chromium/cc/tiles/software_image_decode_cache_utils.cc
+++ b/chromium/cc/tiles/software_image_decode_cache_utils.cc
@@ -5,6 +5,7 @@
#include "cc/tiles/software_image_decode_cache_utils.h"
#include <algorithm>
+#include <sstream>
#include <utility>
#include "base/atomic_sequence_num.h"
diff --git a/chromium/cc/tiles/tile_priority.cc b/chromium/cc/tiles/tile_priority.cc
index 606a8c64e0b..1bfe552c057 100644
--- a/chromium/cc/tiles/tile_priority.cc
+++ b/chromium/cc/tiles/tile_priority.cc
@@ -11,18 +11,6 @@
namespace cc {
-std::string WhichTreeToString(WhichTree tree) {
- switch (tree) {
- case ACTIVE_TREE:
- return "ACTIVE_TREE";
- case PENDING_TREE:
- return "PENDING_TREE";
- default:
- DCHECK(false) << "Unrecognized WhichTree value " << tree;
- return "<unknown WhichTree value>";
- }
-}
-
std::string TileResolutionToString(TileResolution resolution) {
switch (resolution) {
case LOW_RESOLUTION:
diff --git a/chromium/cc/tiles/tile_priority.h b/chromium/cc/tiles/tile_priority.h
index 34cd3bc0c5d..bffd8d8ee40 100644
--- a/chromium/cc/tiles/tile_priority.h
+++ b/chromium/cc/tiles/tile_priority.h
@@ -16,10 +16,6 @@
#include "cc/cc_export.h"
#include "third_party/perfetto/protos/perfetto/trace/track_event/chrome_compositor_scheduler_state.pbzero.h"
-namespace base {
-class Value;
-}
-
namespace cc {
enum WhichTree {
@@ -28,9 +24,7 @@ enum WhichTree {
ACTIVE_TREE = 0,
PENDING_TREE = 1,
LAST_TREE = 1
- // Be sure to update WhichTreeAsValue when adding new fields.
};
-std::unique_ptr<base::Value> WhichTreeAsValue(WhichTree tree);
enum TileResolution {
LOW_RESOLUTION = 0 ,