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

Unified Diff: ui/ozone/demo/ozone_demo.cc

Issue 533803003: ozone: Add UiThreadGpu for applications that do UI thread GL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix components Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/BUILD.gn ('k') | ui/ozone/ozone.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/demo/ozone_demo.cc
diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc
index 43c98cf5e21cc98e5a18857c2ddf21f8b4eb3c2f..309b138edaec12cea764834574069cb35f80b6a5 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_;
« no previous file with comments | « ui/ozone/BUILD.gn ('k') | ui/ozone/ozone.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698