| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/texture_layer.h" | 5 #include "cc/layers/texture_layer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "cc/layers/texture_layer_client.h" | 10 #include "cc/layers/texture_layer_client.h" |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 : public LayerTreeTest, | 786 : public LayerTreeTest, |
| 787 public TextureLayerClient { | 787 public TextureLayerClient { |
| 788 public: | 788 public: |
| 789 TextureLayerClientTest() | 789 TextureLayerClientTest() |
| 790 : context_(NULL), | 790 : context_(NULL), |
| 791 texture_(0), | 791 texture_(0), |
| 792 commit_count_(0), | 792 commit_count_(0), |
| 793 expected_used_textures_on_draw_(0), | 793 expected_used_textures_on_draw_(0), |
| 794 expected_used_textures_on_commit_(0) {} | 794 expected_used_textures_on_commit_(0) {} |
| 795 | 795 |
| 796 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 796 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 797 OVERRIDE { |
| 797 scoped_ptr<TestWebGraphicsContext3D> context( | 798 scoped_ptr<TestWebGraphicsContext3D> context( |
| 798 TestWebGraphicsContext3D::Create()); | 799 TestWebGraphicsContext3D::Create()); |
| 799 context_ = context.get(); | 800 context_ = context.get(); |
| 800 texture_ = context->createTexture(); | 801 texture_ = context->createTexture(); |
| 801 return FakeOutputSurface::Create3d( | 802 return FakeOutputSurface::Create3d( |
| 802 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 803 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
| 803 } | 804 } |
| 804 | 805 |
| 805 virtual unsigned PrepareTexture() OVERRIDE { | 806 virtual unsigned PrepareTexture() OVERRIDE { |
| 806 return texture_; | 807 return texture_; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 | 901 |
| 901 // Test recovering from a lost context. | 902 // Test recovering from a lost context. |
| 902 class TextureLayerLostContextTest | 903 class TextureLayerLostContextTest |
| 903 : public LayerTreeTest, | 904 : public LayerTreeTest, |
| 904 public TextureLayerClient { | 905 public TextureLayerClient { |
| 905 public: | 906 public: |
| 906 TextureLayerLostContextTest() | 907 TextureLayerLostContextTest() |
| 907 : texture_(0), | 908 : texture_(0), |
| 908 draw_count_(0) {} | 909 draw_count_(0) {} |
| 909 | 910 |
| 910 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 911 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback) |
| 912 OVERRIDE { |
| 911 texture_context_ = TestWebGraphicsContext3D::Create(); | 913 texture_context_ = TestWebGraphicsContext3D::Create(); |
| 912 texture_ = texture_context_->createTexture(); | 914 texture_ = texture_context_->createTexture(); |
| 913 return CreateFakeOutputSurface(); | 915 return CreateFakeOutputSurface(); |
| 914 } | 916 } |
| 915 | 917 |
| 916 virtual unsigned PrepareTexture() OVERRIDE { | 918 virtual unsigned PrepareTexture() OVERRIDE { |
| 917 if (draw_count_ == 0) { | 919 if (draw_count_ == 0) { |
| 918 texture_context_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 920 texture_context_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 919 GL_INNOCENT_CONTEXT_RESET_ARB); | 921 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 920 } | 922 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 int callback_count_; | 1112 int callback_count_; |
| 1111 scoped_refptr<Layer> root_; | 1113 scoped_refptr<Layer> root_; |
| 1112 scoped_refptr<TextureLayer> layer_; | 1114 scoped_refptr<TextureLayer> layer_; |
| 1113 }; | 1115 }; |
| 1114 | 1116 |
| 1115 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( | 1117 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( |
| 1116 TextureLayerWithMailboxImplThreadDeleted); | 1118 TextureLayerWithMailboxImplThreadDeleted); |
| 1117 | 1119 |
| 1118 } // namespace | 1120 } // namespace |
| 1119 } // namespace cc | 1121 } // namespace cc |
| OLD | NEW |