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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 2433773006: Remove ExecutionContext::activeDOMObjectsAreStopped()
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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index 5bfdcc44afc45394e4ebcb605818d1d6e96b3d02..89c99e8c27755121096e9aacb2cad79625e270ad 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -58,6 +58,7 @@
#include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h"
#include "wtf/PtrUtil.h"
#include <memory>
+#include <utility>
namespace blink {
@@ -70,16 +71,14 @@ class RegistrationCallback
void onSuccess(
std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) override {
- if (!m_resolver->getExecutionContext() ||
- m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
+ if (!m_resolver->getExecutionContext())
return;
m_resolver->resolve(ServiceWorkerRegistration::getOrCreate(
- m_resolver->getExecutionContext(), wrapUnique(handle.release())));
+ m_resolver->getExecutionContext(), std::move(handle)));
}
void onError(const WebServiceWorkerError& error) override {
- if (!m_resolver->getExecutionContext() ||
- m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
+ if (!m_resolver->getExecutionContext())
return;
ScriptState::Scope scope(m_resolver->getScriptState());
if (error.errorType == WebServiceWorkerError::ErrorTypeType) {
@@ -106,9 +105,8 @@ class GetRegistrationCallback : public WebServiceWorkerProvider::
void onSuccess(std::unique_ptr<WebServiceWorkerRegistration::Handle>
webPassHandle) override {
std::unique_ptr<WebServiceWorkerRegistration::Handle> handle =
- wrapUnique(webPassHandle.release());
- if (!m_resolver->getExecutionContext() ||
- m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
+ std::move(webPassHandle);
+ if (!m_resolver->getExecutionContext())
return;
if (!handle) {
// Resolve the promise with undefined.
@@ -120,8 +118,7 @@ class GetRegistrationCallback : public WebServiceWorkerProvider::
}
void onError(const WebServiceWorkerError& error) override {
- if (!m_resolver->getExecutionContext() ||
- m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
+ if (!m_resolver->getExecutionContext())
return;
m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error));
}
@@ -143,21 +140,19 @@ class GetRegistrationsCallback : public WebServiceWorkerProvider::
webPassRegistrations) override {
Vector<std::unique_ptr<WebServiceWorkerRegistration::Handle>> handles;
std::unique_ptr<WebVector<WebServiceWorkerRegistration::Handle*>>
- webRegistrations = wrapUnique(webPassRegistrations.release());
+ webRegistrations = std::move(webPassRegistrations);
for (auto& handle : *webRegistrations) {
handles.append(wrapUnique(handle));
}
- if (!m_resolver->getExecutionContext() ||
- m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
+ if (!m_resolver->getExecutionContext())
return;
m_resolver->resolve(
ServiceWorkerRegistrationArray::take(m_resolver.get(), &handles));
}
void onError(const WebServiceWorkerError& error) override {
- if (!m_resolver->getExecutionContext() ||
- m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
+ if (!m_resolver->getExecutionContext())
return;
m_resolver->reject(ServiceWorkerError::take(m_resolver.get(), error));
}
@@ -179,10 +174,10 @@ class ServiceWorkerContainer::GetRegistrationForReadyCallback
std::unique_ptr<WebServiceWorkerRegistration::Handle> handle) override {
ASSERT(m_ready->getState() == ReadyProperty::Pending);
- if (m_ready->getExecutionContext() &&
- !m_ready->getExecutionContext()->activeDOMObjectsAreStopped())
+ if (m_ready->getExecutionContext()) {
m_ready->resolve(ServiceWorkerRegistration::getOrCreate(
- m_ready->getExecutionContext(), wrapUnique(handle.release())));
+ m_ready->getExecutionContext(), std::move(handle)));
+ }
}
private:

Powered by Google App Engine
This is Rietveld 408576698