| 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..2e4c1339c23e5f7949014db82f1ed99e9cf9534a 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| DecodeClient decode_client2;
|
| ImageController::ImageDecodeRequestId expected_id2 =
|
| controller()->QueueImageDecode(
|
| image(),
|
| base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
|
| - base::Bind([] {})));
|
| + base::Bind([] {})),
|
| + ImageDecodeCache::ImageDecodeType::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| DecodeClient decode_client2;
|
| ImageController::ImageDecodeRequestId expected_id2 =
|
| controller()->QueueImageDecode(
|
| image(),
|
| base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
|
| - base::Bind([] {})));
|
| + base::Bind([] {})),
|
| + ImageDecodeCache::ImageDecodeType::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
|
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
|
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| controller()->QueueImageDecode(
|
| image(),
|
| base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
|
| - run_loop2.QuitClosure()));
|
| + run_loop2.QuitClosure()),
|
| + ImageDecodeCache::ImageDecodeType::OUT_OF_RASTER_CHECKER_IMAGING);
|
|
|
| // 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::OUT_OF_RASTER_CHECKER_IMAGING);
|
| controller()->QueueImageDecode(
|
| image(),
|
| base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
|
| - run_loop2.QuitClosure()));
|
| + run_loop2.QuitClosure()),
|
| + ImageDecodeCache::ImageDecodeType::OUT_OF_RASTER_CHECKER_IMAGING);
|
|
|
| // Now reset the image cache before decode completed callbacks are posted to
|
| // the compositor thread. This should orphan the requests.
|
|
|