Chromium Code Reviews| 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_GL_CONTEXT_PROVIDER_H_ | |
| 6 #define UI_GL_CONTEXT_PROVIDER_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 | |
| 10 class GrContext; | |
| 11 namespace WebKit { class WebGraphicsContext3D; } | |
|
piman
2013/02/21 22:49:48
nit: It's a bit weird to have this file in ui/gl,
danakj
2013/02/22 01:56:31
Oh, somehow I thought cc can't see webkit/gpu, but
danakj
2013/02/22 01:59:28
Or actually there's a TODO in our DEPS, which I gu
| |
| 12 | |
| 13 namespace ui { | |
| 14 | |
| 15 class ContextProvider : public base::RefCounted<ContextProvider> { | |
|
piman
2013/02/21 22:49:48
RefCountedThreadSafe
danakj
2013/02/22 01:56:31
Aahh ok!
| |
| 16 public: | |
| 17 // Initialize and create a 3d context. This must be called from the main | |
| 18 // thread. Calling it more than once should have no effect. | |
| 19 virtual bool InitializeOnMainThread() = 0; | |
| 20 | |
| 21 // Bind the 3d context to the current thread. This should be called before | |
| 22 // accessing the contexts. Calling it more than once should have no effect. | |
| 23 // Once this function has been called, the class should only be accessed | |
| 24 // from the same thread. | |
| 25 virtual bool BindToCurrentThread() = 0; | |
| 26 | |
| 27 virtual WebKit::WebGraphicsContext3D* Context3d() = 0; | |
| 28 virtual class GrContext* GrContext() = 0; | |
| 29 | |
| 30 // Ask the provider to check if the contexts are valid or lost. If they are, | |
| 31 // this should invalidate the provider so that it can be replaced with a new | |
| 32 // one. | |
| 33 virtual void VerifyContexts() = 0; | |
| 34 | |
| 35 protected: | |
| 36 friend class base::RefCounted<ContextProvider>; | |
| 37 virtual ~ContextProvider() {} | |
| 38 }; | |
| 39 | |
| 40 } // namespace ui | |
| 41 | |
| 42 #endif // UI_GL_CONTEXT_PROVIDER_H_ | |
| OLD | NEW |