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

Unified Diff: cc/tiles/image_controller_unittest.cc

Issue 2904743002: cc: Add UMA for tracking decode duration for out of raster decodes. (Closed)
Patch Set: .. Created 3 years, 7 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: cc/tiles/image_controller_unittest.cc
diff --git a/cc/tiles/image_controller_unittest.cc b/cc/tiles/image_controller_unittest.cc
index a4a565774a4631725a4d3d3c849871169579a7d9..51a4dec945a1a74fee3def09d33c2e808d59cfc2 100644
--- a/cc/tiles/image_controller_unittest.cc
+++ b/cc/tiles/image_controller_unittest.cc
@@ -112,6 +112,7 @@ class TestableCache : public ImageDecodeCache {
}
bool GetOutOfRasterDecodeTaskForImageAndRef(
const DrawImage& image,
+ ImageDecodeType type,
scoped_refptr<TileTask>* task) override {
return GetTaskForImageAndRef(image, TracingInfo(), task);
}
@@ -307,7 +308,8 @@ TEST_F(ImageControllerTest, QueueImageDecode) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client),
- run_loop.QuitClosure()));
+ run_loop.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop);
EXPECT_EQ(expected_id, decode_client.id());
EXPECT_EQ(ImageController::ImageDecodeResult::SUCCESS,
@@ -326,7 +328,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeNonLazy) {
controller()->QueueImageDecode(
image,
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client),
- run_loop.QuitClosure()));
+ run_loop.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop);
EXPECT_EQ(expected_id, decode_client.id());
EXPECT_EQ(ImageController::ImageDecodeResult::DECODE_NOT_REQUIRED,
@@ -342,7 +345,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeTooLarge) {
controller()->QueueImageDecode(
image,
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client),
- run_loop.QuitClosure()));
+ run_loop.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop);
EXPECT_EQ(expected_id, decode_client.id());
EXPECT_EQ(ImageController::ImageDecodeResult::FAILURE,
@@ -356,19 +360,22 @@ TEST_F(ImageControllerTest, QueueImageDecodeMultipleImages) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
- base::Bind([] {})));
+ base::Bind([] {})),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
DecodeClient decode_client2;
ImageController::ImageDecodeRequestId expected_id2 =
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
- base::Bind([] {})));
+ base::Bind([] {})),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
DecodeClient decode_client3;
ImageController::ImageDecodeRequestId expected_id3 =
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client3),
- run_loop.QuitClosure()));
+ run_loop.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop);
EXPECT_EQ(expected_id1, decode_client1.id());
EXPECT_EQ(ImageController::ImageDecodeResult::SUCCESS,
@@ -391,7 +398,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeWithTask) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client),
- run_loop.QuitClosure()));
+ run_loop.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop);
EXPECT_EQ(expected_id, decode_client.id());
EXPECT_TRUE(task->has_run());
@@ -408,19 +416,22 @@ TEST_F(ImageControllerTest, QueueImageDecodeMultipleImagesSameTask) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
- base::Bind([] {})));
+ base::Bind([] {})),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
DecodeClient decode_client2;
ImageController::ImageDecodeRequestId expected_id2 =
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
- base::Bind([] {})));
+ base::Bind([] {})),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
DecodeClient decode_client3;
ImageController::ImageDecodeRequestId expected_id3 =
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client3),
- run_loop.QuitClosure()));
+ run_loop.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop);
EXPECT_EQ(expected_id1, decode_client1.id());
EXPECT_EQ(ImageController::ImageDecodeResult::SUCCESS,
@@ -444,7 +455,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeChangeControllerWithTaskQueued) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
- base::Bind([] {})));
+ base::Bind([] {})),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
scoped_refptr<BlockingTask> task_two(new BlockingTask);
cache()->SetTaskToUse(task_two);
@@ -455,7 +467,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeChangeControllerWithTaskQueued) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
- run_loop.QuitClosure()));
+ run_loop.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
task_one->AllowToRun();
task_two->AllowToRun();
@@ -480,7 +493,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeImageAlreadyLocked) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
- run_loop1.QuitClosure()));
+ run_loop1.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop1);
EXPECT_EQ(expected_id1, decode_client1.id());
EXPECT_TRUE(task->has_run());
@@ -492,7 +506,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeImageAlreadyLocked) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
- run_loop2.QuitClosure()));
+ run_loop2.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop2);
EXPECT_EQ(expected_id2, decode_client2.id());
EXPECT_EQ(ImageController::ImageDecodeResult::SUCCESS,
@@ -509,7 +524,8 @@ TEST_F(ImageControllerTest, QueueImageDecodeLockedImageControllerChange) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
- run_loop1.QuitClosure()));
+ run_loop1.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
RunOrTimeout(&run_loop1);
EXPECT_EQ(expected_id1, decode_client1.id());
EXPECT_TRUE(task->has_run());
@@ -531,11 +547,13 @@ TEST_F(ImageControllerTest, DispatchesDecodeCallbacksAfterCacheReset) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
- run_loop1.QuitClosure()));
+ run_loop1.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
- run_loop2.QuitClosure()));
+ run_loop2.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
// Now reset the image cache before decode completed callbacks are posted to
// the compositor thread. Ensure that the completion callbacks for the decode
@@ -564,11 +582,13 @@ TEST_F(ImageControllerTest, DispatchesDecodeCallbacksAfterCacheChanged) {
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
- run_loop1.QuitClosure()));
+ run_loop1.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
controller()->QueueImageDecode(
image(),
base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
- run_loop2.QuitClosure()));
+ run_loop2.QuitClosure()),
+ ImageDecodeCache::ImageDecodeType::kCheckerImaging);
// Now reset the image cache before decode completed callbacks are posted to
// the compositor thread. This should orphan the requests.

Powered by Google App Engine
This is Rietveld 408576698