Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: ui/ozone/demo/ozone_demo.cc

Issue 1258713002: ozone: unify GpuMemoryBufferFactoryOzoneNativePixmap in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve nits Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ui/display/types/display_snapshot.h" 11 #include "ui/display/types/display_snapshot.h"
12 #include "ui/display/types/native_display_delegate.h" 12 #include "ui/display/types/native_display_delegate.h"
13 #include "ui/display/types/native_display_observer.h" 13 #include "ui/display/types/native_display_observer.h"
14 #include "ui/events/event.h" 14 #include "ui/events/event.h"
15 #include "ui/events/keycodes/dom/dom_code.h" 15 #include "ui/events/keycodes/dom/dom_code.h"
16 #include "ui/events/ozone/layout/keyboard_layout_engine.h" 16 #include "ui/events/ozone/layout/keyboard_layout_engine.h"
17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" 17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
18 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
19 #include "ui/gfx/geometry/size.h" 19 #include "ui/gfx/geometry/size.h"
20 #include "ui/gl/gl_surface.h" 20 #include "ui/gl/gl_surface.h"
21 #include "ui/ozone/demo/gl_renderer.h" 21 #include "ui/ozone/demo/gl_renderer.h"
22 #include "ui/ozone/demo/software_renderer.h" 22 #include "ui/ozone/demo/software_renderer.h"
23 #include "ui/ozone/demo/surfaceless_gl_renderer.h" 23 #include "ui/ozone/demo/surfaceless_gl_renderer.h"
24 #include "ui/ozone/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h"
25 #include "ui/ozone/public/ozone_gpu_test_helper.h" 24 #include "ui/ozone/public/ozone_gpu_test_helper.h"
26 #include "ui/ozone/public/ozone_platform.h" 25 #include "ui/ozone/public/ozone_platform.h"
27 #include "ui/ozone/public/ozone_switches.h" 26 #include "ui/ozone/public/ozone_switches.h"
28 #include "ui/platform_window/platform_window.h" 27 #include "ui/platform_window/platform_window.h"
29 #include "ui/platform_window/platform_window_delegate.h" 28 #include "ui/platform_window/platform_window_delegate.h"
30 29
31 const int kTestWindowWidth = 800; 30 const int kTestWindowWidth = 800;
32 const int kTestWindowHeight = 600; 31 const int kTestWindowHeight = 600;
33 32
34 const char kDisableGpu[] = "disable-gpu"; 33 const char kDisableGpu[] = "disable-gpu";
(...skipping 16 matching lines...) Expand all
51 bool Initialize(); 50 bool Initialize();
52 scoped_ptr<ui::Renderer> CreateRenderer(gfx::AcceleratedWidget widget, 51 scoped_ptr<ui::Renderer> CreateRenderer(gfx::AcceleratedWidget widget,
53 const gfx::Size& size); 52 const gfx::Size& size);
54 53
55 private: 54 private:
56 RendererType type_ = SOFTWARE; 55 RendererType type_ = SOFTWARE;
57 56
58 // Helper for applications that do GL on main thread. 57 // Helper for applications that do GL on main thread.
59 ui::OzoneGpuTestHelper gpu_helper_; 58 ui::OzoneGpuTestHelper gpu_helper_;
60 59
61 // Used by the surfaceless renderers to allocate buffers.
62 ui::GpuMemoryBufferFactoryOzoneNativePixmap buffer_factory_;
63
64 DISALLOW_COPY_AND_ASSIGN(RendererFactory); 60 DISALLOW_COPY_AND_ASSIGN(RendererFactory);
65 }; 61 };
66 62
67 class WindowManager : public ui::NativeDisplayObserver { 63 class WindowManager : public ui::NativeDisplayObserver {
68 public: 64 public:
69 WindowManager(const base::Closure& quit_closure); 65 WindowManager(const base::Closure& quit_closure);
70 ~WindowManager() override; 66 ~WindowManager() override;
71 67
72 void Quit(); 68 void Quit();
73 69
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return true; 197 return true;
202 } 198 }
203 199
204 scoped_ptr<ui::Renderer> RendererFactory::CreateRenderer( 200 scoped_ptr<ui::Renderer> RendererFactory::CreateRenderer(
205 gfx::AcceleratedWidget widget, 201 gfx::AcceleratedWidget widget,
206 const gfx::Size& size) { 202 const gfx::Size& size) {
207 switch (type_) { 203 switch (type_) {
208 case GL: 204 case GL:
209 return make_scoped_ptr(new ui::GlRenderer(widget, size)); 205 return make_scoped_ptr(new ui::GlRenderer(widget, size));
210 case SURFACELESS_GL: 206 case SURFACELESS_GL:
211 return make_scoped_ptr( 207 return make_scoped_ptr(new ui::SurfacelessGlRenderer(widget, size));
212 new ui::SurfacelessGlRenderer(widget, size, &buffer_factory_));
213 case SOFTWARE: 208 case SOFTWARE:
214 return make_scoped_ptr(new ui::SoftwareRenderer(widget, size)); 209 return make_scoped_ptr(new ui::SoftwareRenderer(widget, size));
215 } 210 }
216 211
217 return nullptr; 212 return nullptr;
218 } 213 }
219 214
220 /////////////////////////////////////////////////////////////////////////////// 215 ///////////////////////////////////////////////////////////////////////////////
221 // WindowManager implementation: 216 // WindowManager implementation:
222 217
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ->SetCurrentLayoutByName("us"); 319 ->SetCurrentLayoutByName("us");
325 320
326 base::RunLoop run_loop; 321 base::RunLoop run_loop;
327 322
328 WindowManager window_manager(run_loop.QuitClosure()); 323 WindowManager window_manager(run_loop.QuitClosure());
329 324
330 run_loop.Run(); 325 run_loop.Run();
331 326
332 return 0; 327 return 0;
333 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698