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/child/service_worker/web_service_worker_impl.h" | 5 #include "content/child/service_worker/web_service_worker_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "content/child/service_worker/service_worker_dispatcher.h" | 11 #include "content/child/service_worker/service_worker_dispatcher.h" |
11 #include "content/child/service_worker/service_worker_handle_reference.h" | 12 #include "content/child/service_worker/service_worker_handle_reference.h" |
12 #include "content/child/service_worker/web_service_worker_provider_impl.h" | 13 #include "content/child/service_worker/web_service_worker_provider_impl.h" |
13 #include "content/child/thread_safe_sender.h" | 14 #include "content/child/thread_safe_sender.h" |
14 #include "content/child/webmessageportchannel_impl.h" | 15 #include "content/child/webmessageportchannel_impl.h" |
15 #include "content/common/service_worker/service_worker_messages.h" | 16 #include "content/common/service_worker/service_worker_messages.h" |
16 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" | 17 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" |
17 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
18 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerProxy.h" | 19 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerProxy.h" |
19 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 20 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 url::Origin(source_origin), | 132 url::Origin(source_origin), |
132 base::Passed(make_scoped_ptr(channels)))); | 133 base::Passed(make_scoped_ptr(channels)))); |
133 } | 134 } |
134 | 135 |
135 void WebServiceWorkerImpl::terminate() { | 136 void WebServiceWorkerImpl::terminate() { |
136 thread_safe_sender_->Send( | 137 thread_safe_sender_->Send( |
137 new ServiceWorkerHostMsg_TerminateWorker(handle_ref_->handle_id())); | 138 new ServiceWorkerHostMsg_TerminateWorker(handle_ref_->handle_id())); |
138 } | 139 } |
139 | 140 |
140 // static | 141 // static |
141 blink::WebPassOwnPtr<blink::WebServiceWorker::Handle> | 142 std::unique_ptr<blink::WebServiceWorker::Handle> |
142 WebServiceWorkerImpl::CreateHandle( | 143 WebServiceWorkerImpl::CreateHandle( |
143 const scoped_refptr<WebServiceWorkerImpl>& worker) { | 144 const scoped_refptr<WebServiceWorkerImpl>& worker) { |
144 if (!worker) | 145 if (!worker) |
145 return nullptr; | 146 return nullptr; |
146 return blink::adoptWebPtr(new HandleImpl(worker)); | 147 return base::WrapUnique(new HandleImpl(worker)); |
147 } | 148 } |
148 | 149 |
149 WebServiceWorkerImpl::~WebServiceWorkerImpl() { | 150 WebServiceWorkerImpl::~WebServiceWorkerImpl() { |
150 ServiceWorkerDispatcher* dispatcher = | 151 ServiceWorkerDispatcher* dispatcher = |
151 ServiceWorkerDispatcher::GetThreadSpecificInstance(); | 152 ServiceWorkerDispatcher::GetThreadSpecificInstance(); |
152 if (dispatcher) | 153 if (dispatcher) |
153 dispatcher->RemoveServiceWorker(handle_ref_->handle_id()); | 154 dispatcher->RemoveServiceWorker(handle_ref_->handle_id()); |
154 } | 155 } |
155 | 156 |
156 } // namespace content | 157 } // namespace content |
OLD | NEW |