Commit ddb1d689 authored by Maksim Ivanov's avatar Maksim Ivanov Committed by Commit Bot

Fix use-after-move in //content/browser/service_worker/

Fix use-after-move (potential) bugs found by the
"bugprone-use-after-move" clang-tidy check.

Bug: 1122844
Change-Id: I987800bb2b59f29899c308125594d45b4d409a38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2382759Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803087}
parent f3eef02a
......@@ -8,6 +8,7 @@
#include <string>
#include <utility>
#include "base/callback_helpers.h"
#include "base/strings/string_number_conversions.h"
#include "content/browser/service_worker/service_worker_cache_writer.h"
#include "content/browser/service_worker/service_worker_consts.h"
......@@ -210,13 +211,15 @@ void ServiceWorkerScriptLoaderFactory::CopyScript(
scoped_refptr<ServiceWorkerVersion> version = worker_host_->version();
version->script_cache_map()->NotifyStartedCaching(url, new_resource_id);
auto repeating_callback =
base::AdaptCallbackForRepeating(std::move(callback));
net::Error error = cache_writer_->StartCopy(
base::BindOnce(std::move(callback), new_resource_id));
base::BindOnce(repeating_callback, new_resource_id));
// Run the callback directly if the operation completed or failed
// synchronously.
if (net::ERR_IO_PENDING != error) {
std::move(callback).Run(new_resource_id, error);
repeating_callback.Run(new_resource_id, error);
}
}
......
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