/src/mozilla-central/xpcom/base/nsCycleCollectionParticipant.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 ts=8 sts=2 et sw=2 tw=80: */ |
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 |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "nsCycleCollectionParticipant.h" |
8 | | #include "nsCOMPtr.h" |
9 | | |
10 | | NS_IMETHODIMP_(void) |
11 | | nsXPCOMCycleCollectionParticipant::Root(void* aPtr) |
12 | 0 | { |
13 | 0 | nsISupports* s = static_cast<nsISupports*>(aPtr); |
14 | 0 | NS_ADDREF(s); |
15 | 0 | } |
16 | | |
17 | | NS_IMETHODIMP_(void) |
18 | | nsXPCOMCycleCollectionParticipant::Unroot(void* aPtr) |
19 | 0 | { |
20 | 0 | nsISupports* s = static_cast<nsISupports*>(aPtr); |
21 | 0 | NS_RELEASE(s); |
22 | 0 | } |
23 | | |
24 | | // We define a default trace function because some participants don't need |
25 | | // to trace anything, so it is okay for them not to define one. |
26 | | NS_IMETHODIMP_(void) |
27 | | nsXPCOMCycleCollectionParticipant::Trace(void* aPtr, const TraceCallbacks& aCb, |
28 | | void* aClosure) |
29 | 0 | { |
30 | 0 | } |
31 | | |
32 | | bool |
33 | | nsXPCOMCycleCollectionParticipant::CheckForRightISupports(nsISupports* aSupports) |
34 | 0 | { |
35 | 0 | nsISupports* foo; |
36 | 0 | aSupports->QueryInterface(NS_GET_IID(nsCycleCollectionISupports), |
37 | 0 | reinterpret_cast<void**>(&foo)); |
38 | 0 | return aSupports == foo; |
39 | 0 | } |