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

Simplify ServiceWorkerVersion::FinishStartWorker()

The method previously used a template function but the template
function was used only from the method. Merge them so that stack
traces are easy to analyze for crashes which contain the method.

Note that this CL doesn't address the crash.

Bug: 1161800
Change-Id: I59898a39b880b6c31e84f96878f898c57f9eefdc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2626992Reviewed-by: default avatarAsami Doi <asamidoi@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843437}
parent 6e60fb4b
...@@ -93,16 +93,6 @@ void RunSoon(base::OnceClosure callback) { ...@@ -93,16 +93,6 @@ void RunSoon(base::OnceClosure callback) {
} }
} }
template <typename CallbackArray, typename Arg>
void RunCallbacks(ServiceWorkerVersion* version,
CallbackArray* callbacks_ptr,
const Arg& arg) {
CallbackArray callbacks;
callbacks.swap(*callbacks_ptr);
for (auto& callback : callbacks)
std::move(callback).Run(arg);
}
// An adapter to run a |callback| after StartWorker. // An adapter to run a |callback| after StartWorker.
void RunCallbackAfterStartWorker(base::WeakPtr<ServiceWorkerVersion> version, void RunCallbackAfterStartWorker(base::WeakPtr<ServiceWorkerVersion> version,
ServiceWorkerVersion::StatusCallback callback, ServiceWorkerVersion::StatusCallback callback,
...@@ -2285,7 +2275,10 @@ void ServiceWorkerVersion::OnStoppedInternal(EmbeddedWorkerStatus old_status) { ...@@ -2285,7 +2275,10 @@ void ServiceWorkerVersion::OnStoppedInternal(EmbeddedWorkerStatus old_status) {
void ServiceWorkerVersion::FinishStartWorker( void ServiceWorkerVersion::FinishStartWorker(
blink::ServiceWorkerStatusCode status) { blink::ServiceWorkerStatusCode status) {
RunCallbacks(this, &start_callbacks_, status); std::vector<StatusCallback> callbacks;
callbacks.swap(start_callbacks_);
for (auto& callback : callbacks)
std::move(callback).Run(status);
} }
void ServiceWorkerVersion::CleanUpExternalRequest( void ServiceWorkerVersion::CleanUpExternalRequest(
......
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