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

Side by Side Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 871013003: Gather the ServiceWorker client information in the browser process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rfh_getvisibilitystate
Patch Set: rebase Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/renderer/service_worker/service_worker_script_context.h" 5 #include "content/renderer/service_worker/service_worker_script_context.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "content/child/notifications/notification_data_conversions.h" 10 #include "content/child/notifications/notification_data_conversions.h"
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 blink::WebServiceWorkerClientsCallbacks* callbacks = 411 blink::WebServiceWorkerClientsCallbacks* callbacks =
412 pending_clients_callbacks_.Lookup(request_id); 412 pending_clients_callbacks_.Lookup(request_id);
413 if (!callbacks) { 413 if (!callbacks) {
414 NOTREACHED() << "Got stray response: " << request_id; 414 NOTREACHED() << "Got stray response: " << request_id;
415 return; 415 return;
416 } 416 }
417 scoped_ptr<blink::WebServiceWorkerClientsInfo> info( 417 scoped_ptr<blink::WebServiceWorkerClientsInfo> info(
418 new blink::WebServiceWorkerClientsInfo); 418 new blink::WebServiceWorkerClientsInfo);
419 blink::WebVector<blink::WebServiceWorkerClientInfo> convertedClients( 419 blink::WebVector<blink::WebServiceWorkerClientInfo> convertedClients(
420 clients.size()); 420 clients.size());
421 for (size_t i = 0; i < clients.size(); ++i) { 421 for (size_t i = 0; i < clients.size(); ++i)
422 convertedClients[i].clientID = clients[i].client_id; 422 convertedClients[i] = clients[i];
423 convertedClients[i].pageVisibilityState = clients[i].page_visibility_state;
424 convertedClients[i].isFocused = clients[i].is_focused;
425 convertedClients[i].url = clients[i].url;
426 convertedClients[i].frameType =
427 static_cast<blink::WebURLRequest::FrameType>(clients[i].frame_type);
428 }
429 info->clients.swap(convertedClients); 423 info->clients.swap(convertedClients);
430 callbacks->onSuccess(info.release()); 424 callbacks->onSuccess(info.release());
431 pending_clients_callbacks_.Remove(request_id); 425 pending_clients_callbacks_.Remove(request_id);
432 } 426 }
433 427
434 void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id, 428 void ServiceWorkerScriptContext::OnFocusClientResponse(int request_id,
435 bool result) { 429 bool result) {
436 TRACE_EVENT0("ServiceWorker", 430 TRACE_EVENT0("ServiceWorker",
437 "ServiceWorkerScriptContext::OnFocusClientResponse"); 431 "ServiceWorkerScriptContext::OnFocusClientResponse");
438 blink::WebServiceWorkerClientFocusCallback* callback = 432 blink::WebServiceWorkerClientFocusCallback* callback =
(...skipping 13 matching lines...) Expand all
452 pending_skip_waiting_callbacks_.Lookup(request_id); 446 pending_skip_waiting_callbacks_.Lookup(request_id);
453 if (!callbacks) { 447 if (!callbacks) {
454 NOTREACHED() << "Got stray response: " << request_id; 448 NOTREACHED() << "Got stray response: " << request_id;
455 return; 449 return;
456 } 450 }
457 callbacks->onSuccess(); 451 callbacks->onSuccess();
458 pending_skip_waiting_callbacks_.Remove(request_id); 452 pending_skip_waiting_callbacks_.Remove(request_id);
459 } 453 }
460 454
461 } // namespace content 455 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698