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

Unified Diff: cc/tiles/image_controller_unittest.cc

Issue 2699533010: cc: Fix cleanup path for image decode requests in ImageController. (Closed)
Patch Set: .. Created 3 years, 10 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
« no previous file with comments | « cc/tiles/image_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/image_controller_unittest.cc
diff --git a/cc/tiles/image_controller_unittest.cc b/cc/tiles/image_controller_unittest.cc
index ddd537617a2a4cc5d891466d344dbdfa9081ed97..cd341555e712f33df7816bfc7fdfe2ae73607a03 100644
--- a/cc/tiles/image_controller_unittest.cc
+++ b/cc/tiles/image_controller_unittest.cc
@@ -447,5 +447,31 @@ TEST_F(ImageControllerTest, QueueImageDecodeLockedImageControllerChange) {
EXPECT_EQ(0, cache()->number_of_refs());
}
+TEST_F(ImageControllerTest, DispatchesDecodeCallbacksAfterCacheChanged) {
+ scoped_refptr<SimpleTask> task(new SimpleTask);
+ cache()->SetTaskToUse(task);
+
+ base::RunLoop run_loop1;
+ DecodeClient decode_client1;
+ base::RunLoop run_loop2;
+ DecodeClient decode_client2;
+
+ controller()->QueueImageDecode(
+ image(),
+ base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client1),
+ run_loop1.QuitClosure()));
+ controller()->QueueImageDecode(
+ image(),
+ base::Bind(&DecodeClient::Callback, base::Unretained(&decode_client2),
+ run_loop2.QuitClosure()));
+
+ // Now reset the image cache before decode completed callbacks are posted to
+ // the compositor thread. Ensure that the completion callbacks for the decode
+ // is still run.
+ controller()->SetImageDecodeCache(nullptr);
+ RunOrTimeout(&run_loop1);
+ RunOrTimeout(&run_loop2);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/tiles/image_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698