Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: content/common/service_worker/service_worker_event_dispatcher.mojom

Issue 2703343002: ServiceWorker: Use mojo's data pipe for respondWith(stream) (Closed)
Patch Set: Addressed comments from kinuko and haraken Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 module content.mojom; 5 module content.mojom;
6 6
7 import "components/payments/mojom/payment_app.mojom"; 7 import "components/payments/mojom/payment_app.mojom";
8 import "content/common/url_loader.mojom"; 8 import "content/common/url_loader.mojom";
9 import "mojo/common/string16.mojom"; 9 import "mojo/common/string16.mojom";
10 import "mojo/common/time.mojom"; 10 import "mojo/common/time.mojom";
11 import "third_party/WebKit/public/platform/modules/background_sync/background_sy nc.mojom"; 11 import "third_party/WebKit/public/platform/modules/background_sync/background_sy nc.mojom";
12 import "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom "; 12 import "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom ";
13 import "third_party/WebKit/public/platform/modules/serviceworker/service_worker_ event_status.mojom"; 13 import "third_party/WebKit/public/platform/modules/serviceworker/service_worker_ event_status.mojom";
14 import "third_party/WebKit/public/platform/modules/serviceworker/service_worker_ stream_handle.mojom";
14 import "url/mojo/origin.mojom"; 15 import "url/mojo/origin.mojom";
15 16
16 [Native] 17 [Native]
17 struct PlatformNotificationData; 18 struct PlatformNotificationData;
18 19
19 [Native] 20 [Native]
20 struct PushEventPayload; 21 struct PushEventPayload;
21 22
22 [Native] 23 [Native]
23 struct ServiceWorkerResponse; 24 struct ServiceWorkerResponse;
(...skipping 19 matching lines...) Expand all
43 URLLoaderClient& url_loader_client_request; 44 URLLoaderClient& url_loader_client_request;
44 }; 45 };
45 46
46 struct ExtendableMessageEvent { 47 struct ExtendableMessageEvent {
47 mojo.common.mojom.String16 message; 48 mojo.common.mojom.String16 message;
48 url.mojom.Origin source_origin; 49 url.mojom.Origin source_origin;
49 array<handle<message_pipe>> message_ports; 50 array<handle<message_pipe>> message_ports;
50 ExtendableMessageEventSource source; 51 ExtendableMessageEventSource source;
51 }; 52 };
52 53
54 // Browser-side interface which is passed through DispatchFetchEvent. The
55 // renderer uses this interface to respond to a fetch event. This interface is
56 // only used for responses where the body is a stream or doesn't exist. When the
57 // body is a blob, the legacy IPC (ServiceWorkerHostMsg_FetchEventResponse) is
58 // used.
59 // TODO(shimazu): Use this interface for all responses after the blob system is
60 // mojoified: https://crbug.com/611935.
61 interface ServiceWorkerFetchResponseCallback {
62 // Responds to the request with |response|. The body is empty.
63 OnResponse(ServiceWorkerResponse response,
64 mojo.common.mojom.Time dispatch_event_time);
65 // Responds to the request with |response|. The body is returned as a stream.
66 OnResponseStream(ServiceWorkerResponse response,
67 blink.mojom.ServiceWorkerStreamHandle body_as_stream,
68 mojo.common.mojom.Time dispatch_event_time);
69 // Provides no response to the request. The browser will fall back to the
70 // network.
71 OnFallback(mojo.common.mojom.Time dispatch_event_time);
72 };
73
53 // Renderer-side interface bound to ServiceWorkerContextClient for dispatching 74 // Renderer-side interface bound to ServiceWorkerContextClient for dispatching
54 // events. 75 // events.
55 // Those events expecting such response 76 // Those events expecting such response
56 // (blink.mojom.ServiceWorkerEventStatus, mojo.common.mojom.Time) are considered 77 // (blink.mojom.ServiceWorkerEventStatus, mojo.common.mojom.Time) are considered
57 // 'simple events'. ServiceWorkerVersion::CreateSimpleEventCallback can be used 78 // 'simple events'. ServiceWorkerVersion::CreateSimpleEventCallback can be used
58 // to create the callback for these. 79 // to create the callback for these.
59 interface ServiceWorkerEventDispatcher { 80 interface ServiceWorkerEventDispatcher {
60 DispatchActivateEvent() 81 DispatchActivateEvent()
61 => (blink.mojom.ServiceWorkerEventStatus status, 82 => (blink.mojom.ServiceWorkerEventStatus status,
62 mojo.common.mojom.Time dispatch_event_time); 83 mojo.common.mojom.Time dispatch_event_time);
63 DispatchBackgroundFetchAbortEvent(string tag) 84 DispatchBackgroundFetchAbortEvent(string tag)
64 => (blink.mojom.ServiceWorkerEventStatus status, 85 => (blink.mojom.ServiceWorkerEventStatus status,
65 mojo.common.mojom.Time dispatch_event_time); 86 mojo.common.mojom.Time dispatch_event_time);
66 DispatchBackgroundFetchClickEvent(string tag, BackgroundFetchState state) 87 DispatchBackgroundFetchClickEvent(string tag, BackgroundFetchState state)
67 => (blink.mojom.ServiceWorkerEventStatus status, 88 => (blink.mojom.ServiceWorkerEventStatus status,
68 mojo.common.mojom.Time dispatch_event_time); 89 mojo.common.mojom.Time dispatch_event_time);
69 DispatchBackgroundFetchFailEvent(string tag, 90 DispatchBackgroundFetchFailEvent(string tag,
70 array<BackgroundFetchSettledFetch> fetches) 91 array<BackgroundFetchSettledFetch> fetches)
71 => (blink.mojom.ServiceWorkerEventStatus status, 92 => (blink.mojom.ServiceWorkerEventStatus status,
72 mojo.common.mojom.Time dispatch_event_time); 93 mojo.common.mojom.Time dispatch_event_time);
73 DispatchBackgroundFetchedEvent(string tag, 94 DispatchBackgroundFetchedEvent(string tag,
74 array<BackgroundFetchSettledFetch> fetches) 95 array<BackgroundFetchSettledFetch> fetches)
75 => (blink.mojom.ServiceWorkerEventStatus status, 96 => (blink.mojom.ServiceWorkerEventStatus status,
76 mojo.common.mojom.Time dispatch_event_time); 97 mojo.common.mojom.Time dispatch_event_time);
77 // |fetch_event_id| is used internally when sending the response back to the 98 // The callback is called once the event finishes, which means the event
78 // browser process. 99 // handler ran and all outstanding respondWith() and waitUntil() promises have
100 // settled. |response_callback| is called once the promise to respondWith()
101 // settles, or when the event handler ran without calling respondWith().
102 // |fetch_event_id| is used internally when sending the response with a blob
103 // body back to the browser process. In that case, |response_callback| won't
104 // be called.
79 DispatchFetchEvent(int32 fetch_event_id, blink.mojom.FetchAPIRequest request, 105 DispatchFetchEvent(int32 fetch_event_id, blink.mojom.FetchAPIRequest request,
80 FetchEventPreloadHandle? preload_handle) 106 FetchEventPreloadHandle? preload_handle,
107 ServiceWorkerFetchResponseCallback response_callback)
81 => (blink.mojom.ServiceWorkerEventStatus status, 108 => (blink.mojom.ServiceWorkerEventStatus status,
82 mojo.common.mojom.Time dispatch_event_time); 109 mojo.common.mojom.Time dispatch_event_time);
83 DispatchNotificationClickEvent(string notification_id, 110 DispatchNotificationClickEvent(string notification_id,
84 PlatformNotificationData notification_data, 111 PlatformNotificationData notification_data,
85 int32 action_index, 112 int32 action_index,
86 mojo.common.mojom.String16? reply) 113 mojo.common.mojom.String16? reply)
87 => (blink.mojom.ServiceWorkerEventStatus status, 114 => (blink.mojom.ServiceWorkerEventStatus status,
88 mojo.common.mojom.Time dispatch_event_time); 115 mojo.common.mojom.Time dispatch_event_time);
89 DispatchNotificationCloseEvent(string notification_id, 116 DispatchNotificationCloseEvent(string notification_id,
90 PlatformNotificationData notification_data) 117 PlatformNotificationData notification_data)
(...skipping 16 matching lines...) Expand all
107 DispatchExtendableMessageEvent(ExtendableMessageEvent event) 134 DispatchExtendableMessageEvent(ExtendableMessageEvent event)
108 => (blink.mojom.ServiceWorkerEventStatus status, 135 => (blink.mojom.ServiceWorkerEventStatus status,
109 mojo.common.mojom.Time dispatch_event_time); 136 mojo.common.mojom.Time dispatch_event_time);
110 137
111 // Pings the service worker to check if it is responsive. If the callback is 138 // Pings the service worker to check if it is responsive. If the callback is
112 // not called within a certain period of time, the browser will terminate the 139 // not called within a certain period of time, the browser will terminate the
113 // worker. Unlike the other functions in this interface, Ping() does not 140 // worker. Unlike the other functions in this interface, Ping() does not
114 // dispatch an event. 141 // dispatch an event.
115 Ping() => (); 142 Ping() => ();
116 }; 143 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698