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

Unified Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 893783002: Revert of Gather the ServiceWorker client information in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rfh_getvisibilitystate
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/child/service_worker/service_worker_dispatcher.cc
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index 531fd4b0f8249d02a442f2e10425892727c8232d..fce8783f92a32de78ef49bb677e70adc834b9bd4 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -84,6 +84,8 @@
OnSetControllerServiceWorker)
IPC_MESSAGE_HANDLER(ServiceWorkerMsg_MessageToDocument,
OnPostMessage)
+ IPC_MESSAGE_HANDLER(ServiceWorkerMsg_GetClientInfo,
+ OnGetClientInfo)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
DCHECK(handled) << "Unhandled message:" << msg.type();
@@ -661,6 +663,30 @@
found->second->dispatchMessageEvent(message, ports);
}
+void ServiceWorkerDispatcher::OnGetClientInfo(int thread_id,
+ int embedded_worker_id,
+ int request_id,
+ int provider_id) {
+ blink::WebServiceWorkerClientInfo info;
+ ProviderClientMap::iterator found = provider_clients_.find(provider_id);
+ // TODO(ksakamoto): Could we track these values in the browser side? Except
+ // for |isFocused|, it would be pretty easy.
+ if (found != provider_clients_.end() && found->second->getClientInfo(&info)) {
+ ServiceWorkerClientInfo result;
+ result.client_id = info.clientID;
+ result.page_visibility_state = info.pageVisibilityState;
+ result.is_focused = info.isFocused;
+ result.url = info.url;
+ result.frame_type = static_cast<RequestContextFrameType>(info.frameType);
+
+ thread_safe_sender_->Send(new ServiceWorkerHostMsg_GetClientInfoSuccess(
+ embedded_worker_id, request_id, result));
+ } else {
+ thread_safe_sender_->Send(new ServiceWorkerHostMsg_GetClientInfoError(
+ embedded_worker_id, request_id));
+ }
+}
+
void ServiceWorkerDispatcher::AddServiceWorker(
int handle_id, WebServiceWorkerImpl* worker) {
DCHECK(!ContainsKey(service_workers_, handle_id));
« no previous file with comments | « content/child/service_worker/service_worker_dispatcher.h ('k') | content/common/service_worker/service_worker_client_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698