Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h

Issue 2335223004: Make SharedGpuContext recover automatically after a context loss (Closed)
Patch Set: build fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>;
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698