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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // accessing the contexts. Calling it more than once should have no effect. | 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 | 23 // Once this function has been called, the class should only be accessed |
24 // from the same thread. | 24 // from the same thread. |
25 virtual bool BindToCurrentThread() = 0; | 25 virtual bool BindToCurrentThread() = 0; |
26 | 26 |
27 virtual WebKit::WebGraphicsContext3D* Context3d() = 0; | 27 virtual WebKit::WebGraphicsContext3D* Context3d() = 0; |
28 virtual gpu::ContextSupport* ContextSupport() = 0; | 28 virtual gpu::ContextSupport* ContextSupport() = 0; |
29 virtual class GrContext* GrContext() = 0; | 29 virtual class GrContext* GrContext() = 0; |
30 | 30 |
31 struct Capabilities { | 31 struct Capabilities { |
32 bool bind_uniform_location; | |
33 bool discard_backbuffer; | 32 bool discard_backbuffer; |
34 bool egl_image_external; | 33 bool egl_image_external; |
35 bool fast_npot_mo8_textures; | 34 bool fast_npot_mo8_textures; |
36 bool iosurface; | 35 bool iosurface; |
37 bool map_image; | 36 bool map_image; |
38 bool map_sub; | 37 bool map_sub; |
39 bool post_sub_buffer; | 38 bool post_sub_buffer; |
40 bool set_visibility; | 39 bool set_visibility; |
41 bool shallow_flush; | 40 bool shallow_flush; |
42 bool swapbuffers_complete_callback; | 41 bool swapbuffers_complete_callback; |
43 bool texture_format_bgra8888; | 42 bool texture_format_bgra8888; |
44 bool texture_format_etc1; | 43 bool texture_format_etc1; |
45 bool texture_rectangle; | 44 bool texture_rectangle; |
46 bool texture_storage; | 45 bool texture_storage; |
47 bool texture_usage; | 46 bool texture_usage; |
48 bool discard_framebuffer; | 47 bool discard_framebuffer; |
49 size_t max_transfer_buffer_usage_bytes; | 48 size_t max_transfer_buffer_usage_bytes; |
50 | 49 |
51 CC_EXPORT Capabilities(); | 50 CC_EXPORT Capabilities(); |
52 }; | 51 }; |
53 // Returns the capabilities of the currently bound 3d context. | 52 // Returns the capabilities of the currently bound 3d context. |
54 virtual Capabilities ContextCapabilities() = 0; | 53 virtual Capabilities ContextCapabilities() = 0; |
55 | 54 |
| 55 // Checks if the context is currently known to be lost. |
| 56 virtual bool IsContextLost() = 0; |
| 57 |
56 // Ask the provider to check if the contexts are valid or lost. If they are, | 58 // Ask the provider to check if the contexts are valid or lost. If they are, |
57 // this should invalidate the provider so that it can be replaced with a new | 59 // this should invalidate the provider so that it can be replaced with a new |
58 // one. | 60 // one. |
59 virtual void VerifyContexts() = 0; | 61 virtual void VerifyContexts() = 0; |
60 | 62 |
61 // A method to be called from the main thread that should return true if | 63 // A method to be called from the main thread that should return true if |
62 // the context inside the provider is no longer valid. | 64 // the context inside the provider is no longer valid. |
63 virtual bool DestroyedOnMainThread() = 0; | 65 virtual bool DestroyedOnMainThread() = 0; |
64 | 66 |
65 // Sets a callback to be called when the context is lost. This should be | 67 // Sets a callback to be called when the context is lost. This should be |
(...skipping 18 matching lines...) Expand all Loading... |
84 const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0; | 86 const MemoryPolicyChangedCallback& memory_policy_changed_callback) = 0; |
85 | 87 |
86 protected: | 88 protected: |
87 friend class base::RefCountedThreadSafe<ContextProvider>; | 89 friend class base::RefCountedThreadSafe<ContextProvider>; |
88 virtual ~ContextProvider() {} | 90 virtual ~ContextProvider() {} |
89 }; | 91 }; |
90 | 92 |
91 } // namespace cc | 93 } // namespace cc |
92 | 94 |
93 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ | 95 #endif // CC_OUTPUT_CONTEXT_PROVIDER_H_ |
OLD | NEW |