OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/service_worker/service_worker_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 void AddNonWindowClient(ServiceWorkerProviderHost* host, | 371 void AddNonWindowClient(ServiceWorkerProviderHost* host, |
372 const ServiceWorkerClientQueryOptions& options, | 372 const ServiceWorkerClientQueryOptions& options, |
373 ServiceWorkerClients* clients) { | 373 ServiceWorkerClients* clients) { |
374 blink::WebServiceWorkerClientType host_client_type = host->client_type(); | 374 blink::WebServiceWorkerClientType host_client_type = host->client_type(); |
375 if (host_client_type == blink::WebServiceWorkerClientTypeWindow) | 375 if (host_client_type == blink::WebServiceWorkerClientTypeWindow) |
376 return; | 376 return; |
377 if (options.client_type != blink::WebServiceWorkerClientTypeAll && | 377 if (options.client_type != blink::WebServiceWorkerClientTypeAll && |
378 options.client_type != host_client_type) | 378 options.client_type != host_client_type) |
379 return; | 379 return; |
380 | 380 |
381 ServiceWorkerClientInfo client_info( | 381 ServiceWorkerClientInfo client_info(blink::WebPageVisibilityStateHidden, |
382 blink::WebPageVisibilityStateHidden, | 382 false, // is_focused |
383 false, // is_focused | 383 host->document_url(), |
384 host->document_url(), REQUEST_CONTEXT_FRAME_TYPE_NONE, host_client_type); | 384 REQUEST_CONTEXT_FRAME_TYPE_NONE, |
385 base::TimeTicks::Now(), host_client_type); | |
nhiroki
2015/08/13 05:56:31
Non-window clients seem to always overcome window
jeremyarcher
2015/08/14 05:22:05
Fixed.
| |
385 client_info.client_uuid = host->client_uuid(); | 386 client_info.client_uuid = host->client_uuid(); |
386 clients->push_back(client_info); | 387 clients->push_back(client_info); |
387 } | 388 } |
388 | 389 |
389 bool IsInstalled(ServiceWorkerVersion::Status status) { | 390 bool IsInstalled(ServiceWorkerVersion::Status status) { |
390 switch (status) { | 391 switch (status) { |
391 case ServiceWorkerVersion::NEW: | 392 case ServiceWorkerVersion::NEW: |
392 case ServiceWorkerVersion::INSTALLING: | 393 case ServiceWorkerVersion::INSTALLING: |
393 case ServiceWorkerVersion::REDUNDANT: | 394 case ServiceWorkerVersion::REDUNDANT: |
394 return false; | 395 return false; |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1290 | 1291 |
1291 void ServiceWorkerVersion::OnGetClientsFinished( | 1292 void ServiceWorkerVersion::OnGetClientsFinished( |
1292 int request_id, | 1293 int request_id, |
1293 const ServiceWorkerClients& clients) { | 1294 const ServiceWorkerClients& clients) { |
1294 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1295 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1295 TRACE_EVENT_ASYNC_END1("ServiceWorker", "ServiceWorkerVersion::OnGetClients", | 1296 TRACE_EVENT_ASYNC_END1("ServiceWorker", "ServiceWorkerVersion::OnGetClients", |
1296 request_id, "The number of clients", clients.size()); | 1297 request_id, "The number of clients", clients.size()); |
1297 | 1298 |
1298 if (running_status() != RUNNING) | 1299 if (running_status() != RUNNING) |
1299 return; | 1300 return; |
1301 std::sort(clients); | |
nhiroki
2015/08/13 05:56:31
Can you add comments about why we sort clients her
jeremyarcher
2015/08/14 05:22:05
Fixed.
| |
1300 embedded_worker_->SendMessage( | 1302 embedded_worker_->SendMessage( |
1301 ServiceWorkerMsg_DidGetClients(request_id, clients)); | 1303 ServiceWorkerMsg_DidGetClients(request_id, clients)); |
1302 } | 1304 } |
1303 | 1305 |
1304 void ServiceWorkerVersion::OnActivateEventFinished( | 1306 void ServiceWorkerVersion::OnActivateEventFinished( |
1305 int request_id, | 1307 int request_id, |
1306 blink::WebServiceWorkerEventResult result) { | 1308 blink::WebServiceWorkerEventResult result) { |
1307 DCHECK(ACTIVATING == status() || | 1309 DCHECK(ACTIVATING == status() || |
1308 REDUNDANT == status()) << status(); | 1310 REDUNDANT == status()) << status(); |
1309 TRACE_EVENT0("ServiceWorker", | 1311 TRACE_EVENT0("ServiceWorker", |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2298 base::string16()); | 2300 base::string16()); |
2299 service_port_dispatcher_.reset(); | 2301 service_port_dispatcher_.reset(); |
2300 } | 2302 } |
2301 | 2303 |
2302 void ServiceWorkerVersion::OnBackgroundSyncDispatcherConnectionError() { | 2304 void ServiceWorkerVersion::OnBackgroundSyncDispatcherConnectionError() { |
2303 RunIDMapCallbacks(&sync_requests_, SERVICE_WORKER_ERROR_FAILED); | 2305 RunIDMapCallbacks(&sync_requests_, SERVICE_WORKER_ERROR_FAILED); |
2304 background_sync_dispatcher_.reset(); | 2306 background_sync_dispatcher_.reset(); |
2305 } | 2307 } |
2306 | 2308 |
2307 } // namespace content | 2309 } // namespace content |
OLD | NEW |