OLD | NEW |
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/browser/geofencing/geofencing_manager.h" | 5 #include "content/browser/geofencing/geofencing_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "content/browser/geofencing/geofencing_service.h" | 10 #include "content/browser/geofencing/geofencing_service.h" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 } | 388 } |
389 | 389 |
390 ServiceWorkerVersion* active_version = | 390 ServiceWorkerVersion* active_version = |
391 service_worker_registration->active_version(); | 391 service_worker_registration->active_version(); |
392 DCHECK(active_version); | 392 DCHECK(active_version); |
393 | 393 |
394 // Hold on to the service worker registration in the callback to keep it alive | 394 // Hold on to the service worker registration in the callback to keep it alive |
395 // until the callback dies. Otherwise the registration could be released when | 395 // until the callback dies. Otherwise the registration could be released when |
396 // this method returns - before the event is delivered to the service worker. | 396 // this method returns - before the event is delivered to the service worker. |
397 active_version->RunAfterStartWorker( | 397 active_version->RunAfterStartWorker( |
| 398 ServiceWorkerMetrics::EventType::GEOFENCING, |
398 base::Bind(&GeofencingManager::DeliverEventToRunningWorker, this, | 399 base::Bind(&GeofencingManager::DeliverEventToRunningWorker, this, |
399 service_worker_registration, event_type, | 400 service_worker_registration, event_type, |
400 registration->region_id, registration->region, | 401 registration->region_id, registration->region, |
401 make_scoped_refptr(active_version)), | 402 make_scoped_refptr(active_version)), |
402 base::Bind(&GeofencingManager::OnEventError, this)); | 403 base::Bind(&GeofencingManager::OnEventError, this)); |
403 } | 404 } |
404 | 405 |
405 void GeofencingManager::DeliverEventToRunningWorker( | 406 void GeofencingManager::DeliverEventToRunningWorker( |
406 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, | 407 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, |
407 blink::WebGeofencingEventType event_type, | 408 blink::WebGeofencingEventType event_type, |
(...skipping 24 matching lines...) Expand all Loading... |
432 // TODO(mek): log/check result. | 433 // TODO(mek): log/check result. |
433 } | 434 } |
434 | 435 |
435 void GeofencingManager::OnEventError( | 436 void GeofencingManager::OnEventError( |
436 ServiceWorkerStatusCode service_worker_status) { | 437 ServiceWorkerStatusCode service_worker_status) { |
437 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 438 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
438 // TODO(mek): log/check errors. | 439 // TODO(mek): log/check errors. |
439 } | 440 } |
440 | 441 |
441 } // namespace content | 442 } // namespace content |
OLD | NEW |