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

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

Issue 255983003: Oilpan: Move all supplements of Page, Document, and WorkerClients to the managed heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: using namespace WebCore Created 6 years, 7 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"
11 #include "core/loader/FrameLoaderClient.h" 11 #include "core/loader/FrameLoaderClient.h"
12 #include "core/workers/WorkerGlobalScope.h" 12 #include "core/workers/WorkerGlobalScope.h"
13 #include "public/platform/WebServiceWorkerProvider.h" 13 #include "public/platform/WebServiceWorkerProvider.h"
14 14
15 namespace WebCore { 15 namespace WebCore {
16 16
17 PassOwnPtr<ServiceWorkerContainerClient> ServiceWorkerContainerClient::create(Pa ssOwnPtr<blink::WebServiceWorkerProvider> provider) 17 PassOwnPtrWillBeRawPtr<ServiceWorkerContainerClient> ServiceWorkerContainerClien t::create(PassOwnPtr<blink::WebServiceWorkerProvider> provider)
18 { 18 {
19 return adoptPtr(new ServiceWorkerContainerClient(provider)); 19 return adoptPtrWillBeNoop(new ServiceWorkerContainerClient(provider));
20 } 20 }
21 21
22 ServiceWorkerContainerClient::~ServiceWorkerContainerClient() 22 ServiceWorkerContainerClient::~ServiceWorkerContainerClient()
23 { 23 {
24 } 24 }
25 25
26 const char* ServiceWorkerContainerClient::supplementName() 26 const char* ServiceWorkerContainerClient::supplementName()
27 { 27 {
28 return "ServiceWorkerContainerClient"; 28 return "ServiceWorkerContainerClient";
29 } 29 }
30 30
31 ServiceWorkerContainerClient* ServiceWorkerContainerClient::from(ExecutionContex t* context) 31 ServiceWorkerContainerClient* ServiceWorkerContainerClient::from(ExecutionContex t* context)
32 { 32 {
33 if (context->isDocument()) { 33 if (context->isDocument()) {
34 Document* document = toDocument(context); 34 Document* document = toDocument(context);
35 if (!document->frame()) 35 if (!document->frame())
36 return 0; 36 return 0;
37 37
38 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContaine rClient*>(DocumentSupplement::from(document, supplementName())); 38 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContaine rClient*>(DocumentSupplement::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->Supplementable<Document>::provideSupplement(ServiceWorkerConta inerClient::supplementName(), ServiceWorkerContainerClient::create(document->fra me()->loader().client()->createServiceWorkerProvider())); 43 document->DocumentSupplementable::provideSupplement(ServiceWorkerContain erClient::supplementName(), ServiceWorkerContainerClient::create(document->frame ()->loader().client()->createServiceWorkerProvider()));
44 return static_cast<ServiceWorkerContainerClient*>(DocumentSupplement::fr om(document, supplementName())); 44 return static_cast<ServiceWorkerContainerClient*>(DocumentSupplement::fr om(document, supplementName()));
45 } 45 }
46 46
47 ASSERT(context->isWorkerGlobalScope()); 47 ASSERT(context->isWorkerGlobalScope());
48 return static_cast<ServiceWorkerContainerClient*>(Supplement<WorkerClients>: :from(toWorkerGlobalScope(context)->clients(), supplementName())); 48 return static_cast<ServiceWorkerContainerClient*>(WillBeHeapSupplement<Worke rClients>::from(toWorkerGlobalScope(context)->clients(), supplementName()));
49 } 49 }
50 50
51 ServiceWorkerContainerClient::ServiceWorkerContainerClient(PassOwnPtr<blink::Web ServiceWorkerProvider> provider) 51 ServiceWorkerContainerClient::ServiceWorkerContainerClient(PassOwnPtr<blink::Web ServiceWorkerProvider> provider)
52 : m_provider(provider) 52 : m_provider(provider)
53 { 53 {
54 } 54 }
55 55
56 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, PassOwn Ptr<blink::WebServiceWorkerProvider> provider) 56 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, PassOwn Ptr<blink::WebServiceWorkerProvider> provider)
57 { 57 {
58 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S erviceWorkerContainerClient::create(provider)); 58 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S erviceWorkerContainerClient::create(provider));
59 } 59 }
60 60
61 } // namespace WebCore 61 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698