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/test/fake_layer_tree_host_client.h" | 5 #include "cc/test/fake_layer_tree_host_client.h" |
6 | 6 |
| 7 #include "cc/test/test_web_graphics_context_3d.h" |
| 8 #include "ui/gl/context_provider.h" |
| 9 |
7 namespace cc { | 10 namespace cc { |
8 | 11 |
| 12 FakeLayerImplTreeHostClient::FakeLayerImplTreeHostClient(bool useSoftwareRenderi
ng, bool useDelegatingRenderer) |
| 13 : m_useSoftwareRendering(useSoftwareRendering) |
| 14 , m_useDelegatingRenderer(useDelegatingRenderer) |
| 15 { |
| 16 } |
| 17 |
| 18 FakeLayerImplTreeHostClient::~FakeLayerImplTreeHostClient() { } |
| 19 |
9 scoped_ptr<OutputSurface> FakeLayerImplTreeHostClient::createOutputSurface() | 20 scoped_ptr<OutputSurface> FakeLayerImplTreeHostClient::createOutputSurface() |
10 { | 21 { |
11 if (m_useSoftwareRendering) { | 22 if (m_useSoftwareRendering) { |
12 if (m_useDelegatingRenderer) | 23 if (m_useDelegatingRenderer) |
13 return FakeOutputSurface::CreateDelegatingSoftware(make_scoped_ptr(n
ew FakeSoftwareOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurfac
e>(); | 24 return FakeOutputSurface::CreateDelegatingSoftware(make_scoped_ptr(n
ew FakeSoftwareOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurfac
e>(); |
14 | 25 |
15 return FakeOutputSurface::CreateSoftware(make_scoped_ptr(new FakeSoftwar
eOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurface>(); | 26 return FakeOutputSurface::CreateSoftware(make_scoped_ptr(new FakeSoftwar
eOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurface>(); |
16 } | 27 } |
17 | 28 |
18 WebKit::WebGraphicsContext3D::Attributes attrs; | 29 WebKit::WebGraphicsContext3D::Attributes attrs; |
19 if (m_useDelegatingRenderer) | 30 if (m_useDelegatingRenderer) |
20 return FakeOutputSurface::CreateDelegating3d(TestWebGraphicsContext3D::C
reate(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 31 return FakeOutputSurface::CreateDelegating3d(TestWebGraphicsContext3D::C
reate(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
21 | 32 |
22 return FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create(attrs).P
assAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 33 return FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create(attrs).P
assAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
23 } | 34 } |
24 | 35 |
25 scoped_ptr<InputHandler> FakeLayerImplTreeHostClient::createInputHandler() | 36 scoped_ptr<InputHandler> FakeLayerImplTreeHostClient::createInputHandler() |
26 { | 37 { |
27 return scoped_ptr<InputHandler>(); | 38 return scoped_ptr<InputHandler>(); |
28 } | 39 } |
29 | 40 |
| 41 scoped_refptr<ui::ContextProvider> FakeLayerImplTreeHostClient::OffscreenContext
ProviderForMainThread() { |
| 42 if (!m_mainThreadContexts || m_mainThreadContexts->destroyed()) |
| 43 m_mainThreadContexts = new FakeContextProvider; |
| 44 return m_mainThreadContexts; |
| 45 } |
| 46 |
| 47 scoped_refptr<ui::ContextProvider> FakeLayerImplTreeHostClient::OffscreenContext
ProviderForCompositorThread() { |
| 48 if (!m_compositorThreadContexts || m_compositorThreadContexts->destroyed()) |
| 49 m_compositorThreadContexts = new FakeContextProvider; |
| 50 return m_compositorThreadContexts; |
| 51 } |
| 52 |
30 } // namespace cc | 53 } // namespace cc |
OLD | NEW |