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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 swap_buffers_callback_(NULL), | 72 swap_buffers_callback_(NULL), |
73 next_program_id_(1000), | 73 next_program_id_(1000), |
74 next_shader_id_(2000), | 74 next_shader_id_(2000), |
75 max_texture_size_(2048), | 75 max_texture_size_(2048), |
76 reshape_called_(false), | 76 reshape_called_(false), |
77 width_(0), | 77 width_(0), |
78 height_(0), | 78 height_(0), |
79 scale_factor_(-1.f), | 79 scale_factor_(-1.f), |
80 test_support_(NULL), | 80 test_support_(NULL), |
81 last_update_type_(NoUpdate), | 81 last_update_type_(NoUpdate), |
| 82 next_insert_sync_point_(1), |
| 83 last_waited_sync_point_(0), |
82 bound_buffer_(0), | 84 bound_buffer_(0), |
83 peak_transfer_buffer_memory_used_bytes_(0), | 85 peak_transfer_buffer_memory_used_bytes_(0), |
84 weak_ptr_factory_(this) { | 86 weak_ptr_factory_(this) { |
85 CreateNamespace(); | 87 CreateNamespace(); |
86 test_capabilities_.swapbuffers_complete_callback = true; | 88 test_capabilities_.swapbuffers_complete_callback = true; |
87 } | 89 } |
88 | 90 |
89 TestWebGraphicsContext3D::~TestWebGraphicsContext3D() { | 91 TestWebGraphicsContext3D::~TestWebGraphicsContext3D() { |
90 base::AutoLock lock(g_shared_namespace_lock.Get()); | 92 base::AutoLock lock(g_shared_namespace_lock.Get()); |
91 namespace_ = NULL; | 93 namespace_ = NULL; |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 600 } |
599 return images.get(image_id)->pixels.get(); | 601 return images.get(image_id)->pixels.get(); |
600 } | 602 } |
601 | 603 |
602 void TestWebGraphicsContext3D::unmapImageCHROMIUM( | 604 void TestWebGraphicsContext3D::unmapImageCHROMIUM( |
603 blink::WGC3Duint image_id) { | 605 blink::WGC3Duint image_id) { |
604 base::AutoLock lock(namespace_->lock); | 606 base::AutoLock lock(namespace_->lock); |
605 DCHECK_GT(namespace_->images.count(image_id), 0u); | 607 DCHECK_GT(namespace_->images.count(image_id), 0u); |
606 } | 608 } |
607 | 609 |
| 610 unsigned TestWebGraphicsContext3D::insertSyncPoint() { |
| 611 return next_insert_sync_point_++; |
| 612 } |
| 613 |
| 614 void TestWebGraphicsContext3D::waitSyncPoint(unsigned sync_point) { |
| 615 if (sync_point) |
| 616 last_waited_sync_point_ = sync_point; |
| 617 } |
| 618 |
608 size_t TestWebGraphicsContext3D::NumTextures() const { | 619 size_t TestWebGraphicsContext3D::NumTextures() const { |
609 base::AutoLock lock(namespace_->lock); | 620 base::AutoLock lock(namespace_->lock); |
610 return namespace_->textures.Size(); | 621 return namespace_->textures.Size(); |
611 } | 622 } |
612 | 623 |
613 blink::WebGLId TestWebGraphicsContext3D::TextureAt(int i) const { | 624 blink::WebGLId TestWebGraphicsContext3D::TextureAt(int i) const { |
614 base::AutoLock lock(namespace_->lock); | 625 base::AutoLock lock(namespace_->lock); |
615 return namespace_->textures.IdAt(i); | 626 return namespace_->textures.IdAt(i); |
616 } | 627 } |
617 | 628 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 753 |
743 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} | 754 TestWebGraphicsContext3D::Buffer::Buffer() : target(0), size(0) {} |
744 | 755 |
745 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 756 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
746 | 757 |
747 TestWebGraphicsContext3D::Image::Image() {} | 758 TestWebGraphicsContext3D::Image::Image() {} |
748 | 759 |
749 TestWebGraphicsContext3D::Image::~Image() {} | 760 TestWebGraphicsContext3D::Image::~Image() {} |
750 | 761 |
751 } // namespace cc | 762 } // namespace cc |
OLD | NEW |