| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/compositor/test/in_process_context_factory.h" | 5 #include "ui/compositor/test/in_process_context_factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| 11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
| 12 #include "cc/output/output_surface_client.h" | 12 #include "cc/output/output_surface_client.h" |
| 13 #include "cc/surfaces/onscreen_display_client.h" | 13 #include "cc/surfaces/onscreen_display_client.h" |
| 14 #include "cc/surfaces/surface_display_output_surface.h" | 14 #include "cc/surfaces/surface_display_output_surface.h" |
| 15 #include "cc/surfaces/surface_id_allocator.h" | 15 #include "cc/surfaces/surface_id_allocator.h" |
| 16 #include "cc/test/pixel_test_output_surface.h" | 16 #include "cc/test/pixel_test_output_surface.h" |
| 17 #include "cc/test/test_shared_bitmap_manager.h" | 17 #include "cc/test/test_shared_bitmap_manager.h" |
| 18 #include "gpu/command_buffer/client/context_support.h" | 18 #include "gpu/command_buffer/client/context_support.h" |
| 19 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 20 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 20 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 21 #include "ui/compositor/compositor_switches.h" | 21 #include "ui/compositor/compositor_switches.h" |
| 22 #include "ui/compositor/layer.h" |
| 22 #include "ui/compositor/reflector.h" | 23 #include "ui/compositor/reflector.h" |
| 23 #include "ui/compositor/test/in_process_context_provider.h" | 24 #include "ui/compositor/test/in_process_context_provider.h" |
| 24 #include "ui/gl/gl_implementation.h" | 25 #include "ui/gl/gl_implementation.h" |
| 25 #include "ui/gl/gl_surface.h" | 26 #include "ui/gl/gl_surface.h" |
| 26 | 27 |
| 27 namespace ui { | 28 namespace ui { |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 class FakeReflector : public Reflector { | 31 class FakeReflector : public Reflector { |
| 31 public: | 32 public: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 InProcessContextFactory::InProcessContextFactory( | 77 InProcessContextFactory::InProcessContextFactory( |
| 77 bool context_factory_for_test, | 78 bool context_factory_for_test, |
| 78 cc::SurfaceManager* surface_manager) | 79 cc::SurfaceManager* surface_manager) |
| 79 : next_surface_id_namespace_(1u), | 80 : next_surface_id_namespace_(1u), |
| 80 use_test_surface_(true), | 81 use_test_surface_(true), |
| 81 context_factory_for_test_(context_factory_for_test), | 82 context_factory_for_test_(context_factory_for_test), |
| 82 surface_manager_(surface_manager) { | 83 surface_manager_(surface_manager) { |
| 83 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) | 84 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone) |
| 84 << "If running tests, ensure that main() is calling " | 85 << "If running tests, ensure that main() is calling " |
| 85 << "gfx::GLSurface::InitializeOneOffForTests()"; | 86 << "gfx::GLSurface::InitializeOneOffForTests()"; |
| 87 |
| 88 Layer::InitializeUILayerSettings(); |
| 86 } | 89 } |
| 87 | 90 |
| 88 InProcessContextFactory::~InProcessContextFactory() { | 91 InProcessContextFactory::~InProcessContextFactory() { |
| 89 DCHECK(per_compositor_data_.empty()); | 92 DCHECK(per_compositor_data_.empty()); |
| 90 } | 93 } |
| 91 | 94 |
| 92 void InProcessContextFactory::CreateOutputSurface( | 95 void InProcessContextFactory::CreateOutputSurface( |
| 93 base::WeakPtr<Compositor> compositor) { | 96 base::WeakPtr<Compositor> compositor) { |
| 94 gpu::gles2::ContextCreationAttribHelper attribs; | 97 gpu::gles2::ContextCreationAttribHelper attribs; |
| 95 attribs.alpha_size = 8; | 98 attribs.alpha_size = 8; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 204 } |
| 202 | 205 |
| 203 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, | 206 void InProcessContextFactory::ResizeDisplay(ui::Compositor* compositor, |
| 204 const gfx::Size& size) { | 207 const gfx::Size& size) { |
| 205 if (!per_compositor_data_.count(compositor)) | 208 if (!per_compositor_data_.count(compositor)) |
| 206 return; | 209 return; |
| 207 per_compositor_data_[compositor]->display()->Resize(size); | 210 per_compositor_data_[compositor]->display()->Resize(size); |
| 208 } | 211 } |
| 209 | 212 |
| 210 } // namespace ui | 213 } // namespace ui |
| OLD | NEW |