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

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

Issue 2413063003: service worker: Add promise boilerplate for NavigationPreload enable/disable (Closed)
Patch Set: more boilerplate 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/ServiceWorkerRegistration.h" 5 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
6 6
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" 7 #include "bindings/core/v8/CallbackPromiseAdapter.h"
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptState.h" 9 #include "bindings/core/v8/ScriptState.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 ServiceWorkerRegistration* newRegistration = 71 ServiceWorkerRegistration* newRegistration =
72 new ServiceWorkerRegistration(executionContext, std::move(handle)); 72 new ServiceWorkerRegistration(executionContext, std::move(handle));
73 newRegistration->suspendIfNeeded(); 73 newRegistration->suspendIfNeeded();
74 return newRegistration; 74 return newRegistration;
75 } 75 }
76 76
77 NavigationPreloadManager* ServiceWorkerRegistration::navigationPreload() { 77 NavigationPreloadManager* ServiceWorkerRegistration::navigationPreload() {
78 if (!m_navigationPreload) 78 if (!m_navigationPreload)
79 m_navigationPreload = NavigationPreloadManager::create(); 79 m_navigationPreload = NavigationPreloadManager::create(this);
80 return m_navigationPreload; 80 return m_navigationPreload;
81 } 81 }
82 82
83 String ServiceWorkerRegistration::scope() const { 83 String ServiceWorkerRegistration::scope() const {
84 return m_handle->registration()->scope().string(); 84 return m_handle->registration()->scope().string();
85 } 85 }
86 86
87 ScriptPromise ServiceWorkerRegistration::update(ScriptState* scriptState) { 87 ScriptPromise ServiceWorkerRegistration::update(ScriptState* scriptState) {
88 ServiceWorkerContainerClient* client = 88 ServiceWorkerContainerClient* client =
89 ServiceWorkerContainerClient::from(getExecutionContext()); 89 ServiceWorkerContainerClient::from(getExecutionContext());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 void ServiceWorkerRegistration::contextDestroyed() { 157 void ServiceWorkerRegistration::contextDestroyed() {
158 if (m_stopped) 158 if (m_stopped)
159 return; 159 return;
160 m_stopped = true; 160 m_stopped = true;
161 m_handle->registration()->proxyStopped(); 161 m_handle->registration()->proxyStopped();
162 } 162 }
163 163
164 } // namespace blink 164 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698