19
19
#include " mozilla/SchedulerGroup.h"
20
20
#include " mozilla/dom/ContentParent.h"
21
21
#include " mozilla/ipc/Endpoint.h"
22
+ #include " nsFmtString.h"
22
23
#include " nsThreadUtils.h"
23
24
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
24
25
# include " mozilla/SandboxInfo.h"
@@ -82,8 +83,7 @@ GeckoMediaPluginServiceParent::GetSingleton() {
82
83
83
84
NS_IMPL_ISUPPORTS_INHERITED (GeckoMediaPluginServiceParent,
84
85
GeckoMediaPluginService,
85
- mozIGeckoMediaPluginChromeService,
86
- nsIAsyncShutdownBlocker)
86
+ mozIGeckoMediaPluginChromeService)
87
87
88
88
GeckoMediaPluginServiceParent::GeckoMediaPluginServiceParent ()
89
89
: mScannedPluginOnDisk (false ),
@@ -1821,20 +1821,6 @@ static bool IsNodeIdValid(GMPParent* aParent) {
1821
1821
return !aParent->GetNodeId ().IsEmpty ();
1822
1822
}
1823
1823
1824
- NS_IMETHODIMP
1825
- GeckoMediaPluginServiceParent::GetName (nsAString& aName) {
1826
- aName = u" GeckoMediaPluginServiceParent: shutdown" _ns;
1827
- return NS_OK;
1828
- }
1829
-
1830
- NS_IMETHODIMP
1831
- GeckoMediaPluginServiceParent::GetState (nsIPropertyBag**) { return NS_OK; }
1832
-
1833
- NS_IMETHODIMP
1834
- GeckoMediaPluginServiceParent::BlockShutdown (nsIAsyncShutdownClient*) {
1835
- return NS_OK;
1836
- }
1837
-
1838
1824
// Called from GMPServiceParent::Create() which holds the lock
1839
1825
void GeckoMediaPluginServiceParent::ServiceUserCreated (
1840
1826
GMPServiceParent* aServiceParent) {
@@ -1843,15 +1829,6 @@ void GeckoMediaPluginServiceParent::ServiceUserCreated(
1843
1829
1844
1830
MOZ_ASSERT (!mServiceParents .Contains (aServiceParent));
1845
1831
mServiceParents .AppendElement (aServiceParent);
1846
- if (mServiceParents .Length () == 1 ) {
1847
- nsCOMPtr<nsIAsyncShutdownClient> barrier = GetShutdownBarrier ();
1848
- MOZ_RELEASE_ASSERT (barrier);
1849
-
1850
- nsresult rv = barrier->AddBlocker (
1851
- this , NS_LITERAL_STRING_FROM_CSTRING(__FILE__), __LINE__,
1852
- u" GeckoMediaPluginServiceParent shutdown" _ns);
1853
- MOZ_RELEASE_ASSERT (NS_SUCCEEDED(rv));
1854
- }
1855
1832
}
1856
1833
1857
1834
void GeckoMediaPluginServiceParent::ServiceUserDestroyed (
@@ -1861,12 +1838,6 @@ void GeckoMediaPluginServiceParent::ServiceUserDestroyed(
1861
1838
MOZ_ASSERT (mServiceParents .Length () > 0 );
1862
1839
MOZ_ASSERT (mServiceParents .Contains (aServiceParent));
1863
1840
mServiceParents .RemoveElement (aServiceParent);
1864
- if (mServiceParents .IsEmpty ()) {
1865
- nsCOMPtr<nsIAsyncShutdownClient> barrier = GetShutdownBarrier ();
1866
- MOZ_RELEASE_ASSERT (barrier);
1867
- nsresult rv = barrier->RemoveBlocker (this );
1868
- MOZ_RELEASE_ASSERT (NS_SUCCEEDED(rv));
1869
- }
1870
1841
}
1871
1842
1872
1843
void GeckoMediaPluginServiceParent::ClearStorage () {
@@ -1908,15 +1879,19 @@ already_AddRefed<GMPParent> GeckoMediaPluginServiceParent::GetById(
1908
1879
}
1909
1880
1910
1881
GMPServiceParent::GMPServiceParent (GeckoMediaPluginServiceParent* aService)
1911
- : mService (aService) {
1882
+ : mService (aService), mShutdownBlocker ([](GMPServiceParent* aThis) {
1883
+ nsFmtString name (u" GMPServiceParent {}" , static_cast <void *>(aThis));
1884
+ return media::ShutdownBlockingTicket::Create (
1885
+ name, NS_LITERAL_STRING_FROM_CSTRING(__FILE__), __LINE__);
1886
+ }(this )) {
1912
1887
MOZ_ASSERT (NS_IsMainThread(), " Should be constructed on the main thread" );
1913
1888
MOZ_ASSERT (mService );
1889
+ MOZ_RELEASE_ASSERT (mShutdownBlocker );
1914
1890
mService ->ServiceUserCreated (this );
1915
1891
}
1916
1892
1917
1893
GMPServiceParent::~GMPServiceParent () {
1918
1894
MOZ_ASSERT (NS_IsMainThread(), " Should be destroyted on the main thread" );
1919
- MOZ_ASSERT (mService );
1920
1895
mService ->ServiceUserDestroyed (this );
1921
1896
}
1922
1897
0 commit comments