Commit f3310340 authored by horo's avatar horo Committed by Commit bot

Use mojo.common.mojom.Time for dispatch_event_time in background_sync.mojom

BUG=561209

Review-Url: https://codereview.chromium.org/2274283003
Cr-Commit-Position: refs/heads/master@{#418467}
parent b9c29dbb
......@@ -151,11 +151,11 @@ void OnSyncEventFinished(scoped_refptr<ServiceWorkerVersion> active_version,
int request_id,
const ServiceWorkerVersion::StatusCallback& callback,
blink::mojom::ServiceWorkerEventStatus status,
double dispatch_event_time) {
base::Time dispatch_event_time) {
if (!active_version->FinishRequest(
request_id,
status == blink::mojom::ServiceWorkerEventStatus::COMPLETED,
base::Time::FromDoubleT(dispatch_event_time))) {
dispatch_event_time)) {
return;
}
callback.Run(mojo::ConvertTo<ServiceWorkerStatusCode>(status));
......
......@@ -40,7 +40,7 @@ void BackgroundSyncClientImpl::Sync(
ServiceWorkerContextClient::ThreadSpecificInstance();
if (!client) {
callback.Run(blink::mojom::ServiceWorkerEventStatus::ABORTED,
base::Time::Now().ToDoubleT());
base::Time::Now());
return;
}
......
......@@ -178,7 +178,7 @@ struct ServiceWorkerContextClient::WorkerContextData {
IDMap<blink::WebServiceWorkerSkipWaitingCallbacks, IDMapOwnPointer>;
using SyncEventCallbacksMap =
IDMap<const base::Callback<void(blink::mojom::ServiceWorkerEventStatus,
double /* dispatch_event_time */)>,
base::Time /* dispatch_event_time */)>,
IDMapOwnPointer>;
explicit WorkerContextData(ServiceWorkerContextClient* owner)
......@@ -594,10 +594,10 @@ void ServiceWorkerContextClient::didHandleSyncEvent(
return;
if (result == blink::WebServiceWorkerEventResultCompleted) {
callback->Run(blink::mojom::ServiceWorkerEventStatus::COMPLETED,
event_dispatch_time);
base::Time::FromDoubleT(event_dispatch_time));
} else {
callback->Run(blink::mojom::ServiceWorkerEventStatus::REJECTED,
event_dispatch_time);
base::Time::FromDoubleT(event_dispatch_time));
}
context_->sync_event_callbacks.Remove(request_id);
}
......
......@@ -66,7 +66,7 @@ class ServiceWorkerContextClient
public:
using SyncCallback =
base::Callback<void(blink::mojom::ServiceWorkerEventStatus,
double /* dispatch_event_time */)>;
base::Time /* dispatch_event_time */)>;
// Returns a thread-specific client instance. This does NOT create a
// new instance.
......
......@@ -658,6 +658,7 @@ mojom("mojo_bindings") {
":android_mojo_bindings",
":new_wrapper_types_mojo_bindings",
"//device/bluetooth/public/interfaces:bluetooth_mojom_bluetooth_uuid",
"//mojo/common:common_custom_types",
"//url/mojo:url_mojom_origin",
]
......
......@@ -4,6 +4,7 @@
module blink.mojom;
import "mojo/common/common_custom_types.mojom";
import "third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom";
enum BackgroundSyncNetworkState {
......@@ -48,8 +49,7 @@ interface BackgroundSyncService {
};
interface BackgroundSyncServiceClient {
// TODO(horo): Use mojo.common.mojom.Time for |dispatch_event_time|. It is
// using double as the UTC time in seconds, counted from January 1, 1970.
Sync(string tag, BackgroundSyncEventLastChance last_chance)
=> (ServiceWorkerEventStatus status, double dispatch_event_time);
=> (ServiceWorkerEventStatus status,
mojo.common.mojom.Time dispatch_event_time);
};
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