代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/firefox 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# HG changeset patch
# User Luca Greco <lgreco@mozilla.com>
# Date 1603810809 0
# Tue Oct 27 15:00:09 2020 +0000
# Node ID 8de8cd3371e801d408650f102df04252c846f33d
# Parent 5058a78c1008f0917866aa09abff7430bcefa085
Bug 1669466 - Change WebRequestService singleton to a StaticRefPtr. r=glandium,mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D94692
diff -r 5058a78c1008 -r 8de8cd3371e8 toolkit/components/extensions/webrequest/WebRequestService.cpp
--- a/toolkit/components/extensions/webrequest/WebRequestService.cpp Tue Oct 27 15:07:07 2020 +0000
+++ b/toolkit/components/extensions/webrequest/WebRequestService.cpp Tue Oct 27 15:00:09 2020 +0000
@@ -13,22 +13,14 @@
using namespace mozilla::dom;
using namespace mozilla::extensions;
-static WebRequestService* sWeakWebRequestService;
-
-WebRequestService::~WebRequestService() { sWeakWebRequestService = nullptr; }
+static StaticRefPtr<WebRequestService> sWebRequestService;
/* static */ WebRequestService& WebRequestService::GetSingleton() {
- static RefPtr<WebRequestService> instance;
- if (!sWeakWebRequestService) {
- instance = new WebRequestService();
- ClearOnShutdown(&instance);
-
- // A separate weak instance that we keep a reference to as long as the
- // original service is alive, even after our strong reference is cleared to
- // allow the service to be destroyed.
- sWeakWebRequestService = instance;
+ if (!sWebRequestService) {
+ sWebRequestService = new WebRequestService();
+ ClearOnShutdown(&sWebRequestService);
}
- return *sWeakWebRequestService;
+ return *sWebRequestService;
}
UniquePtr<WebRequestChannelEntry> WebRequestService::RegisterChannel(
@@ -56,7 +48,7 @@
: mChannelId(aChannel->Id()), mChannel(aChannel) {}
WebRequestChannelEntry::~WebRequestChannelEntry() {
- if (sWeakWebRequestService) {
- sWeakWebRequestService->mChannelEntries.Remove(mChannelId);
+ if (sWebRequestService) {
+ sWebRequestService->mChannelEntries.Remove(mChannelId);
}
}
diff -r 5058a78c1008 -r 8de8cd3371e8 toolkit/components/extensions/webrequest/WebRequestService.h
--- a/toolkit/components/extensions/webrequest/WebRequestService.h Tue Oct 27 15:07:07 2020 +0000
+++ b/toolkit/components/extensions/webrequest/WebRequestService.h Tue Oct 27 15:00:09 2020 +0000
@@ -64,7 +64,7 @@
dom::ContentParent* aContentParent);
private:
- ~WebRequestService();
+ ~WebRequestService() = default;
friend ChannelEntry;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。