OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3038 } | 3038 } |
3039 | 3039 |
3040 virtual void BeginTest() OVERRIDE { | 3040 virtual void BeginTest() OVERRIDE { |
3041 did_initialize_gl_ = false; | 3041 did_initialize_gl_ = false; |
3042 did_release_gl_ = false; | 3042 did_release_gl_ = false; |
3043 PostSetNeedsCommitToMainThread(); | 3043 PostSetNeedsCommitToMainThread(); |
3044 } | 3044 } |
3045 | 3045 |
3046 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { | 3046 virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE { |
3047 scoped_ptr<TestWebGraphicsContext3D> context3d( | 3047 scoped_ptr<TestWebGraphicsContext3D> context3d( |
3048 TestWebGraphicsContext3D::Create()); | 3048 TestWebGraphicsContext3D::CreateShared()); |
3049 context3d->set_support_swapbuffers_complete_callback(false); | 3049 context3d->set_support_swapbuffers_complete_callback(false); |
3050 | 3050 |
3051 return FakeOutputSurface::CreateDeferredGL( | 3051 return FakeOutputSurface::CreateDeferredGL( |
3052 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)) | 3052 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice)) |
3053 .PassAs<OutputSurface>(); | 3053 .PassAs<OutputSurface>(); |
3054 } | 3054 } |
3055 | 3055 |
3056 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { | 3056 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { |
3057 ASSERT_TRUE(host_impl->RootLayer()); | 3057 ASSERT_TRUE(host_impl->RootLayer()); |
3058 FakePictureLayerImpl* layer_impl = | 3058 FakePictureLayerImpl* layer_impl = |
(...skipping 19 matching lines...) Expand all Loading... |
3078 EndTest(); | 3078 EndTest(); |
3079 } | 3079 } |
3080 } | 3080 } |
3081 | 3081 |
3082 void DeferredInitializeAndRedraw(LayerTreeHostImpl* host_impl) { | 3082 void DeferredInitializeAndRedraw(LayerTreeHostImpl* host_impl) { |
3083 EXPECT_FALSE(did_initialize_gl_); | 3083 EXPECT_FALSE(did_initialize_gl_); |
3084 // SetAndInitializeContext3D calls SetNeedsCommit. | 3084 // SetAndInitializeContext3D calls SetNeedsCommit. |
3085 EXPECT_TRUE(static_cast<FakeOutputSurface*>(host_impl->output_surface()) | 3085 EXPECT_TRUE(static_cast<FakeOutputSurface*>(host_impl->output_surface()) |
3086 ->SetAndInitializeContext3D( | 3086 ->SetAndInitializeContext3D( |
3087 scoped_ptr<WebKit::WebGraphicsContext3D>( | 3087 scoped_ptr<WebKit::WebGraphicsContext3D>( |
3088 TestWebGraphicsContext3D::Create()))); | 3088 TestWebGraphicsContext3D::CreateShared()))); |
3089 did_initialize_gl_ = true; | 3089 did_initialize_gl_ = true; |
3090 } | 3090 } |
3091 | 3091 |
3092 void ReleaseGLAndRedraw(LayerTreeHostImpl* host_impl) { | 3092 void ReleaseGLAndRedraw(LayerTreeHostImpl* host_impl) { |
3093 EXPECT_TRUE(did_initialize_gl_); | 3093 EXPECT_TRUE(did_initialize_gl_); |
3094 EXPECT_FALSE(did_release_gl_); | 3094 EXPECT_FALSE(did_release_gl_); |
3095 // ReleaseGL calls SetNeedsCommit. | 3095 // ReleaseGL calls SetNeedsCommit. |
3096 static_cast<FakeOutputSurface*>(host_impl->output_surface())->ReleaseGL(); | 3096 static_cast<FakeOutputSurface*>(host_impl->output_surface())->ReleaseGL(); |
3097 did_release_gl_ = true; | 3097 did_release_gl_ = true; |
3098 } | 3098 } |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3817 break; | 3817 break; |
3818 } | 3818 } |
3819 } | 3819 } |
3820 }; | 3820 }; |
3821 | 3821 |
3822 MULTI_THREAD_TEST_F( | 3822 MULTI_THREAD_TEST_F( |
3823 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); | 3823 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); |
3824 | 3824 |
3825 } // namespace | 3825 } // namespace |
3826 } // namespace cc | 3826 } // namespace cc |
OLD | NEW |