| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const int kTestWindowHeight = 600; | 36 const int kTestWindowHeight = 600; |
| 37 | 37 |
| 38 const char kDisableGpu[] = "disable-gpu"; | 38 const char kDisableGpu[] = "disable-gpu"; |
| 39 | 39 |
| 40 const char kDisableSurfaceless[] = "disable-surfaceless"; | 40 const char kDisableSurfaceless[] = "disable-surfaceless"; |
| 41 | 41 |
| 42 const char kWindowSize[] = "window-size"; | 42 const char kWindowSize[] = "window-size"; |
| 43 | 43 |
| 44 class DemoWindow; | 44 class DemoWindow; |
| 45 | 45 |
| 46 scoped_refptr<gfx::GLSurface> CreateGLSurface(gfx::AcceleratedWidget widget) { | 46 scoped_refptr<gl::GLSurface> CreateGLSurface(gfx::AcceleratedWidget widget) { |
| 47 scoped_refptr<gfx::GLSurface> surface; | 47 scoped_refptr<gl::GLSurface> surface; |
| 48 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableSurfaceless)) | 48 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableSurfaceless)) |
| 49 surface = gl::init::CreateSurfacelessViewGLSurface(widget); | 49 surface = gl::init::CreateSurfacelessViewGLSurface(widget); |
| 50 if (!surface) | 50 if (!surface) |
| 51 surface = gl::init::CreateViewGLSurface(widget); | 51 surface = gl::init::CreateViewGLSurface(widget); |
| 52 return surface; | 52 return surface; |
| 53 } | 53 } |
| 54 | 54 |
| 55 class RendererFactory { | 55 class RendererFactory { |
| 56 public: | 56 public: |
| 57 enum RendererType { | 57 enum RendererType { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 return true; | 209 return true; |
| 210 } | 210 } |
| 211 | 211 |
| 212 std::unique_ptr<ui::Renderer> RendererFactory::CreateRenderer( | 212 std::unique_ptr<ui::Renderer> RendererFactory::CreateRenderer( |
| 213 gfx::AcceleratedWidget widget, | 213 gfx::AcceleratedWidget widget, |
| 214 const gfx::Size& size) { | 214 const gfx::Size& size) { |
| 215 switch (type_) { | 215 switch (type_) { |
| 216 case GL: { | 216 case GL: { |
| 217 scoped_refptr<gfx::GLSurface> surface = CreateGLSurface(widget); | 217 scoped_refptr<gl::GLSurface> surface = CreateGLSurface(widget); |
| 218 if (!surface) | 218 if (!surface) |
| 219 LOG(FATAL) << "Failed to create GL surface"; | 219 LOG(FATAL) << "Failed to create GL surface"; |
| 220 if (surface->IsSurfaceless()) | 220 if (surface->IsSurfaceless()) |
| 221 return base::WrapUnique( | 221 return base::WrapUnique( |
| 222 new ui::SurfacelessGlRenderer(widget, surface, size)); | 222 new ui::SurfacelessGlRenderer(widget, surface, size)); |
| 223 else | 223 else |
| 224 return base::WrapUnique(new ui::GlRenderer(widget, surface, size)); | 224 return base::WrapUnique(new ui::GlRenderer(widget, surface, size)); |
| 225 } | 225 } |
| 226 case SOFTWARE: | 226 case SOFTWARE: |
| 227 return base::WrapUnique(new ui::SoftwareRenderer(widget, size)); | 227 return base::WrapUnique(new ui::SoftwareRenderer(widget, size)); |
| (...skipping 109 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 |