OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013 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 #ifndef UI_COMPOSITOR_CONTEXT_PROVIDER_FROM_CONTEXT_FACTORY_H_ | |
6 #define UI_COMPOSITOR_CONTEXT_PROVIDER_FROM_CONTEXT_FACTORY_H_ | |
7 | |
8 #include "base/synchronization/lock.h" | |
9 #include "cc/output/context_provider.h" | |
10 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | |
11 #include "ui/compositor/compositor.h" | |
12 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | |
13 | |
14 namespace ui { | |
15 | |
16 class ContextProviderFromContextFactory | |
17 : public cc::ContextProvider { | |
18 public: | |
19 static scoped_refptr<ContextProviderFromContextFactory> CreateForOffscreen( | |
20 ContextFactory* factory); | |
21 | |
22 virtual bool BindToCurrentThread() OVERRIDE; | |
23 virtual WebKit::WebGraphicsContext3D* Context3d() OVERRIDE; | |
24 virtual class GrContext* GrContext() OVERRIDE; | |
25 virtual void VerifyContexts() OVERRIDE; | |
26 virtual bool DestroyedOnMainThread() OVERRIDE; | |
27 virtual void SetLostContextCallback(const LostContextCallback& cb) OVERRIDE; | |
28 | |
29 protected: | |
30 ContextProviderFromContextFactory(ContextFactory* factory); | |
31 virtual ~ContextProviderFromContextFactory(); | |
32 | |
33 bool InitializeOnMainThread(); | |
34 | |
35 private: | |
36 ContextFactory* factory_; | |
37 base::Lock destroyed_lock_; | |
38 bool destroyed_; | |
39 scoped_ptr<WebKit::WebGraphicsContext3D> context3d_; | |
40 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; | |
41 }; | |
42 | |
43 } // namespace ui | |
44 | |
45 #endif // UI_COMPOSITOR_CONTEXT_PROVIDER_FROM_CONTEXT_FACTORY_H_ | |
OLD | NEW |