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