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

Unified Diff: cc/tiles/software_image_decode_controller_unittest.cc

Issue 1866043006: cc: Remove ScheduleOnOriginThread() and CompleteOnOriginThread(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 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/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 68a5a4f0d4da2ed5c7d5bfa6146742e29a4bcd78..df3d9d7990e0df6c2606633757d84ce72504b5ee 100644
--- a/cc/tiles/software_image_decode_controller_unittest.cc
+++ b/cc/tiles/software_image_decode_controller_unittest.cc
@@ -504,9 +504,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageAlreadyDecoded) {
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
+ // TODO(prashant.n): Implement proper task life cycle. crbug.com/599863.
task->RunOnWorkerThread();
scoped_refptr<TileTask> another_task;
@@ -515,9 +513,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageAlreadyDecoded) {
EXPECT_TRUE(need_unref);
EXPECT_FALSE(another_task);
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
controller.UnrefImage(draw_image);
controller.UnrefImage(draw_image);
@@ -538,9 +534,6 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageAlreadyPrerolled) {
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
task->RunOnWorkerThread();
scoped_refptr<TileTask> another_task;
@@ -549,9 +542,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageAlreadyPrerolled) {
EXPECT_TRUE(need_unref);
EXPECT_FALSE(another_task);
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
scoped_refptr<TileTask> third_task;
need_unref = controller.GetTaskForImageAndRef(
@@ -579,10 +570,6 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageCanceledGetsNewTask) {
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
-
scoped_refptr<TileTask> another_task;
need_unref = controller.GetTaskForImageAndRef(
draw_image, ImageDecodeController::TracingInfo(), &another_task);
@@ -590,9 +577,7 @@ TEST(SoftwareImageDecodeControllerTest, GetTaskForImageCanceledGetsNewTask) {
EXPECT_TRUE(another_task.get() == task.get());
// Didn't run the task, complete it (it was canceled).
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
// Fully cancel everything (so the raster would unref things).
controller.UnrefImage(draw_image);
@@ -625,10 +610,6 @@ TEST(SoftwareImageDecodeControllerTest,
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
-
scoped_refptr<TileTask> another_task;
need_unref = controller.GetTaskForImageAndRef(
draw_image, ImageDecodeController::TracingInfo(), &another_task);
@@ -636,9 +617,7 @@ TEST(SoftwareImageDecodeControllerTest,
EXPECT_TRUE(another_task.get() == task.get());
// Didn't run the task, complete it (it was canceled).
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
// Note that here, everything is reffed, but a new task is created. This is
// possible with repeated schedule/cancel operations.
@@ -670,15 +649,9 @@ TEST(SoftwareImageDecodeControllerTest, GetDecodedImageForDraw) {
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
-
task->RunOnWorkerThread();
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
DecodedDrawImage decoded_draw_image =
controller.GetDecodedImageForDraw(draw_image);
@@ -711,15 +684,9 @@ TEST(SoftwareImageDecodeControllerTest,
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
-
task->RunOnWorkerThread();
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
DecodedDrawImage decoded_draw_image =
controller.GetDecodedImageForDraw(draw_image);
@@ -819,15 +786,9 @@ TEST(SoftwareImageDecodeControllerTest,
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
-
task->RunOnWorkerThread();
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
DecodedDrawImage another_decoded_draw_image =
controller.GetDecodedImageForDraw(draw_image);
@@ -872,19 +833,13 @@ TEST(SoftwareImageDecodeControllerTest,
EXPECT_TRUE(need_unref);
EXPECT_TRUE(task);
- task->WillSchedule();
- task->ScheduleOnOriginThread(nullptr);
- task->DidSchedule();
-
// If we finish the draw here, then we will use it for the locked decode
// instead of decoding again.
controller.DrawWithImageFinished(draw_image, decoded_draw_image);
task->RunOnWorkerThread();
- task->WillComplete();
- task->CompleteOnOriginThread(nullptr);
- task->DidComplete();
+ task->OnTaskCompleted();
DecodedDrawImage another_decoded_draw_image =
controller.GetDecodedImageForDraw(draw_image);

Powered by Google App Engine
This is Rietveld 408576698