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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
8 | 8 |
9 #include "CCGraphicsContext.h" | 9 #include "CCGraphicsContext.h" |
10 #include "CCLayerTreeHostImpl.h" | 10 #include "CCLayerTreeHostImpl.h" |
11 #include "CCSettings.h" | 11 #include "CCSettings.h" |
12 #include "CCSingleThreadProxy.h" | 12 #include "CCSingleThreadProxy.h" |
13 #include "CCTextureUpdateQueue.h" | 13 #include "CCTextureUpdateQueue.h" |
14 #include "CCThreadedTest.h" | 14 #include "CCThreadedTest.h" |
15 #include "CCTimingFunction.h" | 15 #include "CCTimingFunction.h" |
16 #include "Extensions3DChromium.h" | |
17 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
18 #include "cc/content_layer.h" | 17 #include "cc/content_layer.h" |
19 #include "cc/content_layer_client.h" | 18 #include "cc/content_layer_client.h" |
20 #include "cc/test/fake_web_compositor_output_surface.h" | 19 #include "cc/test/fake_web_compositor_output_surface.h" |
21 #include "cc/test/geometry_test_utils.h" | 20 #include "cc/test/geometry_test_utils.h" |
22 #include "cc/test/occlusion_tracker_test_common.h" | 21 #include "cc/test/occlusion_tracker_test_common.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 23 #include "third_party/khronos/GLES2/gl2.h" |
| 24 #include "third_party/khronos/GLES2/gl2ext.h" |
24 #include <public/Platform.h> | 25 #include <public/Platform.h> |
25 #include <public/WebLayerScrollClient.h> | 26 #include <public/WebLayerScrollClient.h> |
26 #include <public/WebSize.h> | 27 #include <public/WebSize.h> |
27 | 28 |
28 using namespace cc; | 29 using namespace cc; |
29 using namespace WebKit; | 30 using namespace WebKit; |
30 using namespace WebKitTests; | 31 using namespace WebKitTests; |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
(...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 | 2413 |
2413 private: | 2414 private: |
2414 EvictionTestLayer() : LayerChromium() { } | 2415 EvictionTestLayer() : LayerChromium() { } |
2415 virtual ~EvictionTestLayer() { } | 2416 virtual ~EvictionTestLayer() { } |
2416 | 2417 |
2417 void createTextureIfNeeded() | 2418 void createTextureIfNeeded() |
2418 { | 2419 { |
2419 if (m_texture.get()) | 2420 if (m_texture.get()) |
2420 return; | 2421 return; |
2421 m_texture = CCPrioritizedTexture::create(layerTreeHost()->contentsTextur
eManager()); | 2422 m_texture = CCPrioritizedTexture::create(layerTreeHost()->contentsTextur
eManager()); |
2422 m_texture->setDimensions(IntSize(10, 10), cc::GraphicsContext3D::RGBA); | 2423 m_texture->setDimensions(IntSize(10, 10), GL_RGBA); |
2423 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); | 2424 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); |
2424 } | 2425 } |
2425 | 2426 |
2426 scoped_ptr<CCPrioritizedTexture> m_texture; | 2427 scoped_ptr<CCPrioritizedTexture> m_texture; |
2427 SkBitmap m_bitmap; | 2428 SkBitmap m_bitmap; |
2428 }; | 2429 }; |
2429 | 2430 |
2430 class EvictionTestLayerImpl : public CCLayerImpl { | 2431 class EvictionTestLayerImpl : public CCLayerImpl { |
2431 public: | 2432 public: |
2432 static scoped_ptr<EvictionTestLayerImpl> create(int id) | 2433 static scoped_ptr<EvictionTestLayerImpl> create(int id) |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public
WebKit::CompositorFakeWebGraphicsContext3D { | 2719 class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public
WebKit::CompositorFakeWebGraphicsContext3D { |
2719 public: | 2720 public: |
2720 static scoped_ptr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC
ontext> create(Attributes attrs) | 2721 static scoped_ptr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostC
ontext> create(Attributes attrs) |
2721 { | 2722 { |
2722 return make_scoped_ptr(new CompositorFakeWebGraphicsContext3DWithEndQuer
yCausingLostContext(attrs)); | 2723 return make_scoped_ptr(new CompositorFakeWebGraphicsContext3DWithEndQuer
yCausingLostContext(attrs)); |
2723 } | 2724 } |
2724 | 2725 |
2725 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback
) { m_contextLostCallback = callback; } | 2726 virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback
) { m_contextLostCallback = callback; } |
2726 virtual bool isContextLost() { return m_isContextLost; } | 2727 virtual bool isContextLost() { return m_isContextLost; } |
2727 | 2728 |
2728 virtual void beginQueryEXT(GC3Denum, WebGLId) { } | 2729 virtual void beginQueryEXT(WGC3Denum, WebGLId) { } |
2729 virtual void endQueryEXT(GC3Denum) | 2730 virtual void endQueryEXT(WGC3Denum) |
2730 { | 2731 { |
2731 // Lose context. | 2732 // Lose context. |
2732 if (!m_isContextLost) { | 2733 if (!m_isContextLost) { |
2733 m_contextLostCallback->onContextLost(); | 2734 m_contextLostCallback->onContextLost(); |
2734 m_isContextLost = true; | 2735 m_isContextLost = true; |
2735 } | 2736 } |
2736 } | 2737 } |
2737 virtual void getQueryObjectuivEXT(WebGLId, GC3Denum pname, GC3Duint* params) | 2738 virtual void getQueryObjectuivEXT(WebGLId, WGC3Denum pname, WGC3Duint* param
s) |
2738 { | 2739 { |
2739 // Context is lost. We need to behave as if result is available. | 2740 // Context is lost. We need to behave as if result is available. |
2740 if (pname == Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT) | 2741 if (pname == GL_QUERY_RESULT_AVAILABLE_EXT) |
2741 *params = 1; | 2742 *params = 1; |
2742 } | 2743 } |
2743 | 2744 |
2744 private: | 2745 private: |
2745 explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(At
tributes attrs) | 2746 explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(At
tributes attrs) |
2746 : CompositorFakeWebGraphicsContext3D(attrs) | 2747 : CompositorFakeWebGraphicsContext3D(attrs) |
2747 , m_contextLostCallback(0) | 2748 , m_contextLostCallback(0) |
2748 , m_isContextLost(false) { } | 2749 , m_isContextLost(false) { } |
2749 | 2750 |
2750 WebGraphicsContextLostCallback* m_contextLostCallback; | 2751 WebGraphicsContextLostCallback* m_contextLostCallback; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2968 int m_numCommitComplete; | 2969 int m_numCommitComplete; |
2969 int m_numDrawLayers; | 2970 int m_numDrawLayers; |
2970 }; | 2971 }; |
2971 | 2972 |
2972 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) | 2973 TEST_F(CCLayerTreeHostTestContinuousAnimate, runMultiThread) |
2973 { | 2974 { |
2974 runTest(true); | 2975 runTest(true); |
2975 } | 2976 } |
2976 | 2977 |
2977 } // namespace | 2978 } // namespace |
OLD | NEW |