Bug 1690340 - Part 4: Insert the "Page Source" before the "Extensions for Developers...
[gecko.git] / xpcom / base / nsCycleCollectionParticipant.cpp
blobeaca656e231855e2692c26bed925b0af45ca5513
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/. */
7 #include "nsCycleCollectionParticipant.h"
8 #include "nsCOMPtr.h"
10 NS_IMETHODIMP_(void)
11 nsXPCOMCycleCollectionParticipant::Root(void* aPtr) {
12 nsISupports* s = static_cast<nsISupports*>(aPtr);
13 NS_ADDREF(s);
16 NS_IMETHODIMP_(void)
17 nsXPCOMCycleCollectionParticipant::Unroot(void* aPtr) {
18 nsISupports* s = static_cast<nsISupports*>(aPtr);
19 NS_RELEASE(s);
22 // We define a default trace function because some participants don't need
23 // to trace anything, so it is okay for them not to define one.
24 NS_IMETHODIMP_(void)
25 nsXPCOMCycleCollectionParticipant::Trace(void* aPtr, const TraceCallbacks& aCb,
26 void* aClosure) {}
28 bool nsXPCOMCycleCollectionParticipant::CheckForRightISupports(
29 nsISupports* aSupports) {
30 nsISupports* foo;
31 aSupports->QueryInterface(NS_GET_IID(nsCycleCollectionISupports),
32 reinterpret_cast<void**>(&foo));
33 return aSupports == foo;