Commit 31818313 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Chromium LUCI CQ

service worker: Stop serializing storage operations

To de-flake payment related browser_tests.

These tests call GetUserDataForAllRegistrationsByKeyPrefix() more than
500 times. Storage operations are serialized as of
crrev.com/c/2494208 but the serialization mechanism doesn't seem to be
working correctly for these tests. There seems a situation where we
don't call the callback of the method and hit DCHECK() in mojo generated
bindings.

This CL stops serializing storage operations. Follow-up CLs will address
the root cause and re-implement the serialization.

I ran LoadAndRemoveIframeWithManyPaymentRequestsTest 50 times on my
local environment and didn't observe flakiness. Without this CL the
test crashed once every 5 times.

Bug: 1129578,1133143
Change-Id: I3054f02eadfb21c570124aca5a377d8112ef8cea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2584432
Auto-Submit: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836541}
parent 6f52ecac
...@@ -312,7 +312,7 @@ TEST_F(ServiceWorkerContextCoreTest, DeleteForOrigin_UnregisterFail) { ...@@ -312,7 +312,7 @@ TEST_F(ServiceWorkerContextCoreTest, DeleteForOrigin_UnregisterFail) {
loop.Run(); loop.Run();
// The operation should still complete. // The operation should still complete.
EXPECT_EQ(blink::ServiceWorkerStatusCode::kErrorAbort, status); EXPECT_EQ(blink::ServiceWorkerStatusCode::kErrorFailed, status);
} }
} // namespace content } // namespace content
...@@ -1616,8 +1616,8 @@ void ServiceWorkerRegistry::DidRecover() { ...@@ -1616,8 +1616,8 @@ void ServiceWorkerRegistry::DidRecover() {
connection_state_ = ConnectionState::kNormal; connection_state_ = ConnectionState::kNormal;
// Retry inflight calls. // Retry inflight calls.
if (inflight_calls_.size() > 0) for (auto& call : inflight_calls_)
inflight_calls_.begin()->second->Run(this); call.second->Run(this);
} }
uint64_t ServiceWorkerRegistry::GetNextCallId() { uint64_t ServiceWorkerRegistry::GetNextCallId() {
...@@ -1629,19 +1629,14 @@ void ServiceWorkerRegistry::StartRemoteCall( ...@@ -1629,19 +1629,14 @@ void ServiceWorkerRegistry::StartRemoteCall(
std::unique_ptr<InflightCall> call) { std::unique_ptr<InflightCall> call) {
DCHECK(!base::Contains(inflight_calls_, call_id)); DCHECK(!base::Contains(inflight_calls_, call_id));
inflight_calls_[call_id] = std::move(call); inflight_calls_[call_id] = std::move(call);
if (connection_state_ == ConnectionState::kNormal && if (connection_state_ == ConnectionState::kNormal) {
inflight_calls_.size() == 1) { inflight_calls_[call_id]->Run(this);
// There are no inflight calls. Start the current one.
inflight_calls_.begin()->second->Run(this);
} }
} }
void ServiceWorkerRegistry::FinishRemoteCall(uint64_t call_id) { void ServiceWorkerRegistry::FinishRemoteCall(uint64_t call_id) {
DCHECK(base::Contains(inflight_calls_, call_id)); DCHECK(base::Contains(inflight_calls_, call_id));
inflight_calls_.erase(call_id); inflight_calls_.erase(call_id);
// Start the next call if any.
if (inflight_calls_.size() > 0)
inflight_calls_.begin()->second->Run(this);
} }
template <typename T> template <typename T>
......
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