| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 627 |
| 628 void AddObserver() { num_observers_++; } | 628 void AddObserver() { num_observers_++; } |
| 629 void RemoveObserver() { num_observers_--; } | 629 void RemoveObserver() { num_observers_--; } |
| 630 | 630 |
| 631 const Texture* texture() const { return texture_; } | 631 const Texture* texture() const { return texture_; } |
| 632 Texture* texture() { return texture_; } | 632 Texture* texture() { return texture_; } |
| 633 GLuint client_id() const { return client_id_; } | 633 GLuint client_id() const { return client_id_; } |
| 634 GLuint service_id() const { return texture_->service_id(); } | 634 GLuint service_id() const { return texture_->service_id(); } |
| 635 GLint num_observers() const { return num_observers_; } | 635 GLint num_observers() const { return num_observers_; } |
| 636 | 636 |
| 637 // When the TextureRef is destroyed, it will assume that the context has been |
| 638 // lost, regardless of the state of the TextureManager. |
| 639 void ForceContextLost(); |
| 640 |
| 637 private: | 641 private: |
| 638 friend class base::RefCounted<TextureRef>; | 642 friend class base::RefCounted<TextureRef>; |
| 639 friend class Texture; | 643 friend class Texture; |
| 640 friend class TextureManager; | 644 friend class TextureManager; |
| 641 | 645 |
| 642 ~TextureRef(); | 646 ~TextureRef(); |
| 643 const TextureManager* manager() const { return manager_; } | 647 const TextureManager* manager() const { return manager_; } |
| 644 TextureManager* manager() { return manager_; } | 648 TextureManager* manager() { return manager_; } |
| 645 void reset_client_id() { client_id_ = 0; } | 649 void reset_client_id() { client_id_ = 0; } |
| 646 | 650 |
| 647 TextureManager* manager_; | 651 TextureManager* manager_; |
| 648 Texture* texture_; | 652 Texture* texture_; |
| 649 GLuint client_id_; | 653 GLuint client_id_; |
| 650 GLint num_observers_; | 654 GLint num_observers_; |
| 655 bool force_context_lost_; |
| 651 | 656 |
| 652 DISALLOW_COPY_AND_ASSIGN(TextureRef); | 657 DISALLOW_COPY_AND_ASSIGN(TextureRef); |
| 653 }; | 658 }; |
| 654 | 659 |
| 655 // Holds data that is per gles2_cmd_decoder, but is related to to the | 660 // Holds data that is per gles2_cmd_decoder, but is related to to the |
| 656 // TextureManager. | 661 // TextureManager. |
| 657 struct DecoderTextureState { | 662 struct DecoderTextureState { |
| 658 // total_texture_upload_time automatically initialized to 0 in default | 663 // total_texture_upload_time automatically initialized to 0 in default |
| 659 // constructor. | 664 // constructor. |
| 660 explicit DecoderTextureState(const GpuDriverBugWorkarounds& workarounds) | 665 explicit DecoderTextureState(const GpuDriverBugWorkarounds& workarounds) |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 private: | 1194 private: |
| 1190 DecoderTextureState* texture_state_; | 1195 DecoderTextureState* texture_state_; |
| 1191 base::TimeTicks begin_time_; | 1196 base::TimeTicks begin_time_; |
| 1192 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); | 1197 DISALLOW_COPY_AND_ASSIGN(ScopedTextureUploadTimer); |
| 1193 }; | 1198 }; |
| 1194 | 1199 |
| 1195 } // namespace gles2 | 1200 } // namespace gles2 |
| 1196 } // namespace gpu | 1201 } // namespace gpu |
| 1197 | 1202 |
| 1198 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ | 1203 #endif // GPU_COMMAND_BUFFER_SERVICE_TEXTURE_MANAGER_H_ |
| OLD | NEW |