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

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

Issue 2365463004: Revert of Clear LifecycleObserver::m_context when LifecycleObserver::contextDestroyed gets called (Closed)
Patch Set: Created 4 years, 2 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
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 "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"
(...skipping 17 matching lines...) Expand all
28 { 28 {
29 } 29 }
30 30
31 const char* ServiceWorkerContainerClient::supplementName() 31 const char* ServiceWorkerContainerClient::supplementName()
32 { 32 {
33 return "ServiceWorkerContainerClient"; 33 return "ServiceWorkerContainerClient";
34 } 34 }
35 35
36 ServiceWorkerContainerClient* ServiceWorkerContainerClient::from(ExecutionContex t* context) 36 ServiceWorkerContainerClient* ServiceWorkerContainerClient::from(ExecutionContex t* context)
37 { 37 {
38 if (!context)
39 return nullptr;
40 if (context->isWorkerGlobalScope()) { 38 if (context->isWorkerGlobalScope()) {
41 WorkerClients* clients = toWorkerGlobalScope(context)->clients(); 39 WorkerClients* clients = toWorkerGlobalScope(context)->clients();
42 ASSERT(clients); 40 ASSERT(clients);
43 return static_cast<ServiceWorkerContainerClient*>(Supplement<WorkerClien ts>::from(clients, supplementName())); 41 return static_cast<ServiceWorkerContainerClient*>(Supplement<WorkerClien ts>::from(clients, supplementName()));
44 } 42 }
45 Document* document = toDocument(context); 43 Document* document = toDocument(context);
46 if (!document->frame()) 44 if (!document->frame())
47 return nullptr; 45 return nullptr;
48 46
49 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContainerCli ent*>(Supplement<Document>::from(document, supplementName())); 47 ServiceWorkerContainerClient* client = static_cast<ServiceWorkerContainerCli ent*>(Supplement<Document>::from(document, supplementName()));
50 if (!client) { 48 if (!client) {
51 client = new ServiceWorkerContainerClient(document->frame()->loader().cl ient()->createServiceWorkerProvider()); 49 client = new ServiceWorkerContainerClient(document->frame()->loader().cl ient()->createServiceWorkerProvider());
52 Supplement<Document>::provideTo(*document, supplementName(), client); 50 Supplement<Document>::provideTo(*document, supplementName(), client);
53 } 51 }
54 return client; 52 return client;
55 } 53 }
56 54
57 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, std::un ique_ptr<WebServiceWorkerProvider> provider) 55 void provideServiceWorkerContainerClientToWorker(WorkerClients* clients, std::un ique_ptr<WebServiceWorkerProvider> provider)
58 { 56 {
59 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S erviceWorkerContainerClient::create(std::move(provider))); 57 clients->provideSupplement(ServiceWorkerContainerClient::supplementName(), S erviceWorkerContainerClient::create(std::move(provider)));
60 } 58 }
61 59
62 } // namespace blink 60 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/Body.cpp ('k') | third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698