features.cc 894 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright (c) 2018 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/common/node_includes.h"
  5. #include "native_mate/dictionary.h"
  6. namespace {
  7. bool IsOffscreenRenderingEnabled() {
  8. #if defined(ENABLE_OSR)
  9. return true;
  10. #else
  11. return false;
  12. #endif
  13. }
  14. bool IsPDFViewerEnabled() {
  15. #if defined(ENABLE_PDF_VIEWER)
  16. return true;
  17. #else
  18. return false;
  19. #endif
  20. }
  21. void Initialize(v8::Local<v8::Object> exports,
  22. v8::Local<v8::Value> unused,
  23. v8::Local<v8::Context> context,
  24. void* priv) {
  25. mate::Dictionary dict(context->GetIsolate(), exports);
  26. dict.SetMethod("isOffscreenRenderingEnabled", &IsOffscreenRenderingEnabled);
  27. dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled);
  28. }
  29. } // namespace
  30. NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_features, Initialize)