Index: third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h |
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h |
index ec64583043b4fac3653848b9d67a6dfae9e6393f..65a15242d2e83a3c0365f547a44edd185ab76555 100644 |
--- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h |
+++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h |
@@ -2,6 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "platform/PlatformExport.h" |
#include "wtf/ThreadSpecific.h" |
#include <memory> |
@@ -18,17 +19,19 @@ class WebGraphicsContext3DProvider; |
// that is shared by many callsites throughout the thread. |
// When on the main thread, provides access to the same context as |
// Platform::createSharedOffscreenGraphicsContext3DProvider |
-class SharedGpuContext { |
+class PLATFORM_EXPORT SharedGpuContext { |
public: |
// The contextId is incremented each time a new underlying context |
// is created. For example, when the context is lost, then restored. |
// User code can rely on this Id to determine whether long-lived |
// gpu resources are still alive in the current context. |
static unsigned contextId(); |
- static gpu::gles2::GLES2Interface* gl(); |
- static GrContext* gr(); |
- static bool isValid(); |
- static bool restore(); |
+ static gpu::gles2::GLES2Interface* gl(); // May re-create context if context was lost |
+ static GrContext* gr(); // May re-create context if context was lost |
+ static bool isValid(); // May re-create context if context was lost |
+ static bool isValidWithoutRestoring(); |
+ typedef std::function<std::unique_ptr<WebGraphicsContext3DProvider>()> ContextProviderFactory; |
+ static void setContextProviderFactoryForTesting(ContextProviderFactory); |
enum { |
kNoSharedContext = 0, |
@@ -39,8 +42,9 @@ private: |
SharedGpuContext(); |
void createContextProviderOnMainThread(WaitableEvent*); |
- void createContextProvider(); |
+ void createContextProviderIfNeeded(); |
+ ContextProviderFactory m_contextProviderFactory = nullptr; |
std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider; |
unsigned m_contextId; |
friend class WTF::ThreadSpecific<SharedGpuContext>; |