Commit 76fdec85 authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Commit Bot

[WebLayer] Move spec, journeyLogger's destruction into PRService

Before the CL, mSpec, mJourneyLogger were destroyed in CPRService.

After the CL, they are destroyed in PRService.

This change shares the destructions of the two variables with the
WebLayer payment request service.

Bug: 1025619

Change-Id: I572f8b5f0cc54963e3f3cd86fa2148ebea9c2541
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2540746
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828199}
parent de2f8a59
......@@ -589,7 +589,14 @@ public class ChromePaymentRequestService
mPaymentRequestService.close();
mPaymentRequestService = null;
closeUIAndDestroyNativeObjects();
mPaymentUiService.close();
SettingsAutofillAndPaymentsObserver.getInstance().unregisterObserver(mPaymentUiService);
if (mPaymentHandlerHost != null) {
mPaymentHandlerHost.destroy();
mPaymentHandlerHost = null;
}
PaymentDetailsUpdateServiceHelper.getInstance().reset();
}
// Implements BrowserPaymentRequest:
......@@ -724,28 +731,6 @@ public class ChromePaymentRequestService
}
}
/**
* Closes the UI and destroys native objects. If the client is still connected, then it's
* notified of UI hiding. This ChromePaymentRequestService object can't be reused after this
* function is called.
*/
private void closeUIAndDestroyNativeObjects() {
mPaymentUiService.close();
SettingsAutofillAndPaymentsObserver.getInstance().unregisterObserver(mPaymentUiService);
// Destroy native objects.
mJourneyLogger.destroy();
if (mPaymentHandlerHost != null) {
mPaymentHandlerHost.destroy();
mPaymentHandlerHost = null;
}
if (mSpec != null) {
mSpec.destroy();
}
PaymentDetailsUpdateServiceHelper.getInstance().reset();
}
// Implement PaymentUiService.Delegate:
@Override
public void dispatchPayerDetailChangeEventIfNeeded(PayerDetail detail) {
......
......@@ -1214,6 +1214,12 @@ public class PaymentRequestService
mOnClosedListener.run();
mJourneyLogger.destroy();
if (mSpec != null) {
mSpec.destroy();
}
if (sNativeObserverForTest != null) {
sNativeObserverForTest.onClosed();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment