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

Unified Diff: cc/tiles/software_image_decode_controller_unittest.cc

Issue 1854723002: cc: Simplify task and its derived classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected scope of dependencies. Created 4 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: cc/tiles/software_image_decode_controller_unittest.cc
diff --git a/cc/tiles/software_image_decode_controller_unittest.cc b/cc/tiles/software_image_decode_controller_unittest.cc
index 38246b38398a20307d639ee76bde98d8a204badd..643982543bb1bbe530afa4703a1e47e89abeb760 100644
--- a/cc/tiles/software_image_decode_controller_unittest.cc
+++ b/cc/tiles/software_image_decode_controller_unittest.cc
@@ -359,7 +359,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageSameImage) {
DrawImage draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
@@ -368,7 +368,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageSameImage) {
DrawImage another_draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> another_task;
+ scoped_refptr<Task> another_task;
need_unref = controller.GetTaskForImageAndRef(
another_draw_image, prepare_tiles_id, &another_task);
EXPECT_TRUE(need_unref);
@@ -389,7 +389,7 @@ TEST(SoftwareImageDecodeControllerTest,
image.get(), SkIRect::MakeWH(image->width(), image->height()),
kHigh_SkFilterQuality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> high_quality_task;
+ scoped_refptr<Task> high_quality_task;
bool need_unref = controller.GetTaskForImageAndRef(
high_quality_draw_image, prepare_tiles_id, &high_quality_task);
EXPECT_TRUE(need_unref);
@@ -399,7 +399,7 @@ TEST(SoftwareImageDecodeControllerTest,
image.get(), SkIRect::MakeWH(image->width(), image->height()),
kMedium_SkFilterQuality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> medium_quality_task;
+ scoped_refptr<Task> medium_quality_task;
need_unref = controller.GetTaskForImageAndRef(
medium_quality_draw_image, prepare_tiles_id, &medium_quality_task);
// Medium quality isn't handled by the controller, so it won't ref it. Note
@@ -413,7 +413,7 @@ TEST(SoftwareImageDecodeControllerTest,
image.get(), SkIRect::MakeWH(image->width(), image->height()),
kLow_SkFilterQuality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> low_quality_task;
+ scoped_refptr<Task> low_quality_task;
need_unref = controller.GetTaskForImageAndRef(
low_quality_draw_image, prepare_tiles_id, &low_quality_task);
EXPECT_TRUE(need_unref);
@@ -435,7 +435,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageSameImageDifferentSize) {
DrawImage half_size_draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> half_size_task;
+ scoped_refptr<Task> half_size_task;
bool need_unref = controller.GetTaskForImageAndRef(
half_size_draw_image, prepare_tiles_id, &half_size_task);
EXPECT_TRUE(need_unref);
@@ -444,7 +444,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageSameImageDifferentSize) {
DrawImage quarter_size_draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.25f, 0.25f), is_decomposable));
- scoped_refptr<ImageDecodeTask> quarter_size_task;
+ scoped_refptr<Task> quarter_size_task;
need_unref = controller.GetTaskForImageAndRef(
quarter_size_draw_image, prepare_tiles_id, &quarter_size_task);
EXPECT_TRUE(need_unref);
@@ -466,7 +466,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageDifferentImage) {
first_image.get(),
SkIRect::MakeWH(first_image->width(), first_image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> first_task;
+ scoped_refptr<Task> first_task;
bool need_unref = controller.GetTaskForImageAndRef(
first_draw_image, prepare_tiles_id, &first_task);
EXPECT_TRUE(need_unref);
@@ -477,7 +477,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageDifferentImage) {
second_image.get(),
SkIRect::MakeWH(second_image->width(), second_image->height()), quality,
CreateMatrix(SkSize::Make(0.25f, 0.25f), is_decomposable));
- scoped_refptr<ImageDecodeTask> second_task;
+ scoped_refptr<Task> second_task;
need_unref = controller.GetTaskForImageAndRef(second_draw_image,
prepare_tiles_id, &second_task);
EXPECT_TRUE(need_unref);
@@ -498,25 +498,25 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageAlreadyDecoded) {
DrawImage draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
task->RunOnWorkerThread();
- scoped_refptr<ImageDecodeTask> another_task;
+ scoped_refptr<Task> another_task;
need_unref = controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id,
&another_task);
EXPECT_TRUE(need_unref);
EXPECT_FALSE(another_task);
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
controller.UnrefImage(draw_image);
@@ -533,28 +533,28 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageAlreadyPrerolled) {
DrawImage draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(1.f, 1.f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
task->RunOnWorkerThread();
- scoped_refptr<ImageDecodeTask> another_task;
+ scoped_refptr<Task> another_task;
need_unref = controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id,
&another_task);
EXPECT_TRUE(need_unref);
EXPECT_FALSE(another_task);
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
- scoped_refptr<ImageDecodeTask> third_task;
+ scoped_refptr<Task> third_task;
need_unref = controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id,
&third_task);
EXPECT_TRUE(need_unref);
@@ -575,17 +575,17 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageCanceledGetsNewTask) {
DrawImage draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
- scoped_refptr<ImageDecodeTask> another_task;
+ scoped_refptr<Task> another_task;
need_unref = controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id,
&another_task);
EXPECT_TRUE(need_unref);
@@ -593,7 +593,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageCanceledGetsNewTask) {
// Didn't run the task, complete it (it was canceled).
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
// Fully cancel everything (so the raster would unref things).
@@ -601,7 +601,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageCanceledGetsNewTask) {
controller.UnrefImage(draw_image);
// Here a new task is created.
- scoped_refptr<ImageDecodeTask> third_task;
+ scoped_refptr<Task> third_task;
need_unref = controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id,
&third_task);
EXPECT_TRUE(need_unref);
@@ -622,17 +622,17 @@ TEST(SoftwareImageDecodeControllerTest,
DrawImage draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
- scoped_refptr<ImageDecodeTask> another_task;
+ scoped_refptr<Task> another_task;
need_unref = controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id,
&another_task);
EXPECT_TRUE(need_unref);
@@ -640,12 +640,12 @@ TEST(SoftwareImageDecodeControllerTest,
// Didn't run the task, complete it (it was canceled).
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
// Note that here, everything is reffed, but a new task is created. This is
// possible with repeated schedule/cancel operations.
- scoped_refptr<ImageDecodeTask> third_task;
+ scoped_refptr<Task> third_task;
need_unref = controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id,
&third_task);
EXPECT_TRUE(need_unref);
@@ -668,20 +668,20 @@ TEST(SoftwareImageDecodeControllerTest, GetDecodedImageForDraw) {
DrawImage draw_image(
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
task->RunOnWorkerThread();
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
DecodedDrawImage decoded_draw_image =
@@ -710,20 +710,20 @@ TEST(SoftwareImageDecodeControllerTest,
DrawImage draw_image(
image.get(), SkIRect::MakeXYWH(20, 30, image->width(), image->height()),
quality, CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
task->RunOnWorkerThread();
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
DecodedDrawImage decoded_draw_image =
@@ -819,20 +819,20 @@ TEST(SoftwareImageDecodeControllerTest,
EXPECT_FALSE(decoded_draw_image.is_scale_adjustment_identity());
EXPECT_TRUE(decoded_draw_image.is_at_raster_decode());
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
task->RunOnWorkerThread();
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
DecodedDrawImage another_decoded_draw_image =
@@ -873,14 +873,14 @@ TEST(SoftwareImageDecodeControllerTest,
EXPECT_FALSE(decoded_draw_image.is_scale_adjustment_identity());
EXPECT_TRUE(decoded_draw_image.is_at_raster_decode());
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
+ task->ScheduleOnOriginThread();
task->DidSchedule();
// If we finish the draw here, then we will use it for the locked decode
@@ -890,7 +890,7 @@ TEST(SoftwareImageDecodeControllerTest,
task->RunOnWorkerThread();
task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
+ task->CompleteOnOriginThread();
task->DidComplete();
DecodedDrawImage another_decoded_draw_image =
@@ -916,7 +916,7 @@ TEST(SoftwareImageDecodeControllerTest, ZeroSizedImagesAreSkipped) {
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(0.f, 0.f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_FALSE(task);
@@ -940,7 +940,7 @@ TEST(SoftwareImageDecodeControllerTest, NonOverlappingSrcRectImagesAreSkipped) {
image.get(), SkIRect::MakeXYWH(150, 150, image->width(), image->height()),
quality, CreateMatrix(SkSize::Make(1.f, 1.f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_FALSE(task);
@@ -964,7 +964,7 @@ TEST(SoftwareImageDecodeControllerTest, LowQualityFilterIsHandled) {
image.get(), SkIRect::MakeWH(image->width(), image->height()), quality,
CreateMatrix(SkSize::Make(1.f, 1.f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(task);
@@ -991,7 +991,7 @@ TEST(SoftwareImageDecodeControllerTest, LowQualityScaledSubrectIsHandled) {
DrawImage draw_image(image.get(), SkIRect::MakeXYWH(10, 10, 80, 80), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(task);
@@ -1020,7 +1020,7 @@ TEST(SoftwareImageDecodeControllerTest, NoneQualityScaledSubrectIsHandled) {
DrawImage draw_image(image.get(), SkIRect::MakeXYWH(10, 10, 80, 80), quality,
CreateMatrix(SkSize::Make(0.5f, 0.5f), is_decomposable));
- scoped_refptr<ImageDecodeTask> task;
+ scoped_refptr<Task> task;
bool need_unref =
controller.GetTaskForImageAndRef(draw_image, prepare_tiles_id, &task);
EXPECT_TRUE(task);

Powered by Google App Engine
This is Rietveld 408576698