| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 5 #ifndef CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 6 #define CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 6 #define CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 static const GLuint kExternalTextureId; | 345 static const GLuint kExternalTextureId; |
| 346 virtual GLuint NextTextureId(); | 346 virtual GLuint NextTextureId(); |
| 347 virtual void RetireTextureId(GLuint id); | 347 virtual void RetireTextureId(GLuint id); |
| 348 | 348 |
| 349 virtual GLuint NextBufferId(); | 349 virtual GLuint NextBufferId(); |
| 350 virtual void RetireBufferId(GLuint id); | 350 virtual void RetireBufferId(GLuint id); |
| 351 | 351 |
| 352 virtual GLuint NextImageId(); | 352 virtual GLuint NextImageId(); |
| 353 virtual void RetireImageId(GLuint id); | 353 virtual void RetireImageId(GLuint id); |
| 354 | 354 |
| 355 virtual GLuint NextFramebufferId(); |
| 356 virtual void RetireFramebufferId(GLuint id); |
| 357 |
| 358 virtual GLuint NextRenderbufferId(); |
| 359 virtual void RetireRenderbufferId(GLuint id); |
| 360 |
| 355 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); | 361 void SetMaxTransferBufferUsageBytes(size_t max_transfer_buffer_usage_bytes); |
| 356 size_t max_used_transfer_buffer_usage_bytes() const { | 362 size_t max_used_transfer_buffer_usage_bytes() const { |
| 357 return max_used_transfer_buffer_usage_bytes_; | 363 return max_used_transfer_buffer_usage_bytes_; |
| 358 } | 364 } |
| 359 | 365 |
| 360 void set_test_support(TestContextSupport* test_support) { | 366 void set_test_support(TestContextSupport* test_support) { |
| 361 test_support_ = test_support; | 367 test_support_ = test_support; |
| 362 } | 368 } |
| 363 | 369 |
| 364 int width() const { return width_; } | 370 int width() const { return width_; } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 }; | 421 }; |
| 416 | 422 |
| 417 struct Namespace : public base::RefCountedThreadSafe<Namespace> { | 423 struct Namespace : public base::RefCountedThreadSafe<Namespace> { |
| 418 Namespace(); | 424 Namespace(); |
| 419 | 425 |
| 420 // Protects all fields. | 426 // Protects all fields. |
| 421 base::Lock lock; | 427 base::Lock lock; |
| 422 unsigned next_buffer_id; | 428 unsigned next_buffer_id; |
| 423 unsigned next_image_id; | 429 unsigned next_image_id; |
| 424 unsigned next_texture_id; | 430 unsigned next_texture_id; |
| 431 unsigned next_renderbuffer_id; |
| 425 base::ScopedPtrHashMap<unsigned, Buffer> buffers; | 432 base::ScopedPtrHashMap<unsigned, Buffer> buffers; |
| 426 base::hash_set<unsigned> images; | 433 base::hash_set<unsigned> images; |
| 427 OrderedTextureMap textures; | 434 OrderedTextureMap textures; |
| 435 base::hash_set<unsigned> renderbuffer_set; |
| 428 | 436 |
| 429 private: | 437 private: |
| 430 friend class base::RefCountedThreadSafe<Namespace>; | 438 friend class base::RefCountedThreadSafe<Namespace>; |
| 431 ~Namespace(); | 439 ~Namespace(); |
| 432 DISALLOW_COPY_AND_ASSIGN(Namespace); | 440 DISALLOW_COPY_AND_ASSIGN(Namespace); |
| 433 }; | 441 }; |
| 434 | 442 |
| 435 TestWebGraphicsContext3D(); | 443 TestWebGraphicsContext3D(); |
| 436 | 444 |
| 437 void CreateNamespace(); | 445 void CreateNamespace(); |
| 438 GLuint BoundTextureId(GLenum target); | 446 GLuint BoundTextureId(GLenum target); |
| 439 scoped_refptr<TestTexture> BoundTexture(GLenum target); | 447 scoped_refptr<TestTexture> BoundTexture(GLenum target); |
| 440 void CheckTextureIsBound(GLenum target); | 448 void CheckTextureIsBound(GLenum target); |
| 441 | 449 |
| 442 unsigned context_id_; | 450 unsigned context_id_; |
| 443 ContextProvider::Capabilities test_capabilities_; | 451 ContextProvider::Capabilities test_capabilities_; |
| 444 int times_bind_texture_succeeds_; | 452 int times_bind_texture_succeeds_; |
| 445 int times_end_query_succeeds_; | 453 int times_end_query_succeeds_; |
| 446 bool context_lost_; | 454 bool context_lost_; |
| 447 int times_map_buffer_chromium_succeeds_; | 455 int times_map_buffer_chromium_succeeds_; |
| 448 int current_used_transfer_buffer_usage_bytes_; | 456 int current_used_transfer_buffer_usage_bytes_; |
| 449 int max_used_transfer_buffer_usage_bytes_; | 457 int max_used_transfer_buffer_usage_bytes_; |
| 450 base::Closure context_lost_callback_; | 458 base::Closure context_lost_callback_; |
| 451 base::hash_set<unsigned> used_textures_; | 459 base::hash_set<unsigned> used_textures_; |
| 452 unsigned next_program_id_; | 460 unsigned next_program_id_; |
| 453 base::hash_set<unsigned> program_set_; | 461 base::hash_set<unsigned> program_set_; |
| 454 unsigned next_shader_id_; | 462 unsigned next_shader_id_; |
| 455 base::hash_set<unsigned> shader_set_; | 463 base::hash_set<unsigned> shader_set_; |
| 464 unsigned next_framebuffer_id_; |
| 465 base::hash_set<unsigned> framebuffer_set_; |
| 466 unsigned current_framebuffer_; |
| 456 std::vector<TestWebGraphicsContext3D*> shared_contexts_; | 467 std::vector<TestWebGraphicsContext3D*> shared_contexts_; |
| 457 int max_texture_size_; | 468 int max_texture_size_; |
| 458 bool reshape_called_; | 469 bool reshape_called_; |
| 459 int width_; | 470 int width_; |
| 460 int height_; | 471 int height_; |
| 461 float scale_factor_; | 472 float scale_factor_; |
| 462 TestContextSupport* test_support_; | 473 TestContextSupport* test_support_; |
| 463 gfx::Rect update_rect_; | 474 gfx::Rect update_rect_; |
| 464 UpdateType last_update_type_; | 475 UpdateType last_update_type_; |
| 465 unsigned next_insert_sync_point_; | 476 unsigned next_insert_sync_point_; |
| 466 unsigned last_waited_sync_point_; | 477 unsigned last_waited_sync_point_; |
| 467 int unpack_alignment_; | 478 int unpack_alignment_; |
| 468 | 479 |
| 469 unsigned bound_buffer_; | 480 unsigned bound_buffer_; |
| 470 TextureTargets texture_targets_; | 481 TextureTargets texture_targets_; |
| 471 | 482 |
| 472 scoped_refptr<Namespace> namespace_; | 483 scoped_refptr<Namespace> namespace_; |
| 473 static Namespace* shared_namespace_; | 484 static Namespace* shared_namespace_; |
| 474 | 485 |
| 475 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; | 486 base::WeakPtrFactory<TestWebGraphicsContext3D> weak_ptr_factory_; |
| 476 }; | 487 }; |
| 477 | 488 |
| 478 } // namespace cc | 489 } // namespace cc |
| 479 | 490 |
| 480 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ | 491 #endif // CC_TEST_TEST_WEB_GRAPHICS_CONTEXT_3D_H_ |
| OLD | NEW |