| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/gpu/DrawingBuffer.h" | 5 #include "platform/graphics/gpu/DrawingBuffer.h" |
| 6 | 6 |
| 7 #include "cc/resources/single_release_callback.h" | 7 #include "cc/resources/single_release_callback.h" |
| 8 #include "cc/resources/texture_mailbox.h" | 8 #include "cc/resources/texture_mailbox.h" |
| 9 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 9 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
| 10 #include "platform/graphics/gpu/DrawingBufferTestHelpers.h" | 10 #include "platform/graphics/gpu/DrawingBufferTestHelpers.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 protected: | 47 protected: |
| 48 void SetUp() override { | 48 void SetUp() override { |
| 49 IntSize initial_size(kInitialWidth, kInitialHeight); | 49 IntSize initial_size(kInitialWidth, kInitialHeight); |
| 50 std::unique_ptr<GLES2InterfaceForTests> gl = | 50 std::unique_ptr<GLES2InterfaceForTests> gl = |
| 51 WTF::WrapUnique(new GLES2InterfaceForTests); | 51 WTF::WrapUnique(new GLES2InterfaceForTests); |
| 52 std::unique_ptr<WebGraphicsContext3DProviderSoftwareRenderingForTests> | 52 std::unique_ptr<WebGraphicsContext3DProviderSoftwareRenderingForTests> |
| 53 provider = WTF::WrapUnique( | 53 provider = WTF::WrapUnique( |
| 54 new WebGraphicsContext3DProviderSoftwareRenderingForTests( | 54 new WebGraphicsContext3DProviderSoftwareRenderingForTests( |
| 55 std::move(gl))); | 55 std::move(gl))); |
| 56 drawing_buffer_ = DrawingBufferForTests::Create( | 56 drawing_buffer_ = DrawingBufferForTests::Create( |
| 57 std::move(provider), nullptr, initial_size, DrawingBuffer::kPreserve); | 57 std::move(provider), nullptr, initial_size, DrawingBuffer::kPreserve, |
| 58 kDisableMultisampling); |
| 58 CHECK(drawing_buffer_); | 59 CHECK(drawing_buffer_); |
| 59 } | 60 } |
| 60 | 61 |
| 61 RefPtr<DrawingBufferForTests> drawing_buffer_; | 62 RefPtr<DrawingBufferForTests> drawing_buffer_; |
| 62 bool is_software_rendering_ = false; | 63 bool is_software_rendering_ = false; |
| 63 }; | 64 }; |
| 64 | 65 |
| 65 TEST_F(DrawingBufferSoftwareRenderingTest, bitmapRecycling) { | 66 TEST_F(DrawingBufferSoftwareRenderingTest, bitmapRecycling) { |
| 66 cc::TextureMailbox texture_mailbox; | 67 cc::TextureMailbox texture_mailbox; |
| 67 std::unique_ptr<cc::SingleReleaseCallback> release_callback1; | 68 std::unique_ptr<cc::SingleReleaseCallback> release_callback1; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 95 &release_callback3); // cause recycling queue to be purged due to resize | 96 &release_callback3); // cause recycling queue to be purged due to resize |
| 96 EXPECT_EQ(0, drawing_buffer_->RecycledBitmapCount()); | 97 EXPECT_EQ(0, drawing_buffer_->RecycledBitmapCount()); |
| 97 release_callback3->Run(gpu::SyncToken(), false /* lostResource */); | 98 release_callback3->Run(gpu::SyncToken(), false /* lostResource */); |
| 98 EXPECT_EQ(1, drawing_buffer_->RecycledBitmapCount()); | 99 EXPECT_EQ(1, drawing_buffer_->RecycledBitmapCount()); |
| 99 | 100 |
| 100 drawing_buffer_->BeginDestruction(); | 101 drawing_buffer_->BeginDestruction(); |
| 101 } | 102 } |
| 102 | 103 |
| 103 } // unnamed namespace | 104 } // unnamed namespace |
| 104 } // blink | 105 } // blink |
| OLD | NEW |