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

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

Issue 2323573002: Revert of Allow canvases to be GPU-accelerated in Workers (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "wtf/ThreadSpecific.h"
6
7 #include <memory>
8
9 namespace gpu { namespace gles2 { class GLES2Interface; } }
10 class GrContext;
11
12 namespace blink {
13
14 class WaitableEvent;
15 class WebGraphicsContext3DProvider;
16
17 // SharedGpuContext provides access to a thread-specific GPU context
18 // that is shared by many callsites throughout the thread.
19 // When on the main thread, provides access to the same context as
20 // Platform::createSharedOffscreenGraphicsContext3DProvider
21 class SharedGpuContext {
22 public:
23 // The contextId is incremented each time a new underlying context
24 // is created. For example, when the context is lost, then restored.
25 // User code can rely on this Id to determine whether long-lived
26 // gpu resources are still alive in the current context.
27 static unsigned contextId();
28 static gpu::gles2::GLES2Interface* gl();
29 static GrContext* gr();
30 static bool isValid();
31 static bool restore();
32
33 enum {
34 kNoSharedContext = 0,
35 };
36
37 private:
38 static SharedGpuContext* getInstanceForCurrentThread();
39
40 SharedGpuContext();
41 void createContextProviderOnMainThread(WaitableEvent*);
42 void createContextProvider();
43
44 std::unique_ptr<WebGraphicsContext3DProvider> m_contextProvider;
45 unsigned m_contextId;
46 friend class WTF::ThreadSpecific<SharedGpuContext>;
47 };
48
49 } // blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698