/src/mozilla-central/dom/media/systemservices/MediaUtils.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set sw=2 ts=8 et ft=cpp : */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
5 | | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "MediaUtils.h" |
8 | | |
9 | | namespace mozilla { |
10 | | namespace media { |
11 | | |
12 | | already_AddRefed<nsIAsyncShutdownClient> |
13 | | GetShutdownBarrier() |
14 | 0 | { |
15 | 0 | nsCOMPtr<nsIAsyncShutdownService> svc = services::GetAsyncShutdown(); |
16 | 0 | MOZ_RELEASE_ASSERT(svc); |
17 | 0 |
|
18 | 0 | nsCOMPtr<nsIAsyncShutdownClient> barrier; |
19 | 0 | nsresult rv = svc->GetProfileBeforeChange(getter_AddRefs(barrier)); |
20 | 0 | if (!barrier) { |
21 | 0 | // We are probably in a content process. We need to do cleanup at |
22 | 0 | // XPCOM shutdown in leakchecking builds. |
23 | 0 | rv = svc->GetXpcomWillShutdown(getter_AddRefs(barrier)); |
24 | 0 | } |
25 | 0 | MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); |
26 | 0 | MOZ_RELEASE_ASSERT(barrier); |
27 | 0 | return barrier.forget(); |
28 | 0 | } |
29 | | |
30 | | NS_IMPL_ISUPPORTS(ShutdownBlocker, nsIAsyncShutdownBlocker) |
31 | | |
32 | | } // namespace media |
33 | | } // namespace mozilla |