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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/output/compositor_frame_metadata.h" | 10 #include "cc/output/compositor_frame_metadata.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 using testing::_; | 33 using testing::_; |
34 using testing::AnyNumber; | 34 using testing::AnyNumber; |
35 using testing::Args; | 35 using testing::Args; |
36 using testing::AtLeast; | 36 using testing::AtLeast; |
37 using testing::ElementsAre; | 37 using testing::ElementsAre; |
38 using testing::Expectation; | 38 using testing::Expectation; |
39 using testing::InSequence; | 39 using testing::InSequence; |
40 using testing::Mock; | 40 using testing::Mock; |
41 using testing::Return; | 41 using testing::Return; |
42 using testing::StrictMock; | 42 using testing::StrictMock; |
43 using WebKit::WebGLId; | 43 using blink::WebGLId; |
44 using WebKit::WebString; | 44 using blink::WebString; |
45 using WebKit::WGC3Dbitfield; | 45 using blink::WGC3Dbitfield; |
46 using WebKit::WGC3Dboolean; | 46 using blink::WGC3Dboolean; |
47 using WebKit::WGC3Dchar; | 47 using blink::WGC3Dchar; |
48 using WebKit::WGC3Denum; | 48 using blink::WGC3Denum; |
49 using WebKit::WGC3Dfloat; | 49 using blink::WGC3Dfloat; |
50 using WebKit::WGC3Dint; | 50 using blink::WGC3Dint; |
51 using WebKit::WGC3Dintptr; | 51 using blink::WGC3Dintptr; |
52 using WebKit::WGC3Dsizei; | 52 using blink::WGC3Dsizei; |
53 using WebKit::WGC3Dsizeiptr; | 53 using blink::WGC3Dsizeiptr; |
54 using WebKit::WGC3Duint; | 54 using blink::WGC3Duint; |
55 | 55 |
56 namespace cc { | 56 namespace cc { |
57 | 57 |
58 #define EXPECT_PROGRAM_VALID(program_binding) \ | 58 #define EXPECT_PROGRAM_VALID(program_binding) \ |
59 do { \ | 59 do { \ |
60 EXPECT_TRUE((program_binding)->program()); \ | 60 EXPECT_TRUE((program_binding)->program()); \ |
61 EXPECT_TRUE((program_binding)->initialized()); \ | 61 EXPECT_TRUE((program_binding)->initialized()); \ |
62 } while (false) | 62 } while (false) |
63 | 63 |
64 // Explicitly named to be a friend in GLRenderer for shader access. | 64 // Explicitly named to be a friend in GLRenderer for shader access. |
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 static void OtherCallback(int* callback_count) { | 1714 static void OtherCallback(int* callback_count) { |
1715 ++(*callback_count); | 1715 ++(*callback_count); |
1716 base::MessageLoop::current()->QuitWhenIdle(); | 1716 base::MessageLoop::current()->QuitWhenIdle(); |
1717 } | 1717 } |
1718 }; | 1718 }; |
1719 | 1719 |
1720 #if !defined(OS_ANDROID) | 1720 #if !defined(OS_ANDROID) |
1721 TEST_F(GLRendererTestSyncPoint, SignalSyncPointOnLostContext) { | 1721 TEST_F(GLRendererTestSyncPoint, SignalSyncPointOnLostContext) { |
1722 int sync_point_callback_count = 0; | 1722 int sync_point_callback_count = 0; |
1723 int other_callback_count = 0; | 1723 int other_callback_count = 0; |
1724 WebKit::WebGraphicsContext3D* context3d = | 1724 blink::WebGraphicsContext3D* context3d = |
1725 output_surface_->context_provider()->Context3d(); | 1725 output_surface_->context_provider()->Context3d(); |
1726 gpu::ContextSupport* context_support = | 1726 gpu::ContextSupport* context_support = |
1727 output_surface_->context_provider()->ContextSupport(); | 1727 output_surface_->context_provider()->ContextSupport(); |
1728 | 1728 |
1729 uint32 sync_point = context3d->insertSyncPoint(); | 1729 uint32 sync_point = context3d->insertSyncPoint(); |
1730 | 1730 |
1731 context3d->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 1731 context3d->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
1732 GL_INNOCENT_CONTEXT_RESET_ARB); | 1732 GL_INNOCENT_CONTEXT_RESET_ARB); |
1733 | 1733 |
1734 context_support->SignalSyncPoint( | 1734 context_support->SignalSyncPoint( |
(...skipping 12 matching lines...) Expand all Loading... |
1747 | 1747 |
1748 // The sync point shouldn't have happened since the context was lost. | 1748 // The sync point shouldn't have happened since the context was lost. |
1749 EXPECT_EQ(0, sync_point_callback_count); | 1749 EXPECT_EQ(0, sync_point_callback_count); |
1750 EXPECT_EQ(1, other_callback_count); | 1750 EXPECT_EQ(1, other_callback_count); |
1751 } | 1751 } |
1752 | 1752 |
1753 TEST_F(GLRendererTestSyncPoint, SignalSyncPoint) { | 1753 TEST_F(GLRendererTestSyncPoint, SignalSyncPoint) { |
1754 int sync_point_callback_count = 0; | 1754 int sync_point_callback_count = 0; |
1755 int other_callback_count = 0; | 1755 int other_callback_count = 0; |
1756 | 1756 |
1757 WebKit::WebGraphicsContext3D* context3d = | 1757 blink::WebGraphicsContext3D* context3d = |
1758 output_surface_->context_provider()->Context3d(); | 1758 output_surface_->context_provider()->Context3d(); |
1759 gpu::ContextSupport* context_support = | 1759 gpu::ContextSupport* context_support = |
1760 output_surface_->context_provider()->ContextSupport(); | 1760 output_surface_->context_provider()->ContextSupport(); |
1761 | 1761 |
1762 uint32 sync_point = context3d->insertSyncPoint(); | 1762 uint32 sync_point = context3d->insertSyncPoint(); |
1763 | 1763 |
1764 context_support->SignalSyncPoint( | 1764 context_support->SignalSyncPoint( |
1765 sync_point, base::Bind(&SyncPointCallback, &sync_point_callback_count)); | 1765 sync_point, base::Bind(&SyncPointCallback, &sync_point_callback_count)); |
1766 EXPECT_EQ(0, sync_point_callback_count); | 1766 EXPECT_EQ(0, sync_point_callback_count); |
1767 EXPECT_EQ(0, other_callback_count); | 1767 EXPECT_EQ(0, other_callback_count); |
1768 | 1768 |
1769 // Make the sync point happen. | 1769 // Make the sync point happen. |
1770 context3d->finish(); | 1770 context3d->finish(); |
1771 // Post a task after the sync point. | 1771 // Post a task after the sync point. |
1772 base::MessageLoop::current()->PostTask( | 1772 base::MessageLoop::current()->PostTask( |
1773 FROM_HERE, | 1773 FROM_HERE, |
1774 base::Bind(&OtherCallback, &other_callback_count)); | 1774 base::Bind(&OtherCallback, &other_callback_count)); |
1775 | 1775 |
1776 base::MessageLoop::current()->Run(); | 1776 base::MessageLoop::current()->Run(); |
1777 | 1777 |
1778 // The sync point should have happened. | 1778 // The sync point should have happened. |
1779 EXPECT_EQ(1, sync_point_callback_count); | 1779 EXPECT_EQ(1, sync_point_callback_count); |
1780 EXPECT_EQ(1, other_callback_count); | 1780 EXPECT_EQ(1, other_callback_count); |
1781 } | 1781 } |
1782 #endif // OS_ANDROID | 1782 #endif // OS_ANDROID |
1783 | 1783 |
1784 } // namespace | 1784 } // namespace |
1785 } // namespace cc | 1785 } // namespace cc |
OLD | NEW |