[core] Do not make pending requests for already requested images.

so that processing for the corresponding tile does not suspend and
the rendering performance is not affected.
This commit is contained in:
Mikhail Pozdnyakov
2019-10-25 15:13:02 +03:00
parent aa36dc87fb
commit 2f00ba7294
2 changed files with 9 additions and 18 deletions

View File

@@ -187,20 +187,14 @@ TEST(ImageManager, OnStyleImageMissingBeforeSpriteLoaded) {
EXPECT_EQ(observer.count, 1);
ASSERT_TRUE(notified);
// Repeated request of the same image shall not result another
// `ImageManagerObserver.onStyleImageMissing()` call.
imageManager.getImages(requestor, std::make_pair(dependencies, ++imageCorrelationID));
runLoop.runOnce();
EXPECT_EQ(observer.count, 1);
// Request for updated dependencies must be dispatched to the
// observer.
dependencies.emplace("post", ImageType::Icon);
imageManager.getImages(requestor, std::make_pair(dependencies, ++imageCorrelationID));
runLoop.runOnce();
ASSERT_TRUE(requestor.hasPendingRequests());
EXPECT_EQ(observer.count, 2);
runLoop.runOnce();
ASSERT_FALSE(requestor.hasPendingRequests());
// Another requestor shall not have pending requests for already obtained images.
StubImageRequestor anotherRequestor(imageManager);