Commit 755bf109 authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

service worker: Use {From,In}Microseconds() to store last update check time

{From,To}InternalValue() are deprecated so replace them with suggested
{From,In}Microseconds(). This may not be the same as deprecated ones
but these would be fine as we use them to store script response time.

Bug: 634507
Change-Id: Ie4a4b1bbbd65692888b3a3a0abe8606feddae9b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933836
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718988}
parent cdcf5765
...@@ -1493,8 +1493,8 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::ParseRegistrationData( ...@@ -1493,8 +1493,8 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::ParseRegistrationData(
out->version_id = data.version_id(); out->version_id = data.version_id();
out->is_active = data.is_active(); out->is_active = data.is_active();
out->has_fetch_handler = data.has_fetch_handler(); out->has_fetch_handler = data.has_fetch_handler();
out->last_update_check = out->last_update_check = base::Time::FromDeltaSinceWindowsEpoch(
base::Time::FromInternalValue(data.last_update_check_time()); base::TimeDelta::FromMicroseconds(data.last_update_check_time()));
out->resources_total_size_bytes = data.resources_total_size_bytes(); out->resources_total_size_bytes = data.resources_total_size_bytes();
if (data.has_origin_trial_tokens()) { if (data.has_origin_trial_tokens()) {
const ServiceWorkerOriginTrialInfo& info = data.origin_trial_tokens(); const ServiceWorkerOriginTrialInfo& info = data.origin_trial_tokens();
...@@ -1571,7 +1571,8 @@ void ServiceWorkerDatabase::WriteRegistrationDataInBatch( ...@@ -1571,7 +1571,8 @@ void ServiceWorkerDatabase::WriteRegistrationDataInBatch(
data.set_is_active(registration.is_active); data.set_is_active(registration.is_active);
data.set_has_fetch_handler(registration.has_fetch_handler); data.set_has_fetch_handler(registration.has_fetch_handler);
data.set_last_update_check_time( data.set_last_update_check_time(
registration.last_update_check.ToInternalValue()); registration.last_update_check.ToDeltaSinceWindowsEpoch()
.InMicroseconds());
data.set_script_response_time( data.set_script_response_time(
registration.script_response_time.ToDeltaSinceWindowsEpoch() registration.script_response_time.ToDeltaSinceWindowsEpoch()
.InMicroseconds()); .InMicroseconds());
......
...@@ -45,7 +45,7 @@ message ServiceWorkerRegistrationData { ...@@ -45,7 +45,7 @@ message ServiceWorkerRegistrationData {
required bool is_active = 5; required bool is_active = 5;
required bool has_fetch_handler = 6; required bool has_fetch_handler = 6;
// Serialized by Time::ToInternalValue(). // Serialized by Time::FromDeltaSinceWindowsEpoch().
required int64 last_update_check_time = 7; required int64 last_update_check_time = 7;
optional uint64 resources_total_size_bytes = 8; optional uint64 resources_total_size_bytes = 8;
......
...@@ -2203,7 +2203,8 @@ TEST(ServiceWorkerDatabaseTest, InvalidWebFeature) { ...@@ -2203,7 +2203,8 @@ TEST(ServiceWorkerDatabaseTest, InvalidWebFeature) {
data.set_version_id(1); data.set_version_id(1);
data.set_is_active(true); data.set_is_active(true);
data.set_has_fetch_handler(true); data.set_has_fetch_handler(true);
data.set_last_update_check_time(base::Time::Now().ToInternalValue()); data.set_last_update_check_time(
base::Time::Now().ToDeltaSinceWindowsEpoch().InMicroseconds());
data.add_used_features( data.add_used_features(
static_cast<uint32_t>(blink::mojom::WebFeature::kFetch)); static_cast<uint32_t>(blink::mojom::WebFeature::kFetch));
......
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