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 "modules/serviceworkers/ServiceWorkerContainerClient.h" | 5 #include "modules/serviceworkers/ServiceWorkerContainerClient.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/loader/FrameLoaderClient.h" | 10 #include "core/loader/FrameLoaderClient.h" |
11 #include "core/workers/WorkerGlobalScope.h" | 11 #include "core/workers/WorkerGlobalScope.h" |
12 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" | 12 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h" |
13 #include <memory> | |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
17 ServiceWorkerContainerClient* ServiceWorkerContainerClient::create(std::unique_p
tr<WebServiceWorkerProvider> provider) | 16 ServiceWorkerContainerClient* ServiceWorkerContainerClient::create(PassOwnPtr<We
bServiceWorkerProvider> provider) |
18 { | 17 { |
19 return new ServiceWorkerContainerClient(std::move(provider)); | 18 return new ServiceWorkerContainerClient(std::move(provider)); |
20 } | 19 } |
21 | 20 |
22 ServiceWorkerContainerClient::ServiceWorkerContainerClient(std::unique_ptr<WebSe
rviceWorkerProvider> provider) | 21 ServiceWorkerContainerClient::ServiceWorkerContainerClient(PassOwnPtr<WebService
WorkerProvider> provider) |
23 : m_provider(std::move(provider)) | 22 : m_provider(std::move(provider)) |
24 { | 23 { |
25 } | 24 } |
26 | 25 |
27 ServiceWorkerContainerClient::~ServiceWorkerContainerClient() | 26 ServiceWorkerContainerClient::~ServiceWorkerContainerClient() |
28 { | 27 { |
29 } | 28 } |
30 | 29 |
31 const char* ServiceWorkerContainerClient::supplementName() | 30 const char* ServiceWorkerContainerClient::supplementName() |
32 { | 31 { |
(...skipping 12 matching lines...) Expand all Loading... |
45 return nullptr; | 44 return nullptr; |
46 | 45 |
47 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContainerCli
ent*>(Supplement<Document>::from(document, supplementName())); | 46 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContainerCli
ent*>(Supplement<Document>::from(document, supplementName())); |
48 if (!client) { | 47 if (!client) { |
49 client = new ServiceWorkerContainerClient(document->frame()->loader().cl
ient()->createServiceWorkerProvider()); | 48 client = new ServiceWorkerContainerClient(document->frame()->loader().cl
ient()->createServiceWorkerProvider()); |
50 Supplement<Document>::provideTo(*document, supplementName(), client); | 49 Supplement<Document>::provideTo(*document, supplementName(), client); |
51 } | 50 } |
52 return client; | 51 return client; |
53 } | 52 } |
54 | 53 |
55 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, std::un
ique_ptr<WebServiceWorkerProvider> provider) | 54 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, PassOwn
Ptr<WebServiceWorkerProvider> provider) |
56 { | 55 { |
57 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S
erviceWorkerContainerClient::create(std::move(provider))); | 56 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S
erviceWorkerContainerClient::create(std::move(provider))); |
58 } | 57 } |
59 | 58 |
60 } // namespace blink | 59 } // namespace blink |
OLD | NEW |