Chromium Code Reviews| 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/debug/test_web_graphics_context_3d.h" | 5 #include "cc/debug/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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 times_gen_mailbox_succeeds_(-1), | 67 times_gen_mailbox_succeeds_(-1), |
| 68 context_lost_(false), | 68 context_lost_(false), |
| 69 times_map_image_chromium_succeeds_(-1), | 69 times_map_image_chromium_succeeds_(-1), |
| 70 times_map_buffer_chromium_succeeds_(-1), | 70 times_map_buffer_chromium_succeeds_(-1), |
| 71 context_lost_callback_(NULL), | 71 context_lost_callback_(NULL), |
| 72 swap_buffers_callback_(NULL), | 72 swap_buffers_callback_(NULL), |
| 73 max_texture_size_(2048), | 73 max_texture_size_(2048), |
| 74 width_(0), | 74 width_(0), |
| 75 height_(0), | 75 height_(0), |
| 76 bound_buffer_(0), | 76 bound_buffer_(0), |
| 77 weak_ptr_factory_(this) { | 77 weak_ptr_factory_(this), |
| 78 transfer_buffer_memory_used_bytes_(0) { | |
| 78 CreateNamespace(); | 79 CreateNamespace(); |
| 79 test_capabilities_.swapbuffers_complete_callback = true; | 80 test_capabilities_.swapbuffers_complete_callback = true; |
| 80 } | 81 } |
| 81 | 82 |
| 82 TestWebGraphicsContext3D::TestWebGraphicsContext3D( | 83 TestWebGraphicsContext3D::TestWebGraphicsContext3D( |
| 83 const WebGraphicsContext3D::Attributes& attributes) | 84 const WebGraphicsContext3D::Attributes& attributes) |
| 84 : FakeWebGraphicsContext3D(), | 85 : FakeWebGraphicsContext3D(), |
| 85 context_id_(s_context_id++), | 86 context_id_(s_context_id++), |
| 86 attributes_(attributes), | 87 attributes_(attributes), |
| 87 times_make_current_succeeds_(-1), | 88 times_make_current_succeeds_(-1), |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 const void* data, | 479 const void* data, |
| 479 WebKit::WGC3Denum usage) { | 480 WebKit::WGC3Denum usage) { |
| 480 base::AutoLock lock(namespace_->lock); | 481 base::AutoLock lock(namespace_->lock); |
| 481 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; | 482 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; |
| 482 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 483 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
| 483 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); | 484 DCHECK_EQ(target, buffers.get(bound_buffer_)->target); |
| 484 if (context_lost_) { | 485 if (context_lost_) { |
| 485 buffers.get(bound_buffer_)->pixels.reset(); | 486 buffers.get(bound_buffer_)->pixels.reset(); |
| 486 return; | 487 return; |
| 487 } | 488 } |
| 489 if (target == GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM) | |
| 490 transfer_buffer_memory_used_bytes_ += size; | |
|
reveman
2013/09/06 22:28:27
This is not going to do the right thing if the buf
kaanb
2013/09/07 01:30:31
Done. After this change the number returned by Get
| |
| 491 | |
| 488 buffers.get(bound_buffer_)->pixels.reset(new uint8[size]); | 492 buffers.get(bound_buffer_)->pixels.reset(new uint8[size]); |
| 489 if (data != NULL) | 493 if (data != NULL) |
| 490 memcpy(buffers.get(bound_buffer_)->pixels.get(), data, size); | 494 memcpy(buffers.get(bound_buffer_)->pixels.get(), data, size); |
| 491 } | 495 } |
| 492 | 496 |
| 493 void* TestWebGraphicsContext3D::mapBufferCHROMIUM(WebKit::WGC3Denum target, | 497 void* TestWebGraphicsContext3D::mapBufferCHROMIUM(WebKit::WGC3Denum target, |
| 494 WebKit::WGC3Denum access) { | 498 WebKit::WGC3Denum access) { |
| 495 base::AutoLock lock(namespace_->lock); | 499 base::AutoLock lock(namespace_->lock); |
| 496 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; | 500 base::ScopedPtrHashMap<unsigned, Buffer>& buffers = namespace_->buffers; |
| 497 DCHECK_GT(buffers.count(bound_buffer_), 0u); | 501 DCHECK_GT(buffers.count(bound_buffer_), 0u); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 | 606 |
| 603 TestWebGraphicsContext3D::Buffer::Buffer() : target(0) {} | 607 TestWebGraphicsContext3D::Buffer::Buffer() : target(0) {} |
| 604 | 608 |
| 605 TestWebGraphicsContext3D::Buffer::~Buffer() {} | 609 TestWebGraphicsContext3D::Buffer::~Buffer() {} |
| 606 | 610 |
| 607 TestWebGraphicsContext3D::Image::Image() {} | 611 TestWebGraphicsContext3D::Image::Image() {} |
| 608 | 612 |
| 609 TestWebGraphicsContext3D::Image::~Image() {} | 613 TestWebGraphicsContext3D::Image::~Image() {} |
| 610 | 614 |
| 611 } // namespace cc | 615 } // namespace cc |
| OLD | NEW |