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 CC_CONTEXT_PROVIDER_H_ |
| 6 #define CC_CONTEXT_PROVIDER_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 |
| 10 class GrContext; |
| 11 namespace WebKit { class WebGraphicsContext3D; } |
| 12 |
| 13 namespace cc { |
| 14 |
| 15 class ContextProvider : public base::RefCountedThreadSafe<ContextProvider> { |
| 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::RefCountedThreadSafe<ContextProvider>; |
| 37 virtual ~ContextProvider() {} |
| 38 }; |
| 39 |
| 40 } // namespace cc |
| 41 |
| 42 #endif // CC_CONTEXT_PROVIDER_H_ |
OLD | NEW |