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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "ui/display/types/display_snapshot.h" | 15 #include "ui/display/types/display_snapshot.h" |
16 #include "ui/display/types/native_display_delegate.h" | 16 #include "ui/display/types/native_display_delegate.h" |
17 #include "ui/display/types/native_display_observer.h" | 17 #include "ui/display/types/native_display_observer.h" |
18 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
19 #include "ui/events/keycodes/dom/dom_code.h" | 19 #include "ui/events/keycodes/dom/dom_code.h" |
20 #include "ui/events/ozone/layout/keyboard_layout_engine.h" | 20 #include "ui/events/ozone/layout/keyboard_layout_engine.h" |
21 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 21 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
22 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
23 #include "ui/gfx/geometry/size.h" | 23 #include "ui/gfx/geometry/size.h" |
24 #include "ui/gl/gl_surface.h" | 24 #include "ui/gl/gl_surface.h" |
| 25 #include "ui/gl/init/gl_factory.h" |
25 #include "ui/ozone/demo/gl_renderer.h" | 26 #include "ui/ozone/demo/gl_renderer.h" |
26 #include "ui/ozone/demo/software_renderer.h" | 27 #include "ui/ozone/demo/software_renderer.h" |
27 #include "ui/ozone/demo/surfaceless_gl_renderer.h" | 28 #include "ui/ozone/demo/surfaceless_gl_renderer.h" |
28 #include "ui/ozone/public/ozone_gpu_test_helper.h" | 29 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
29 #include "ui/ozone/public/ozone_platform.h" | 30 #include "ui/ozone/public/ozone_platform.h" |
30 #include "ui/ozone/public/ozone_switches.h" | 31 #include "ui/ozone/public/ozone_switches.h" |
31 #include "ui/platform_window/platform_window.h" | 32 #include "ui/platform_window/platform_window.h" |
32 #include "ui/platform_window/platform_window_delegate.h" | 33 #include "ui/platform_window/platform_window_delegate.h" |
33 | 34 |
34 const int kTestWindowWidth = 800; | 35 const int kTestWindowWidth = 800; |
35 const int kTestWindowHeight = 600; | 36 const int kTestWindowHeight = 600; |
36 | 37 |
37 const char kDisableGpu[] = "disable-gpu"; | 38 const char kDisableGpu[] = "disable-gpu"; |
38 | 39 |
39 const char kDisableSurfaceless[] = "disable-surfaceless"; | 40 const char kDisableSurfaceless[] = "disable-surfaceless"; |
40 | 41 |
41 const char kWindowSize[] = "window-size"; | 42 const char kWindowSize[] = "window-size"; |
42 | 43 |
43 class DemoWindow; | 44 class DemoWindow; |
44 | 45 |
45 scoped_refptr<gfx::GLSurface> CreateGLSurface(gfx::AcceleratedWidget widget) { | 46 scoped_refptr<gfx::GLSurface> CreateGLSurface(gfx::AcceleratedWidget widget) { |
46 scoped_refptr<gfx::GLSurface> surface; | 47 scoped_refptr<gfx::GLSurface> surface; |
47 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableSurfaceless)) | 48 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableSurfaceless)) |
48 surface = gfx::GLSurface::CreateSurfacelessViewGLSurface(widget); | 49 surface = gl::init::CreateSurfacelessViewGLSurface(widget); |
49 if (!surface) | 50 if (!surface) |
50 surface = gfx::GLSurface::CreateViewGLSurface(widget); | 51 surface = gl::init::CreateViewGLSurface(widget); |
51 return surface; | 52 return surface; |
52 } | 53 } |
53 | 54 |
54 class RendererFactory { | 55 class RendererFactory { |
55 public: | 56 public: |
56 enum RendererType { | 57 enum RendererType { |
57 GL, | 58 GL, |
58 SOFTWARE, | 59 SOFTWARE, |
59 }; | 60 }; |
60 | 61 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // RendererFactory implementation: | 191 // RendererFactory implementation: |
191 | 192 |
192 RendererFactory::RendererFactory() { | 193 RendererFactory::RendererFactory() { |
193 } | 194 } |
194 | 195 |
195 RendererFactory::~RendererFactory() { | 196 RendererFactory::~RendererFactory() { |
196 } | 197 } |
197 | 198 |
198 bool RendererFactory::Initialize() { | 199 bool RendererFactory::Initialize() { |
199 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 200 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
200 if (!command_line->HasSwitch(kDisableGpu) && | 201 if (!command_line->HasSwitch(kDisableGpu) && gl::init::InitializeGLOneOff() && |
201 gfx::GLSurface::InitializeOneOff() && | |
202 gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(), | 202 gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(), |
203 base::ThreadTaskRunnerHandle::Get())) { | 203 base::ThreadTaskRunnerHandle::Get())) { |
204 type_ = GL; | 204 type_ = GL; |
205 } else { | 205 } else { |
206 type_ = SOFTWARE; | 206 type_ = SOFTWARE; |
207 } | 207 } |
208 | 208 |
209 return true; | 209 return true; |
210 } | 210 } |
211 | 211 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 ->SetCurrentLayoutByName("us"); | 337 ->SetCurrentLayoutByName("us"); |
338 | 338 |
339 base::RunLoop run_loop; | 339 base::RunLoop run_loop; |
340 | 340 |
341 WindowManager window_manager(run_loop.QuitClosure()); | 341 WindowManager window_manager(run_loop.QuitClosure()); |
342 | 342 |
343 run_loop.Run(); | 343 run_loop.Run(); |
344 | 344 |
345 return 0; | 345 return 0; |
346 } | 346 } |
OLD | NEW |