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

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: Back to a single OffscreenContext class 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 namespace cc { 7 namespace cc {
8 8
9 FakeLayerImplTreeHostClient::FakeLayerImplTreeHostClient(bool useSoftwareRenderi ng, bool useDelegatingRenderer)
10 : m_useSoftwareRendering(useSoftwareRendering)
11 , m_useDelegatingRenderer(useDelegatingRenderer)
12 {
13 }
14
15 FakeLayerImplTreeHostClient::~FakeLayerImplTreeHostClient() { }
16
9 scoped_ptr<OutputSurface> FakeLayerImplTreeHostClient::createOutputSurface() 17 scoped_ptr<OutputSurface> FakeLayerImplTreeHostClient::createOutputSurface()
10 { 18 {
11 if (m_useSoftwareRendering) { 19 if (m_useSoftwareRendering) {
12 if (m_useDelegatingRenderer) 20 if (m_useDelegatingRenderer)
13 return FakeOutputSurface::CreateDelegatingSoftware(make_scoped_ptr(n ew FakeSoftwareOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurfac e>(); 21 return FakeOutputSurface::CreateDelegatingSoftware(make_scoped_ptr(n ew FakeSoftwareOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurfac e>();
14 22
15 return FakeOutputSurface::CreateSoftware(make_scoped_ptr(new FakeSoftwar eOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurface>(); 23 return FakeOutputSurface::CreateSoftware(make_scoped_ptr(new FakeSoftwar eOutputDevice).PassAs<SoftwareOutputDevice>()).PassAs<OutputSurface>();
16 } 24 }
17 25
18 WebKit::WebGraphicsContext3D::Attributes attrs; 26 WebKit::WebGraphicsContext3D::Attributes attrs;
19 if (m_useDelegatingRenderer) 27 if (m_useDelegatingRenderer)
20 return FakeOutputSurface::CreateDelegating3d(FakeWebGraphicsContext3D::C reate(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); 28 return FakeOutputSurface::CreateDelegating3d(FakeWebGraphicsContext3D::C reate(attrs).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
21 29
22 return FakeOutputSurface::Create3d(FakeWebGraphicsContext3D::Create(attrs).P assAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); 30 return FakeOutputSurface::Create3d(FakeWebGraphicsContext3D::Create(attrs).P assAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>();
23 } 31 }
24 32
33 WebKit::WebGraphicsContext3D* FakeLayerImplTreeHostClient::OffscreenContext3dFor MainThread() {
34 return OffscreenContext3dForCompositorThread();
35 }
36
37 WebKit::WebGraphicsContext3D* FakeLayerImplTreeHostClient::OffscreenContext3dFor CompositorThread()
38 {
39 if (m_offscreenContext3d)
40 return m_offscreenContext3d.get();
41
42 WebKit::WebGraphicsContext3D::Attributes attrs;
43 m_offscreenContext3d = FakeWebGraphicsContext3D::Create(attrs).PassAs<WebKit ::WebGraphicsContext3D>();
44 return m_offscreenContext3d.get();
45 }
46
47 GrContext* FakeLayerImplTreeHostClient::OffscreenGrContextForMainThread()
48 {
49 return OffscreenGrContextForCompositorThread();
50 }
51
52 GrContext* FakeLayerImplTreeHostClient::OffscreenGrContextForCompositorThread()
53 {
54 // TODO(danakj): Make a FakeGrContext.
55 return NULL;
56 }
57
25 scoped_ptr<InputHandler> FakeLayerImplTreeHostClient::createInputHandler() 58 scoped_ptr<InputHandler> FakeLayerImplTreeHostClient::createInputHandler()
26 { 59 {
27 return scoped_ptr<InputHandler>(); 60 return scoped_ptr<InputHandler>();
28 } 61 }
29 62
30 scoped_ptr<FontAtlas> FakeLayerImplTreeHostClient::createFontAtlas() 63 scoped_ptr<FontAtlas> FakeLayerImplTreeHostClient::createFontAtlas()
31 { 64 {
32 return scoped_ptr<FontAtlas>(); 65 return scoped_ptr<FontAtlas>();
33 } 66 }
34 67
35 } // namespace cc 68 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698