Commit cf72027b authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Remove instrumentation code for resource size debugging

The bug was fixed and we don't observe flakiness any longer.
Remove the instrumentations.

Tbr: kinuko@chromium.org
Bug: 946719
Change-Id: I7f31002516f2507a7205ab5c2680ebcf3f748e2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2094375
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748129}
parent 34c4d91d
...@@ -65,8 +65,7 @@ struct ServiceWorkerRegistrationData { ...@@ -65,8 +65,7 @@ struct ServiceWorkerRegistrationData {
struct ServiceWorkerResourceRecord { struct ServiceWorkerResourceRecord {
int64 resource_id = blink.mojom.kInvalidServiceWorkerResourceId; int64 resource_id = blink.mojom.kInvalidServiceWorkerResourceId;
url.mojom.Url url; url.mojom.Url url;
// Signed so we can store ResourceRecordErrorState. When stored to the // |size_bytes| could be -1 when there was an error while loading the worker
// database, this value should always be >= 0. // script data, but when stored to the database this value is always >= 0.
// TODO(crbug.com/946719): Change to uint64 when the bug is fixed.
int64 size_bytes = 0; int64 size_bytes = 0;
}; };
...@@ -16,21 +16,6 @@ ...@@ -16,21 +16,6 @@
#include "net/base/io_buffer.h" #include "net/base/io_buffer.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
namespace {
// Represents an error state. Each enum instance should be a negative
// value. This is just temporary for debugging.
// TODO(crbug.com/946719): Remove this once we fix the bug.
enum class ResourceRecordErrorState : int64_t {
// We don't use -1 here to catch an untracked usage of -1 as an error
// code.
kStartedCaching = -2,
kFinishedCachingNoBytesWritten = -3,
kFinishedCachingNoContext = -4,
};
} // namespace
namespace content { namespace content {
ServiceWorkerScriptCacheMap::ServiceWorkerScriptCacheMap( ServiceWorkerScriptCacheMap::ServiceWorkerScriptCacheMap(
...@@ -57,9 +42,8 @@ void ServiceWorkerScriptCacheMap::NotifyStartedCaching(const GURL& url, ...@@ -57,9 +42,8 @@ void ServiceWorkerScriptCacheMap::NotifyStartedCaching(const GURL& url,
<< owner_->status(); << owner_->status();
if (!context_) if (!context_)
return; // Our storage has been wiped via DeleteAndStartOver. return; // Our storage has been wiped via DeleteAndStartOver.
resource_map_[url] = storage::mojom::ServiceWorkerResourceRecord::New( resource_map_[url] =
resource_id, url, storage::mojom::ServiceWorkerResourceRecord::New(resource_id, url, -1);
static_cast<int64_t>(ResourceRecordErrorState::kStartedCaching));
context_->registry()->StoreUncommittedResourceId(resource_id, context_->registry()->StoreUncommittedResourceId(resource_id,
owner_->scope().GetOrigin()); owner_->scope().GetOrigin());
} }
...@@ -75,17 +59,9 @@ void ServiceWorkerScriptCacheMap::NotifyFinishedCaching( ...@@ -75,17 +59,9 @@ void ServiceWorkerScriptCacheMap::NotifyFinishedCaching(
DCHECK(owner_->status() == ServiceWorkerVersion::NEW || DCHECK(owner_->status() == ServiceWorkerVersion::NEW ||
owner_->status() == ServiceWorkerVersion::INSTALLING || owner_->status() == ServiceWorkerVersion::INSTALLING ||
owner_->status() == ServiceWorkerVersion::REDUNDANT); owner_->status() == ServiceWorkerVersion::REDUNDANT);
if (!context_) { if (!context_)
// For debugging. See https://crbug.com/946719.
DCHECK(resource_map_.find(url) != resource_map_.end());
storage::mojom::ServiceWorkerResourceRecordPtr& record = resource_map_[url];
if (record->size_bytes ==
static_cast<int64_t>(ResourceRecordErrorState::kStartedCaching)) {
record->size_bytes = static_cast<int64_t>(
ResourceRecordErrorState::kFinishedCachingNoContext);
}
return; // Our storage has been wiped via DeleteAndStartOver. return; // Our storage has been wiped via DeleteAndStartOver.
}
if (net_error != net::OK) { if (net_error != net::OK) {
context_->registry()->DoomUncommittedResource(LookupResourceId(url)); context_->registry()->DoomUncommittedResource(LookupResourceId(url));
resource_map_.erase(url); resource_map_.erase(url);
...@@ -93,11 +69,8 @@ void ServiceWorkerScriptCacheMap::NotifyFinishedCaching( ...@@ -93,11 +69,8 @@ void ServiceWorkerScriptCacheMap::NotifyFinishedCaching(
main_script_net_error_ = net_error; main_script_net_error_ = net_error;
main_script_status_message_ = status_message; main_script_status_message_ = status_message;
} }
} else if (size_bytes >= 0) {
resource_map_[url]->size_bytes = size_bytes;
} else { } else {
resource_map_[url]->size_bytes = static_cast<int64_t>( resource_map_[url]->size_bytes = size_bytes;
ResourceRecordErrorState::kFinishedCachingNoBytesWritten);
} }
} }
......
...@@ -62,8 +62,6 @@ namespace service_worker_storage_unittest { ...@@ -62,8 +62,6 @@ namespace service_worker_storage_unittest {
using RegistrationData = storage::mojom::ServiceWorkerRegistrationData; using RegistrationData = storage::mojom::ServiceWorkerRegistrationData;
using ResourceRecord = storage::mojom::ServiceWorkerResourceRecordPtr; using ResourceRecord = storage::mojom::ServiceWorkerResourceRecordPtr;
// TODO(crbug.com/946719): Change the type of |size_bytes| to uint64_t when
// the bug is fixed.
ResourceRecord CreateResourceRecord(int64_t resource_id, ResourceRecord CreateResourceRecord(int64_t resource_id,
const GURL& url, const GURL& url,
int64_t size_bytes) { int64_t size_bytes) {
......
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