Commit 9a259069 authored by Mythri A's avatar Mythri A Committed by Commit Bot

Remove an incorrect DCHECK in GeneratedCodeCache

The DCHECK in IssuePendingOperations is not correct. We still need
to issue pending operations when the backend has failed so we can call
required callbacks (for ex: for FetchEntry requests). This DCHECK was
added in an older version of code when we didn't receive any requests
before initializing the backend.

Also adds a test to test this path.

Change-Id: I5eec4886445eb65b0b083cc0805713449d07fc11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1634703Reviewed-by: default avatarMaks Orlovich <morlovich@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664693}
parent bd35e6e9
...@@ -336,7 +336,6 @@ void GeneratedCodeCache::DidCreateBackend( ...@@ -336,7 +336,6 @@ void GeneratedCodeCache::DidCreateBackend(
} }
void GeneratedCodeCache::IssuePendingOperations() { void GeneratedCodeCache::IssuePendingOperations() {
DCHECK_EQ(backend_state_, kInitialized);
// Issue all the pending operations that were received when creating // Issue all the pending operations that were received when creating
// the backend. // the backend.
for (auto const& op : pending_ops_) { for (auto const& op : pending_ops_) {
......
...@@ -367,4 +367,20 @@ TEST_F(GeneratedCodeCacheTest, WasmCache) { ...@@ -367,4 +367,20 @@ TEST_F(GeneratedCodeCacheTest, WasmCache) {
ASSERT_TRUE(received_); ASSERT_TRUE(received_);
EXPECT_EQ(kInitialData, received_data_); EXPECT_EQ(kInitialData, received_data_);
} }
TEST_F(GeneratedCodeCacheTest, TestFailedBackendOpening) {
GURL url(kInitialUrl);
GURL origin_lock = GURL(kInitialOrigin);
// Clear cache_path_ so the backend initialization fails.
cache_path_.clear();
InitializeCacheAndReOpen(GeneratedCodeCache::CodeCacheType::kJavaScript);
FetchFromCache(url, origin_lock);
scoped_task_environment_.RunUntilIdle();
// We should still receive a callback.
ASSERT_TRUE(received_);
// We shouldn't receive any data.
ASSERT_TRUE(received_null_);
}
} // namespace content } // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment