| 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 // Bind the 3d context to the current thread. This should be called before | |
| 18 // accessing the contexts. Calling it more than once should have no effect. | |
| 19 // Once this function has been called, the class should only be accessed | |
| 20 // from the same thread. | |
| 21 virtual bool BindToCurrentThread() = 0; | |
| 22 | |
| 23 virtual WebKit::WebGraphicsContext3D* Context3d() = 0; | |
| 24 virtual class GrContext* GrContext() = 0; | |
| 25 | |
| 26 // Ask the provider to check if the contexts are valid or lost. If they are, | |
| 27 // this should invalidate the provider so that it can be replaced with a new | |
| 28 // one. | |
| 29 virtual void VerifyContexts() = 0; | |
| 30 | |
| 31 // A method to be called from the main thread that should return true if | |
| 32 // the context inside the provider is no longer valid. | |
| 33 virtual bool DestroyedOnMainThread() = 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 |