Chromium Code Reviews| 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..e18973b7f965e3915af30156b14401110dfda2ec 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h |
| +++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h |
| @@ -25,10 +25,12 @@ public: |
| // 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(); |
|
xidachen
2016/09/15 18:53:35
Is this method suppose to be called inside unit-te
danakj
2016/09/15 19:00:58
(or ForTesting suffix will enforce that).
|
| + typedef std::function<std::unique_ptr<WebGraphicsContext3DProvider>()> ContextProviderFactory; |
| + static void setContextProviderFactoryForTesting(ContextProviderFactory); |
| enum { |
| kNoSharedContext = 0, |
| @@ -39,8 +41,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>; |