Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: cc/test/fake_layer_tree_host_client.cc

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
8 #include "cc/test/test_web_graphics_context_3d.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<cc::ContextProvider> FakeLayerImplTreeHostClient::OffscreenContext ProviderForMainThread() {
42 if (!m_mainThreadContexts || m_mainThreadContexts->DestroyedOnMainThread())
43 m_mainThreadContexts = new FakeContextProvider;
44 return m_mainThreadContexts;
45 }
46
47 scoped_refptr<cc::ContextProvider> FakeLayerImplTreeHostClient::OffscreenContext ProviderForCompositorThread() {
48 if (!m_compositorThreadContexts || m_compositorThreadContexts->DestroyedOnMa inThread())
49 m_compositorThreadContexts = new FakeContextProvider;
50 return m_compositorThreadContexts;
51 }
52
30 } // namespace cc 53 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698