blink.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (C) 2009 Google Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above
  11. * copyright notice, this list of conditions and the following disclaimer
  12. * in the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Google Inc. nor the names of its
  15. * contributors may be used to endorse or promote products derived from
  16. * this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_BLINK_H_
  31. #define THIRD_PARTY_BLINK_PUBLIC_WEB_BLINK_H_
  32. #include "third_party/blink/public/platform/platform.h"
  33. #include "third_party/blink/public/platform/web_string.h"
  34. #include "v8/include/v8.h"
  35. namespace mojo {
  36. class BinderMap;
  37. }
  38. namespace blink {
  39. // Initialize the entire Blink (wtf, platform, core, modules and web).
  40. // If you just need wtf and platform, use Platform::Initialize instead.
  41. //
  42. // Must be called on the thread that will be the main thread before
  43. // using any other public APIs. The provided Platform must be non-null and
  44. // must remain valid until the current thread calls shutdown.
  45. BLINK_EXPORT void Initialize(
  46. Platform*,
  47. mojo::BinderMap*,
  48. scheduler::WebThreadScheduler* main_thread_scheduler);
  49. // The same as above, but this only supports simple single-threaded execution
  50. // environment. The main thread WebThread object is owned by Platform when this
  51. // version is used. This version is mainly for tests and other components
  52. // requiring only the simple environment.
  53. //
  54. // When this version is used, your Platform implementation needs to follow
  55. // a certain convention on CurrentThread(); see the comments at
  56. // Platform::CreateMainThreadAndInitialize().
  57. BLINK_EXPORT void CreateMainThreadAndInitialize(Platform*, mojo::BinderMap*);
  58. // Get the V8 Isolate for the main thread.
  59. // initialize must have been called first.
  60. BLINK_EXPORT v8::Isolate* MainThreadIsolate();
  61. // Alters the rendering of content to conform to a fixed set of rules.
  62. BLINK_EXPORT void SetWebTestMode(bool);
  63. BLINK_EXPORT bool WebTestMode();
  64. // Alters the rendering of fonts for web tests.
  65. BLINK_EXPORT void SetFontAntialiasingEnabledForTest(bool);
  66. BLINK_EXPORT bool FontAntialiasingEnabledForTest();
  67. // Purge the plugin list cache. This can cause a web-visible and out-of-spec
  68. // change to |navigator.plugins| if the plugin list has changed (see
  69. // https://crbug.com/735854). |reloadPages| is unsupported and must be false.
  70. BLINK_EXPORT void ResetPluginCache(bool reload_pages = false);
  71. // The embedder should call this periodically in an attempt to balance overall
  72. // performance and memory usage.
  73. BLINK_EXPORT void DecommitFreeableMemory();
  74. // Send memory pressure notification to worker thread isolate.
  75. BLINK_EXPORT void MemoryPressureNotificationToWorkerThreadIsolates(
  76. v8::MemoryPressureLevel);
  77. // Logs Runtime Call Stats table for Blink.
  78. BLINK_EXPORT void LogRuntimeCallStats();
  79. // Allows disabling domain relaxation.
  80. BLINK_EXPORT void SetDomainRelaxationForbiddenForTest(bool forbidden,
  81. const WebString& scheme);
  82. // Undos all calls to SetDomainRelaxationForbiddenForTest().
  83. BLINK_EXPORT void ResetDomainRelaxationForTest();
  84. // Force the webgl context to fail so that webglcontextcreationerror
  85. // event gets generated/tested.
  86. BLINK_EXPORT void ForceNextWebGLContextCreationToFailForTest();
  87. // Force the drawing buffer used by webgl contexts to fail so that the webgl
  88. // context's ability to deal with that failure gracefully can be tested.
  89. BLINK_EXPORT void ForceNextDrawingBufferCreationToFailForTest();
  90. // Set whether this renderer process is "cross-origin isolated". This
  91. // corresponds to agent cluster's "cross-origin isolated" concept.
  92. // TODO(yhirano): Have the spec URL.
  93. // This property is process global because we ensure that a renderer process
  94. // host only cross-origin isolated agents or only non-cross-origin isolated
  95. // agents, not both.
  96. // This is called at most once. This is called earlier than any frame commit.
  97. BLINK_EXPORT void SetIsCrossOriginIsolated(bool value);
  98. } // namespace blink
  99. #endif