SourceContextInfo.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. namespace Js
  7. {
  8. class RemoteSourceContextInfo;
  9. class SourceDynamicProfileManager;
  10. };
  11. //
  12. // This object is created per script source file or dynamic script buffer.
  13. //
  14. class SourceContextInfo
  15. {
  16. public:
  17. Field(uint) sourceContextId;
  18. Field(Js::LocalFunctionId) nextLocalFunctionId; // Count of functions seen so far
  19. #if DBG
  20. Field(bool) closed;
  21. #endif
  22. Field(DWORD_PTR) dwHostSourceContext; // Context passed in to ParseScriptText
  23. Field(bool) isHostDynamicDocument; // will be set to true when current doc is treated dynamic from the host side. (IActiveScriptContext::IsDynamicDocument)
  24. union
  25. {
  26. struct
  27. {
  28. FieldNoBarrier(char16 const *) url; // The url of the file
  29. FieldNoBarrier(char16 const *) sourceMapUrl; // The url of the source map, such as actual non-minified source of JS on the server.
  30. };
  31. Field(uint) hash; // hash for dynamic scripts
  32. };
  33. #if ENABLE_PROFILE_INFO
  34. Field(Js::SourceDynamicProfileManager *) sourceDynamicProfileManager;
  35. #endif
  36. void EnsureInitialized();
  37. bool IsDynamic() const { return dwHostSourceContext == Js::Constants::NoHostSourceContext || isHostDynamicDocument; }
  38. bool IsSourceProfileLoaded() const;
  39. SourceContextInfo* Clone(Js::ScriptContext* scriptContext) const;
  40. };