| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_context_client.h" | 5 #include "content/renderer/service_worker/service_worker_context_client.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.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 "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 UMA_HISTOGRAM_MEDIUM_TIMES( | 511 UMA_HISTOGRAM_MEDIUM_TIMES( |
| 512 "ServiceWorker.PushEvent.Time", | 512 "ServiceWorker.PushEvent.Time", |
| 513 base::TimeTicks::Now() - push_start_timings_[request_id]); | 513 base::TimeTicks::Now() - push_start_timings_[request_id]); |
| 514 } | 514 } |
| 515 push_start_timings_.erase(request_id); | 515 push_start_timings_.erase(request_id); |
| 516 | 516 |
| 517 Send(new ServiceWorkerHostMsg_PushEventFinished( | 517 Send(new ServiceWorkerHostMsg_PushEventFinished( |
| 518 GetRoutingID(), request_id, result)); | 518 GetRoutingID(), request_id, result)); |
| 519 } | 519 } |
| 520 | 520 |
| 521 // TODO(chasej): crbug.com/486890 - Remove when matching blink changes land | |
| 522 void ServiceWorkerContextClient::didHandleSyncEvent(int request_id) { | |
| 523 didHandleSyncEvent(request_id, blink::WebServiceWorkerEventResultCompleted); | |
| 524 } | |
| 525 | |
| 526 void ServiceWorkerContextClient::didHandleSyncEvent( | 521 void ServiceWorkerContextClient::didHandleSyncEvent( |
| 527 int request_id, | 522 int request_id, |
| 528 blink::WebServiceWorkerEventResult result) { | 523 blink::WebServiceWorkerEventResult result) { |
| 529 Send(new ServiceWorkerHostMsg_SyncEventFinished(GetRoutingID(), request_id, | 524 Send(new ServiceWorkerHostMsg_SyncEventFinished(GetRoutingID(), request_id, |
| 530 result)); | 525 result)); |
| 531 } | 526 } |
| 532 | 527 |
| 533 void ServiceWorkerContextClient::didHandleCrossOriginConnectEvent( | 528 void ServiceWorkerContextClient::didHandleCrossOriginConnectEvent( |
| 534 int request_id, | 529 int request_id, |
| 535 bool accept_connection) { | 530 bool accept_connection) { |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 } | 971 } |
| 977 | 972 |
| 978 base::WeakPtr<ServiceWorkerContextClient> | 973 base::WeakPtr<ServiceWorkerContextClient> |
| 979 ServiceWorkerContextClient::GetWeakPtr() { | 974 ServiceWorkerContextClient::GetWeakPtr() { |
| 980 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); | 975 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); |
| 981 DCHECK(context_); | 976 DCHECK(context_); |
| 982 return context_->weak_factory.GetWeakPtr(); | 977 return context_->weak_factory.GetWeakPtr(); |
| 983 } | 978 } |
| 984 | 979 |
| 985 } // namespace content | 980 } // namespace content |
| OLD | NEW |