SourceHolder.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. #include "RuntimeBasePch.h"
  6. namespace Js
  7. {
  8. LPCUTF8 const ISourceHolder::emptyString = (LPCUTF8)"\0";
  9. SimpleSourceHolder const ISourceHolder::emptySourceHolder(NO_WRITE_BARRIER_TAG(emptyString), 0, true);
  10. void HeapSourceHolder::Dispose(bool fShutdown)
  11. {
  12. Unload();
  13. }
  14. void HeapSourceHolder::Unload()
  15. {
  16. if (this->shouldFreeSource)
  17. {
  18. // REVIEW: Where is the inc for this guy?
  19. //PERF_COUNTER_DEC(Basic, ScriptCodeBufferCount);
  20. HeapFree(GetProcessHeap(), 0, (void*)this->originalSourceBuffer);
  21. this->source = nullptr;
  22. this->originalSourceBuffer = nullptr;
  23. this->isEmpty = true;
  24. this->byteLength = 0;
  25. this->shouldFreeSource = false;
  26. }
  27. }
  28. }