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 #include "cc/test/test_web_graphics_context_3d.h" | 5 #include "cc/test/test_web_graphics_context_3d.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 return texture_targets_.BoundTexture(target); | 329 return texture_targets_.BoundTexture(target); |
330 } | 330 } |
331 | 331 |
332 scoped_refptr<TestTexture> TestWebGraphicsContext3D::BoundTexture( | 332 scoped_refptr<TestTexture> TestWebGraphicsContext3D::BoundTexture( |
333 GLenum target) { | 333 GLenum target) { |
334 // The caller is expected to lock the namespace for texture access. | 334 // The caller is expected to lock the namespace for texture access. |
335 namespace_->lock.AssertAcquired(); | 335 namespace_->lock.AssertAcquired(); |
336 return namespace_->textures.TextureForId(BoundTextureId(target)); | 336 return namespace_->textures.TextureForId(BoundTextureId(target)); |
337 } | 337 } |
338 | 338 |
| 339 scoped_refptr<TestTexture> TestWebGraphicsContext3D::UnboundTexture( |
| 340 GLuint texture) { |
| 341 // The caller is expected to lock the namespace for texture access. |
| 342 namespace_->lock.AssertAcquired(); |
| 343 return namespace_->textures.TextureForId(texture); |
| 344 } |
| 345 |
339 void TestWebGraphicsContext3D::CheckTextureIsBound(GLenum target) { | 346 void TestWebGraphicsContext3D::CheckTextureIsBound(GLenum target) { |
340 DCHECK(BoundTextureId(target)); | 347 DCHECK(BoundTextureId(target)); |
341 } | 348 } |
342 | 349 |
343 GLuint TestWebGraphicsContext3D::createQueryEXT() { return 1u; } | 350 GLuint TestWebGraphicsContext3D::createQueryEXT() { return 1u; } |
344 | 351 |
345 void TestWebGraphicsContext3D::endQueryEXT(GLenum target) { | 352 void TestWebGraphicsContext3D::endQueryEXT(GLenum target) { |
346 if (times_end_query_succeeds_ >= 0) { | 353 if (times_end_query_succeeds_ >= 0) { |
347 if (!times_end_query_succeeds_) { | 354 if (!times_end_query_succeeds_) { |
348 loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 355 loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 mailbox[2] = '\0'; | 444 mailbox[2] = '\0'; |
438 if (++mailbox_name1 == 0) { | 445 if (++mailbox_name1 == 0) { |
439 mailbox_name1 = '1'; | 446 mailbox_name1 = '1'; |
440 ++mailbox_name2; | 447 ++mailbox_name2; |
441 } | 448 } |
442 } | 449 } |
443 | 450 |
444 GLuint TestWebGraphicsContext3D::createAndConsumeTextureCHROMIUM( | 451 GLuint TestWebGraphicsContext3D::createAndConsumeTextureCHROMIUM( |
445 GLenum target, | 452 GLenum target, |
446 const GLbyte* mailbox) { | 453 const GLbyte* mailbox) { |
447 return createTexture(); | 454 GLuint texture_id = createTexture(); |
| 455 consumeTextureCHROMIUM(target, mailbox); |
| 456 return texture_id; |
448 } | 457 } |
449 | 458 |
450 void TestWebGraphicsContext3D::loseContextCHROMIUM(GLenum current, | 459 void TestWebGraphicsContext3D::loseContextCHROMIUM(GLenum current, |
451 GLenum other) { | 460 GLenum other) { |
452 if (context_lost_) | 461 if (context_lost_) |
453 return; | 462 return; |
454 context_lost_ = true; | 463 context_lost_ = true; |
455 if (!context_lost_callback_.is_null()) | 464 if (!context_lost_callback_.is_null()) |
456 context_lost_callback_.Run(); | 465 context_lost_callback_.Run(); |
457 | 466 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 747 |
739 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} | 748 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} |
740 | 749 |
741 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 750 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
742 | 751 |
743 TestWebGraphicsContext3D::Image::Image() {} | 752 TestWebGraphicsContext3D::Image::Image() {} |
744 | 753 |
745 TestWebGraphicsContext3D::Image::~Image() {} | 754 TestWebGraphicsContext3D::Image::~Image() {} |
746 | 755 |
747 } // namespace cc | 756 } // namespace cc |
OLD | NEW |