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 #ifndef mozilla_DeferredFinalize_h
8 #define mozilla_DeferredFinalize_h
11 #include "mozilla/Attributes.h"
17 // Called back from DeferredFinalize. Should add 'thing' to the array of smart
18 // pointers in 'pointers', creating the array if 'pointers' is null, and return
20 typedef void* (*DeferredFinalizeAppendFunction
)(void* aPointers
, void* aThing
);
22 // Called to finalize a number of objects. Slice is the number of objects to
23 // finalize. The return value indicates whether it finalized all objects in the
24 // buffer. If it returns true, the function will not be called again, so the
25 // function should free aData.
26 typedef bool (*DeferredFinalizeFunction
)(uint32_t aSlice
, void* aData
);
28 void DeferredFinalize(DeferredFinalizeAppendFunction aAppendFunc
,
29 DeferredFinalizeFunction aFunc
, void* aThing
);
31 MOZ_NEVER_INLINE
void DeferredFinalize(nsISupports
* aSupports
);
33 } // namespace mozilla
35 #endif // mozilla_DeferredFinalize_h