Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerContainerClient.cpp

Issue 1164753004: Tidy up CompositorWorkerManager unit tests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: compile fix Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "ServiceWorkerContainerClient.h" 6 #include "ServiceWorkerContainerClient.h"
7 7
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 26 matching lines...) Expand all
37 37
38 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContaine rClient*>(WillBeHeapSupplement<Document>::from(document, supplementName())); 38 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContaine rClient*>(WillBeHeapSupplement<Document>::from(document, supplementName()));
39 if (client) 39 if (client)
40 return client; 40 return client;
41 41
42 // If it's not provided yet, create it lazily. 42 // If it's not provided yet, create it lazily.
43 document->WillBeHeapSupplementable<Document>::provideSupplement(ServiceW orkerContainerClient::supplementName(), ServiceWorkerContainerClient::create(doc ument->frame()->loader().client()->createServiceWorkerProvider())); 43 document->WillBeHeapSupplementable<Document>::provideSupplement(ServiceW orkerContainerClient::supplementName(), ServiceWorkerContainerClient::create(doc ument->frame()->loader().client()->createServiceWorkerProvider()));
44 return static_cast<ServiceWorkerContainerClient*>(WillBeHeapSupplement<D ocument>::from(document, supplementName())); 44 return static_cast<ServiceWorkerContainerClient*>(WillBeHeapSupplement<D ocument>::from(document, supplementName()));
45 } 45 }
46 46
47 if (context->isServiceWorkerGlobalScope()) {
48 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContaine rClient*>(WillBeHeapSupplement<WorkerClients>::from(toWorkerGlobalScope(context) ->clients(), supplementName()));
49 ASSERT(client);
50 return client;
51 }
52
53 ASSERT(context->isWorkerGlobalScope()); 47 ASSERT(context->isWorkerGlobalScope());
54 return static_cast<ServiceWorkerContainerClient*>(WillBeHeapSupplement<Worke rClients>::from(toWorkerGlobalScope(context)->clients(), supplementName())); 48 WorkerClients* clients = toWorkerGlobalScope(context)->clients();
49 ASSERT(clients);
50 return static_cast<ServiceWorkerContainerClient*>(WillBeHeapSupplement<Worke rClients>::from(clients, supplementName()));
55 } 51 }
56 52
57 ServiceWorkerContainerClient::ServiceWorkerContainerClient(PassOwnPtr<WebService WorkerProvider> provider) 53 ServiceWorkerContainerClient::ServiceWorkerContainerClient(PassOwnPtr<WebService WorkerProvider> provider)
58 : m_provider(provider) 54 : m_provider(provider)
59 { 55 {
60 } 56 }
61 57
62 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, PassOwn Ptr<WebServiceWorkerProvider> provider) 58 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, PassOwn Ptr<WebServiceWorkerProvider> provider)
63 { 59 {
64 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S erviceWorkerContainerClient::create(provider)); 60 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S erviceWorkerContainerClient::create(provider));
65 } 61 }
66 62
67 } // namespace blink 63 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698