| 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/output/context_provider.h" | 7 #include "cc/output/context_provider.h" |
| 8 #include "cc/test/fake_output_surface.h" |
| 8 #include "cc/test/test_web_graphics_context_3d.h" | 9 #include "cc/test/test_web_graphics_context_3d.h" |
| 9 | 10 |
| 10 namespace cc { | 11 namespace cc { |
| 11 | 12 |
| 12 FakeLayerTreeHostClient::FakeLayerTreeHostClient(RendererOptions options) | 13 FakeLayerTreeHostClient::FakeLayerTreeHostClient(RendererOptions options) |
| 13 : use_software_rendering_(options == DIRECT_SOFTWARE || | 14 : use_software_rendering_(options == DIRECT_SOFTWARE || |
| 14 options == DELEGATED_SOFTWARE), | 15 options == DELEGATED_SOFTWARE), |
| 15 use_delegating_renderer_(options == DELEGATED_3D || | 16 use_delegating_renderer_(options == DELEGATED_3D || |
| 16 options == DELEGATED_SOFTWARE) {} | 17 options == DELEGATED_SOFTWARE) {} |
| 17 | 18 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 if (use_delegating_renderer_) | 32 if (use_delegating_renderer_) |
| 32 return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); | 33 return FakeOutputSurface::CreateDelegating3d().PassAs<OutputSurface>(); |
| 33 | 34 |
| 34 return CreateFakeOutputSurface(); | 35 return CreateFakeOutputSurface(); |
| 35 } | 36 } |
| 36 | 37 |
| 37 scoped_refptr<cc::ContextProvider> FakeLayerTreeHostClient:: | 38 scoped_refptr<cc::ContextProvider> FakeLayerTreeHostClient:: |
| 38 OffscreenContextProviderForMainThread() { | 39 OffscreenContextProviderForMainThread() { |
| 39 if (!main_thread_contexts_.get() || | 40 if (!main_thread_contexts_.get() || |
| 40 main_thread_contexts_->DestroyedOnMainThread()) { | 41 main_thread_contexts_->DestroyedOnMainThread()) { |
| 41 main_thread_contexts_ = FakeContextProvider::Create(); | 42 main_thread_contexts_ = FakeContextProvider::Create( |
| 43 TestWebGraphicsContext3D::CreateBaseFactory()); |
| 42 if (!main_thread_contexts_->BindToCurrentThread()) | 44 if (!main_thread_contexts_->BindToCurrentThread()) |
| 43 main_thread_contexts_ = NULL; | 45 main_thread_contexts_ = NULL; |
| 44 } | 46 } |
| 45 return main_thread_contexts_; | 47 return main_thread_contexts_; |
| 46 } | 48 } |
| 47 | 49 |
| 48 scoped_refptr<cc::ContextProvider> FakeLayerTreeHostClient:: | 50 scoped_refptr<cc::ContextProvider> FakeLayerTreeHostClient:: |
| 49 OffscreenContextProviderForCompositorThread() { | 51 OffscreenContextProviderForCompositorThread() { |
| 50 if (!compositor_thread_contexts_.get() || | 52 if (!compositor_thread_contexts_.get() || |
| 51 compositor_thread_contexts_->DestroyedOnMainThread()) | 53 compositor_thread_contexts_->DestroyedOnMainThread()) |
| 52 compositor_thread_contexts_ = FakeContextProvider::Create(); | 54 compositor_thread_contexts_ = FakeContextProvider::Create( |
| 55 TestWebGraphicsContext3D::CreateBaseFactory()); |
| 53 return compositor_thread_contexts_; | 56 return compositor_thread_contexts_; |
| 54 } | 57 } |
| 55 | 58 |
| 56 } // namespace cc | 59 } // namespace cc |
| OLD | NEW |