OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/background_fetch/background_fetch_event_dispatcher.h" | 5 #include "content/browser/background_fetch/background_fetch_event_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/metrics/histogram_functions.h" | 9 #include "base/metrics/histogram_functions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 base::UmaHistogramEnumeration(histogram_name, service_worker_status, | 60 base::UmaHistogramEnumeration(histogram_name, service_worker_status, |
61 SERVICE_WORKER_ERROR_MAX_VALUE); | 61 SERVICE_WORKER_ERROR_MAX_VALUE); |
62 } | 62 } |
63 | 63 |
64 } // namespace | 64 } // namespace |
65 | 65 |
66 BackgroundFetchEventDispatcher::BackgroundFetchEventDispatcher( | 66 BackgroundFetchEventDispatcher::BackgroundFetchEventDispatcher( |
67 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) | 67 const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context) |
68 : service_worker_context_(service_worker_context) {} | 68 : service_worker_context_(service_worker_context) {} |
69 | 69 |
70 BackgroundFetchEventDispatcher::~BackgroundFetchEventDispatcher() = default; | 70 BackgroundFetchEventDispatcher::~BackgroundFetchEventDispatcher() { |
71 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
Peter Beverloo
2017/07/10 13:13:21
Please add a DCHECK_CURRENTLY_ON to the constructo
johnme
2017/07/10 13:41:07
Done here; the header already says "Must only be u
| |
72 } | |
71 | 73 |
72 void BackgroundFetchEventDispatcher::DispatchBackgroundFetchAbortEvent( | 74 void BackgroundFetchEventDispatcher::DispatchBackgroundFetchAbortEvent( |
73 const BackgroundFetchRegistrationId& registration_id, | 75 const BackgroundFetchRegistrationId& registration_id, |
74 base::Closure finished_closure) { | 76 base::Closure finished_closure) { |
75 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 77 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
76 LoadServiceWorkerRegistrationForDispatch( | 78 LoadServiceWorkerRegistrationForDispatch( |
77 registration_id, ServiceWorkerMetrics::EventType::BACKGROUND_FETCH_ABORT, | 79 registration_id, ServiceWorkerMetrics::EventType::BACKGROUND_FETCH_ABORT, |
78 std::move(finished_closure), | 80 std::move(finished_closure), |
79 base::Bind( | 81 base::Bind( |
80 &BackgroundFetchEventDispatcher::DoDispatchBackgroundFetchAbortEvent, | 82 &BackgroundFetchEventDispatcher::DoDispatchBackgroundFetchAbortEvent, |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 } else { | 236 } else { |
235 RecordDispatchResult(event, DISPATCH_RESULT_SUCCESS); | 237 RecordDispatchResult(event, DISPATCH_RESULT_SUCCESS); |
236 } | 238 } |
237 break; | 239 break; |
238 } | 240 } |
239 | 241 |
240 finished_closure.Run(); | 242 finished_closure.Run(); |
241 } | 243 } |
242 | 244 |
243 } // namespace content | 245 } // namespace content |
OLD | NEW |