Commit 375926f8 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Web Payment] Two phase shutdown for PaymentAppService.

Before this patch, PaymentAppService would release its references in the
destructor, which is the second phase of browser shutdown, as opposed to
the KeyedService::Shutdown() method, which is the first phase, where all
references should be released. This may have caused a crash when closing
the browser.

This is a speculative patch to have PaymentAppService release its
references to the payment app factories during the first phase of
browser shutdown.

After this patch, PaymentAppService releases its references in the
KeyedService::Shutdown() method, which is the first phase of browser
shutdown.

Bug: 1077713
Change-Id: Ic5785f703156bea2af7a1a03fca4ca6a39bb7dfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2236464Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#776561}
parent f690cf33
...@@ -32,4 +32,8 @@ void PaymentAppService::Create( ...@@ -32,4 +32,8 @@ void PaymentAppService::Create(
} }
} }
void PaymentAppService::Shutdown() {
factories_.clear();
}
} // namespace payments } // namespace payments
...@@ -30,6 +30,9 @@ class PaymentAppService : public KeyedService { ...@@ -30,6 +30,9 @@ class PaymentAppService : public KeyedService {
// Create payment apps for |delegate|. // Create payment apps for |delegate|.
void Create(base::WeakPtr<PaymentAppFactory::Delegate> delegate); void Create(base::WeakPtr<PaymentAppFactory::Delegate> delegate);
// KeyedService implementation:
void Shutdown() override;
private: private:
std::vector<std::unique_ptr<PaymentAppFactory>> factories_; std::vector<std::unique_ptr<PaymentAppFactory>> factories_;
......
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