| 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/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" |
| 11 #include "content/child/service_worker/web_service_worker_registration_impl.h" |
| 11 #include "content/child/thread_safe_sender.h" | 12 #include "content/child/thread_safe_sender.h" |
| 12 #include "content/child/webmessageportchannel_impl.h" | 13 #include "content/child/webmessageportchannel_impl.h" |
| 13 #include "content/common/message_port_messages.h" | 14 #include "content/common/message_port_messages.h" |
| 14 #include "content/common/service_worker/service_worker_messages.h" | 15 #include "content/common/service_worker/service_worker_messages.h" |
| 15 #include "content/renderer/service_worker/embedded_worker_context_client.h" | 16 #include "content/renderer/service_worker/embedded_worker_context_client.h" |
| 16 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
| 17 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" | 18 #include "third_party/WebKit/public/platform/WebCrossOriginServiceWorkerClient.h
" |
| 18 #include "third_party/WebKit/public/platform/WebNotificationData.h" | 19 #include "third_party/WebKit/public/platform/WebNotificationData.h" |
| 19 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 20 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 20 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" | 21 #include "third_party/WebKit/public/platform/WebServiceWorkerRequest.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 IPC_END_MESSAGE_MAP() | 109 IPC_END_MESSAGE_MAP() |
| 109 | 110 |
| 110 // TODO(gavinp): Would it be preferable to put an AddListener() method to | 111 // TODO(gavinp): Would it be preferable to put an AddListener() method to |
| 111 // EmbeddedWorkerContextClient? | 112 // EmbeddedWorkerContextClient? |
| 112 if (!handled) | 113 if (!handled) |
| 113 handled = cache_storage_dispatcher_->OnMessageReceived(message); | 114 handled = cache_storage_dispatcher_->OnMessageReceived(message); |
| 114 | 115 |
| 115 DCHECK(handled); | 116 DCHECK(handled); |
| 116 } | 117 } |
| 117 | 118 |
| 119 void ServiceWorkerScriptContext::SetRegistrationInServiceWorkerGlobalScope( |
| 120 scoped_ptr<WebServiceWorkerRegistrationImpl> registration) { |
| 121 proxy_->setRegistration(registration.release()); |
| 122 } |
| 123 |
| 118 void ServiceWorkerScriptContext::DidHandleActivateEvent( | 124 void ServiceWorkerScriptContext::DidHandleActivateEvent( |
| 119 int request_id, | 125 int request_id, |
| 120 blink::WebServiceWorkerEventResult result) { | 126 blink::WebServiceWorkerEventResult result) { |
| 121 UMA_HISTOGRAM_TIMES( | 127 UMA_HISTOGRAM_TIMES( |
| 122 "ServiceWorker.ActivateEventExecutionTime", | 128 "ServiceWorker.ActivateEventExecutionTime", |
| 123 base::TimeTicks::Now() - activate_start_timings_[request_id]); | 129 base::TimeTicks::Now() - activate_start_timings_[request_id]); |
| 124 activate_start_timings_.erase(request_id); | 130 activate_start_timings_.erase(request_id); |
| 125 | 131 |
| 126 Send(new ServiceWorkerHostMsg_ActivateEventFinished( | 132 Send(new ServiceWorkerHostMsg_ActivateEventFinished( |
| 127 GetRoutingID(), request_id, result)); | 133 GetRoutingID(), request_id, result)); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 pending_skip_waiting_callbacks_.Lookup(request_id); | 452 pending_skip_waiting_callbacks_.Lookup(request_id); |
| 447 if (!callbacks) { | 453 if (!callbacks) { |
| 448 NOTREACHED() << "Got stray response: " << request_id; | 454 NOTREACHED() << "Got stray response: " << request_id; |
| 449 return; | 455 return; |
| 450 } | 456 } |
| 451 callbacks->onSuccess(); | 457 callbacks->onSuccess(); |
| 452 pending_skip_waiting_callbacks_.Remove(request_id); | 458 pending_skip_waiting_callbacks_.Remove(request_id); |
| 453 } | 459 } |
| 454 | 460 |
| 455 } // namespace content | 461 } // namespace content |
| OLD | NEW |