Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: cc/layers/texture_layer_unittest.cc

Issue 19267016: Add a flag to allow renderer to use software compositor when GL compositor doesn't work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 : public LayerTreeTest, 758 : public LayerTreeTest,
759 public TextureLayerClient { 759 public TextureLayerClient {
760 public: 760 public:
761 TextureLayerClientTest() 761 TextureLayerClientTest()
762 : context_(NULL), 762 : context_(NULL),
763 texture_(0), 763 texture_(0),
764 commit_count_(0), 764 commit_count_(0),
765 expected_used_textures_on_draw_(0), 765 expected_used_textures_on_draw_(0),
766 expected_used_textures_on_commit_(0) {} 766 expected_used_textures_on_commit_(0) {}
767 767
768 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { 768 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
769 OVERRIDE {
769 scoped_ptr<TestWebGraphicsContext3D> context( 770 scoped_ptr<TestWebGraphicsContext3D> context(
770 TestWebGraphicsContext3D::Create()); 771 TestWebGraphicsContext3D::Create());
771 context_ = context.get(); 772 context_ = context.get();
772 texture_ = context->createTexture(); 773 texture_ = context->createTexture();
773 return FakeOutputSurface::Create3d( 774 return FakeOutputSurface::Create3d(
774 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); 775 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
775 } 776 }
776 777
777 virtual unsigned PrepareTexture() OVERRIDE { 778 virtual unsigned PrepareTexture() OVERRIDE {
778 return texture_; 779 return texture_;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 873
873 // Test recovering from a lost context. 874 // Test recovering from a lost context.
874 class TextureLayerLostContextTest 875 class TextureLayerLostContextTest
875 : public LayerTreeTest, 876 : public LayerTreeTest,
876 public TextureLayerClient { 877 public TextureLayerClient {
877 public: 878 public:
878 TextureLayerLostContextTest() 879 TextureLayerLostContextTest()
879 : texture_(0), 880 : texture_(0),
880 draw_count_(0) {} 881 draw_count_(0) {}
881 882
882 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { 883 virtual scoped_ptr<OutputSurface> CreateOutputSurface(bool fallback)
884 OVERRIDE {
883 texture_context_ = TestWebGraphicsContext3D::Create(); 885 texture_context_ = TestWebGraphicsContext3D::Create();
884 texture_ = texture_context_->createTexture(); 886 texture_ = texture_context_->createTexture();
885 return CreateFakeOutputSurface(); 887 return CreateFakeOutputSurface();
886 } 888 }
887 889
888 virtual unsigned PrepareTexture() OVERRIDE { 890 virtual unsigned PrepareTexture() OVERRIDE {
889 if (draw_count_ == 0) { 891 if (draw_count_ == 0) {
890 texture_context_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 892 texture_context_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
891 GL_INNOCENT_CONTEXT_RESET_ARB); 893 GL_INNOCENT_CONTEXT_RESET_ARB);
892 } 894 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 scoped_refptr<TextureLayer> texture_layer_; 945 scoped_refptr<TextureLayer> texture_layer_;
944 scoped_ptr<TestWebGraphicsContext3D> texture_context_; 946 scoped_ptr<TestWebGraphicsContext3D> texture_context_;
945 unsigned texture_; 947 unsigned texture_;
946 int draw_count_; 948 int draw_count_;
947 }; 949 };
948 950
949 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest); 951 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest);
950 952
951 } // namespace 953 } // namespace
952 } // namespace cc 954 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/delegating_renderer_unittest.cc » ('j') | cc/trees/layer_tree_host_unittest_context.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698