blob: a3251bb4c6c8e75c88f0a747405439a2d7cd3b1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/test/fake_layer_tree_host_client.h"
#include "cc/context_provider.h"
#include "cc/test/test_web_graphics_context_3d.h"
namespace cc {
FakeLayerImplTreeHostClient::FakeLayerImplTreeHostClient(bool useSoftwareRendering, bool useDelegatingRenderer)
: m_useSoftwareRendering(useSoftwareRendering)
, m_useDelegatingRenderer(useDelegatingRenderer)
{
}
FakeLayerImplTreeHostClient::~FakeLayerImplTreeHostClient() { }
scoped_ptr<OutputSurface> FakeLayerImplTreeHostClient::createOutputSurface()
{
if (m_useSoftwareRendering) {
if (m_useDelegatingRenderer)
return FakeOutputSurface::CreateDelegatingSoftware(make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>();
return FakeOutputSurface::CreateSoftware(make_scoped_ptr(new SoftwareOutputDevice)).PassAs<OutputSurface>();
}
WebKit::WebGraphicsContext3D::Attributes attrs;
if (m_useDelegatingRenderer)
return FakeOutputSurface::CreateDelegating3d(TestWebGraphicsContext3D::Create(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
return FakeOutputSurface::Create3d(TestWebGraphicsContext3D::Create(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
}
scoped_ptr<InputHandler> FakeLayerImplTreeHostClient::createInputHandler()
{
return scoped_ptr<InputHandler>();
}
scoped_refptr<cc::ContextProvider> FakeLayerImplTreeHostClient::OffscreenContextProviderForMainThread() {
if (!m_mainThreadContexts || m_mainThreadContexts->DestroyedOnMainThread()) {
m_mainThreadContexts = FakeContextProvider::Create();
if (!m_mainThreadContexts->BindToCurrentThread())
m_mainThreadContexts = NULL;
}
return m_mainThreadContexts;
}
scoped_refptr<cc::ContextProvider> FakeLayerImplTreeHostClient::OffscreenContextProviderForCompositorThread() {
if (!m_compositorThreadContexts || m_compositorThreadContexts->DestroyedOnMainThread())
m_compositorThreadContexts = FakeContextProvider::Create();
return m_compositorThreadContexts;
}
} // namespace cc
|