| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_OUTPUT_CONTEXT_PROVIDER_H_ | 5 #ifndef CC_OUTPUT_CONTEXT_PROVIDER_H_ |
| 6 #define CC_OUTPUT_CONTEXT_PROVIDER_H_ | 6 #define CC_OUTPUT_CONTEXT_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Invalidates the cached OpenGL state in GrContext. | 67 // Invalidates the cached OpenGL state in GrContext. |
| 68 // See skia GrContext::resetContext for details. | 68 // See skia GrContext::resetContext for details. |
| 69 virtual void InvalidateGrContext(uint32_t state) = 0; | 69 virtual void InvalidateGrContext(uint32_t state) = 0; |
| 70 | 70 |
| 71 // Returns the capabilities of the currently bound 3d context. | 71 // Returns the capabilities of the currently bound 3d context. |
| 72 virtual gpu::Capabilities ContextCapabilities() = 0; | 72 virtual gpu::Capabilities ContextCapabilities() = 0; |
| 73 | 73 |
| 74 // Sets a callback to be called when the context is lost. This should be | 74 // Sets a callback to be called when the context is lost. This should be |
| 75 // called from the same thread that the context is bound to. To avoid races, | 75 // called from the same thread that the context is bound to. To avoid races, |
| 76 // it should be called before BindToCurrentThread(). | 76 // it should be called before BindToCurrentThread(). |
| 77 // Implementation note: Implementations must avoid post-tasking the provided |
| 78 // |lost_context_callback| directly as clients expect the method to not be |
| 79 // called once they call SetLostContextCallback() again with a different |
| 80 // callback. |
| 77 typedef base::Closure LostContextCallback; | 81 typedef base::Closure LostContextCallback; |
| 78 virtual void SetLostContextCallback( | 82 virtual void SetLostContextCallback( |
| 79 const LostContextCallback& lost_context_callback) = 0; | 83 const LostContextCallback& lost_context_callback) = 0; |
| 80 | 84 |
| 81 // Below are helper methods for ScopedContextLock. Use that instead of calling | 85 // Below are helper methods for ScopedContextLock. Use that instead of calling |
| 82 // these directly. | 86 // these directly. |
| 83 // | 87 // |
| 84 // Detaches debugging thread checkers to allow use of the provider from the | 88 // Detaches debugging thread checkers to allow use of the provider from the |
| 85 // current thread. This can be called on any thread. | 89 // current thread. This can be called on any thread. |
| 86 virtual void DetachFromThread() {} | 90 virtual void DetachFromThread() {} |
| 87 // Returns the lock that should be held if using this context from multiple | 91 // Returns the lock that should be held if using this context from multiple |
| 88 // threads. This can be called on any thread. | 92 // threads. This can be called on any thread. |
| 89 virtual base::Lock* GetLock() = 0; | 93 virtual base::Lock* GetLock() = 0; |
| 90 | 94 |
| 91 protected: | 95 protected: |
| 92 friend class base::RefCountedThreadSafe<ContextProvider>; | 96 friend class base::RefCountedThreadSafe<ContextProvider>; |
| 93 virtual ~ContextProvider() {} | 97 virtual ~ContextProvider() {} |
| 94 }; | 98 }; |
| 95 | 99 |
| 96 } // namespace cc | 100 } // namespace cc |
| 97 | 101 |
| 98 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ | 102 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ |
| OLD | NEW |