summaryrefslogtreecommitdiffstats
path: root/ui/ozone/demo/ozone_demo.cc
diff options
context:
space:
mode:
authorspang <spang@chromium.org>2014-09-02 22:14:58 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-03 05:18:44 +0000
commitaa2a372038d7faf53f0f98194fdac467b56580de (patch)
treeb38600a281b83e790092b6b75dc1d4e0130bbede /ui/ozone/demo/ozone_demo.cc
parent8b156314b9fa0a730c9a02ebb44ba7638d52aef7 (diff)
downloadchromium_src-aa2a372038d7faf53f0f98194fdac467b56580de.zip
chromium_src-aa2a372038d7faf53f0f98194fdac467b56580de.tar.gz
chromium_src-aa2a372038d7faf53f0f98194fdac467b56580de.tar.bz2
ozone: Add UiThreadGpu for applications that do UI thread GL
The demo does GL on the main thread, which broken since we now depend on GpuPlatformSupport(Host). Let's deliver these messages directly via a helper class for those applications. BUG=409978 TEST=ozone_demo --ozone-platform=gbm on link_freon NOTRY=true Review URL: https://codereview.chromium.org/533803003 Cr-Commit-Position: refs/heads/master@{#293075}
Diffstat (limited to 'ui/ozone/demo/ozone_demo.cc')
-rw-r--r--ui/ozone/demo/ozone_demo.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc
index 43c98cf..309b138 100644
--- a/ui/ozone/demo/ozone_demo.cc
+++ b/ui/ozone/demo/ozone_demo.cc
@@ -16,6 +16,7 @@
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
#include "ui/ozone/public/surface_ozone_canvas.h"
+#include "ui/ozone/public/ui_thread_gpu.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_delegate.h"
@@ -47,7 +48,8 @@ class DemoWindow : public ui::PlatformWindowDelegate {
void Start() {
if (!CommandLine::ForCurrentProcess()->HasSwitch(kDisableGpu) &&
- gfx::GLSurface::InitializeOneOff() && InitializeGLSurface()) {
+ gfx::GLSurface::InitializeOneOff() && StartInProcessGpu() &&
+ InitializeGLSurface()) {
StartAnimationGL();
} else if (InitializeSoftwareSurface()) {
StartAnimationSoftware();
@@ -173,6 +175,8 @@ class DemoWindow : public ui::PlatformWindowDelegate {
software_surface_->PresentCanvas(gfx::Rect(window_size));
}
+ bool StartInProcessGpu() { return ui_thread_gpu_.Initialize(); }
+
// Timer for animation.
base::RepeatingTimer<DemoWindow> timer_;
@@ -187,6 +191,9 @@ class DemoWindow : public ui::PlatformWindowDelegate {
scoped_ptr<ui::PlatformWindow> platform_window_;
gfx::AcceleratedWidget widget_;
+ // Helper for applications that do GL on main thread.
+ ui::UiThreadGpu ui_thread_gpu_;
+
// Animation state.
int iteration_;