FinalizableObject.h 832 B

123456789101112131415161718192021222324
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. #include "RecyclerVisitedObject.h"
  7. class FinalizableObject : public IRecyclerVisitedObject
  8. {
  9. public:
  10. virtual void OnMark() {}
  11. void Mark(RecyclerHeapHandle recycler) final
  12. {
  13. Mark(static_cast<Recycler*>(recycler));
  14. }
  15. void Trace(IRecyclerHeapMarkingContext* markingContext)
  16. {
  17. AssertMsg(false, "Trace called on object that isn't implemented by the host");
  18. }
  19. virtual void Mark(Recycler* recycler) = 0;
  20. };