OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_LAYERS_TEXTURE_LAYER_CLIENT_H_ | 5 #ifndef CC_LAYERS_TEXTURE_LAYER_CLIENT_H_ |
6 #define CC_LAYERS_TEXTURE_LAYER_CLIENT_H_ | 6 #define CC_LAYERS_TEXTURE_LAYER_CLIENT_H_ |
7 | 7 |
8 #include "cc/resources/single_release_callback.h" | 8 #include "cc/resources/single_release_callback.h" |
9 | 9 |
10 namespace WebKit { class WebGraphicsContext3D; } | 10 namespace WebKit { class WebGraphicsContext3D; } |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 class ResourceUpdateQueue; | 13 class ResourceUpdateQueue; |
14 class TextureMailbox; | 14 class TextureMailbox; |
15 | 15 |
16 class TextureLayerClient { | 16 class TextureLayerClient { |
17 public: | 17 public: |
18 // Called to prepare this layer's texture for compositing. | 18 // Called to prepare this layer's texture for compositing. |
19 // Returns the texture ID to be used for compositing. | 19 // Returns the texture ID to be used for compositing. |
20 virtual unsigned PrepareTexture() = 0; | 20 virtual unsigned PrepareTexture() = 0; |
21 | 21 |
22 // Returns the context that is providing the texture. Used for rate limiting | 22 // Returns whether the context that provided this texture is lost. |
23 // and detecting lost context. | 23 virtual bool IsContextLost() = 0; |
24 virtual WebKit::WebGraphicsContext3D* Context3d() = 0; | 24 |
| 25 // Insert a rate limiting token into the context used to prepare the texture |
| 26 // for this layer. This will block if the producing context is too far ahead |
| 27 // of the consumer. |
| 28 virtual void RateLimitContext() = 0; |
25 | 29 |
26 // Returns true and provides a mailbox if a new frame is available. | 30 // Returns true and provides a mailbox if a new frame is available. |
27 // Returns false if no new data is available | 31 // Returns false if no new data is available |
28 // and the old mailbox is to be reused. | 32 // and the old mailbox is to be reused. |
29 virtual bool PrepareTextureMailbox( | 33 virtual bool PrepareTextureMailbox( |
30 TextureMailbox* mailbox, | 34 TextureMailbox* mailbox, |
31 scoped_ptr<SingleReleaseCallback>* release_callback, | 35 scoped_ptr<SingleReleaseCallback>* release_callback, |
32 bool use_shared_memory) = 0; | 36 bool use_shared_memory) = 0; |
33 | 37 |
34 protected: | 38 protected: |
35 virtual ~TextureLayerClient() {} | 39 virtual ~TextureLayerClient() {} |
36 }; | 40 }; |
37 | 41 |
38 } // namespace cc | 42 } // namespace cc |
39 | 43 |
40 #endif // CC_LAYERS_TEXTURE_LAYER_CLIENT_H_ | 44 #endif // CC_LAYERS_TEXTURE_LAYER_CLIENT_H_ |
OLD | NEW |