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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 1880353004: PaymentRequest should be a ContextLifecycleObserver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentRequest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
index 66ff5e9878de7af7e6908e3d3e8172891bd9e37a..dbbdd31c7338485e01adca84981790b2bc81b001 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -201,7 +201,7 @@ const AtomicString& PaymentRequest::interfaceName() const
ExecutionContext* PaymentRequest::getExecutionContext() const
{
- return m_scriptState->getExecutionContext();
+ return ContextLifecycleObserver::getExecutionContext();
}
ScriptPromise PaymentRequest::complete(ScriptState* scriptState, bool success)
@@ -223,10 +223,11 @@ DEFINE_TRACE(PaymentRequest)
visitor->trace(m_showResolver);
visitor->trace(m_completeResolver);
EventTargetWithInlineData::trace(visitor);
+ ContextLifecycleObserver::trace(visitor);
}
PaymentRequest::PaymentRequest(ScriptState* scriptState, const Vector<String>& supportedMethods, const PaymentDetails& details, const PaymentOptions& options, const ScriptValue& data, ExceptionState& exceptionState)
- : m_scriptState(scriptState)
+ : ContextLifecycleObserver(scriptState->getExecutionContext())
, m_supportedMethods(supportedMethods)
, m_details(details)
, m_options(options)
@@ -297,6 +298,11 @@ PaymentRequest::PaymentRequest(ScriptState* scriptState, const Vector<String>& s
m_shippingOption = details.shippingOptions().begin()->id();
}
+void PaymentRequest::contextDestroyed()
+{
+ cleanUp();
+}
+
void PaymentRequest::OnShippingAddressChange(mojom::wtf::ShippingAddressPtr address)
{
DCHECK(m_showResolver);
@@ -360,7 +366,8 @@ void PaymentRequest::cleanUp()
{
m_completeResolver.clear();
m_showResolver.clear();
- m_clientBinding.Close();
+ if (m_clientBinding.is_bound())
+ m_clientBinding.Close();
m_paymentProvider.reset();
}
« no previous file with comments | « third_party/WebKit/Source/modules/payments/PaymentRequest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698