| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "ui/display/types/display_snapshot.h" | 12 #include "ui/display/types/display_snapshot.h" |
| 13 #include "ui/display/types/native_display_delegate.h" | 13 #include "ui/display/types/native_display_delegate.h" |
| 14 #include "ui/display/types/native_display_observer.h" | 14 #include "ui/display/types/native_display_observer.h" |
| 15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
| 16 #include "ui/events/keycodes/dom3/dom_code.h" | 16 #include "ui/events/keycodes/dom3/dom_code.h" |
| 17 #include "ui/events/ozone/layout/keyboard_layout_engine.h" | 17 #include "ui/events/ozone/layout/keyboard_layout_engine.h" |
| 18 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 18 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 21 #include "ui/gl/gl_surface.h" | 21 #include "ui/gl/gl_surface.h" |
| 22 #include "ui/ozone/demo/gl_renderer.h" | 22 #include "ui/ozone/demo/gl_renderer.h" |
| 23 #include "ui/ozone/demo/software_renderer.h" | 23 #include "ui/ozone/demo/software_renderer.h" |
| 24 #include "ui/ozone/demo/surfaceless_gl_renderer.h" | 24 #include "ui/ozone/demo/surfaceless_gl_renderer.h" |
| 25 #include "ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h" | 25 #include "ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h" |
| 26 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
| 26 #include "ui/ozone/public/ozone_platform.h" | 27 #include "ui/ozone/public/ozone_platform.h" |
| 27 #include "ui/ozone/public/ozone_switches.h" | 28 #include "ui/ozone/public/ozone_switches.h" |
| 28 #include "ui/ozone/public/ui_thread_gpu.h" | |
| 29 #include "ui/platform_window/platform_window.h" | 29 #include "ui/platform_window/platform_window.h" |
| 30 #include "ui/platform_window/platform_window_delegate.h" | 30 #include "ui/platform_window/platform_window_delegate.h" |
| 31 | 31 |
| 32 const int kTestWindowWidth = 800; | 32 const int kTestWindowWidth = 800; |
| 33 const int kTestWindowHeight = 600; | 33 const int kTestWindowHeight = 600; |
| 34 | 34 |
| 35 const int kFrameDelayMilliseconds = 16; | 35 const int kFrameDelayMilliseconds = 16; |
| 36 | 36 |
| 37 const char kDisableGpu[] = "disable-gpu"; | 37 const char kDisableGpu[] = "disable-gpu"; |
| 38 | 38 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 ~RendererFactory(); | 52 ~RendererFactory(); |
| 53 | 53 |
| 54 bool Initialize(); | 54 bool Initialize(); |
| 55 scoped_ptr<ui::Renderer> CreateRenderer(gfx::AcceleratedWidget widget, | 55 scoped_ptr<ui::Renderer> CreateRenderer(gfx::AcceleratedWidget widget, |
| 56 const gfx::Size& size); | 56 const gfx::Size& size); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 RendererType type_; | 59 RendererType type_; |
| 60 | 60 |
| 61 // Helper for applications that do GL on main thread. | 61 // Helper for applications that do GL on main thread. |
| 62 ui::UiThreadGpu ui_thread_gpu_; | 62 ui::OzoneGpuTestHelper gpu_helper_; |
| 63 | 63 |
| 64 // Used by the surfaceless renderers to allocate buffers. | 64 // Used by the surfaceless renderers to allocate buffers. |
| 65 ui::GpuMemoryBufferFactoryOzoneNativeBuffer buffer_factory_; | 65 ui::GpuMemoryBufferFactoryOzoneNativeBuffer buffer_factory_; |
| 66 | 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(RendererFactory); | 67 DISALLOW_COPY_AND_ASSIGN(RendererFactory); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 class WindowManager : public ui::NativeDisplayObserver { | 70 class WindowManager : public ui::NativeDisplayObserver { |
| 71 public: | 71 public: |
| 72 WindowManager(const base::Closure& quit_closure); | 72 WindowManager(const base::Closure& quit_closure); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 RendererFactory::RendererFactory() : type_(SOFTWARE) { | 193 RendererFactory::RendererFactory() : type_(SOFTWARE) { |
| 194 } | 194 } |
| 195 | 195 |
| 196 RendererFactory::~RendererFactory() { | 196 RendererFactory::~RendererFactory() { |
| 197 } | 197 } |
| 198 | 198 |
| 199 bool RendererFactory::Initialize() { | 199 bool RendererFactory::Initialize() { |
| 200 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 200 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 201 if (!command_line->HasSwitch(kDisableGpu) && | 201 if (!command_line->HasSwitch(kDisableGpu) && |
| 202 gfx::GLSurface::InitializeOneOff() && ui_thread_gpu_.Initialize()) { | 202 gfx::GLSurface::InitializeOneOff() && |
| 203 gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(), |
| 204 base::ThreadTaskRunnerHandle::Get())) { |
| 203 if (command_line->HasSwitch(switches::kOzoneUseSurfaceless)) { | 205 if (command_line->HasSwitch(switches::kOzoneUseSurfaceless)) { |
| 204 type_ = SURFACELESS_GL; | 206 type_ = SURFACELESS_GL; |
| 205 } else { | 207 } else { |
| 206 type_ = GL; | 208 type_ = GL; |
| 207 } | 209 } |
| 208 } else { | 210 } else { |
| 209 type_ = SOFTWARE; | 211 type_ = SOFTWARE; |
| 210 } | 212 } |
| 211 | 213 |
| 212 return true; | 214 return true; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 ->SetCurrentLayoutByName("us"); | 339 ->SetCurrentLayoutByName("us"); |
| 338 | 340 |
| 339 base::RunLoop run_loop; | 341 base::RunLoop run_loop; |
| 340 | 342 |
| 341 WindowManager window_manager(run_loop.QuitClosure()); | 343 WindowManager window_manager(run_loop.QuitClosure()); |
| 342 | 344 |
| 343 run_loop.Run(); | 345 run_loop.Run(); |
| 344 | 346 |
| 345 return 0; | 347 return 0; |
| 346 } | 348 } |
| OLD | NEW |