MutableFileBase.cpp 980 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  4. * You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "MutableFileBase.h"
  6. #include "ActorsChild.h"
  7. #include "mozilla/Assertions.h"
  8. #include "prthread.h"
  9. namespace mozilla {
  10. namespace dom {
  11. MutableFileBase::MutableFileBase(DEBUGONLY(PRThread* aOwningThread,)
  12. BackgroundMutableFileChildBase* aActor)
  13. : RefCountedThreadObject(DEBUGONLY(aOwningThread))
  14. , mBackgroundActor(aActor)
  15. {
  16. AssertIsOnOwningThread();
  17. MOZ_ASSERT(aActor);
  18. }
  19. MutableFileBase::~MutableFileBase()
  20. {
  21. AssertIsOnOwningThread();
  22. if (mBackgroundActor) {
  23. mBackgroundActor->SendDeleteMeInternal();
  24. MOZ_ASSERT(!mBackgroundActor, "SendDeleteMeInternal should have cleared!");
  25. }
  26. }
  27. } // namespace dom
  28. } // namespace mozilla