| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #if defined(USE_X11) | 5 #if defined(USE_X11) |
| 6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/aura/window_tree_host.h" | 26 #include "ui/aura/window_tree_host.h" |
| 27 #include "ui/base/hit_test.h" | 27 #include "ui/base/hit_test.h" |
| 28 #include "ui/compositor/compositor.h" | 28 #include "ui/compositor/compositor.h" |
| 29 #include "ui/compositor/compositor_observer.h" | 29 #include "ui/compositor/compositor_observer.h" |
| 30 #include "ui/compositor/debug_utils.h" | 30 #include "ui/compositor/debug_utils.h" |
| 31 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
| 32 #include "ui/compositor/test/in_process_context_factory.h" | 32 #include "ui/compositor/test/in_process_context_factory.h" |
| 33 #include "ui/gfx/canvas.h" | 33 #include "ui/gfx/canvas.h" |
| 34 #include "ui/gfx/rect.h" | 34 #include "ui/gfx/rect.h" |
| 35 #include "ui/gfx/skia_util.h" | 35 #include "ui/gfx/skia_util.h" |
| 36 #include "ui/gfx/x/x11_connection.h" |
| 36 #include "ui/gl/gl_surface.h" | 37 #include "ui/gl/gl_surface.h" |
| 37 | 38 |
| 38 #ifndef GL_GLEXT_PROTOTYPES | 39 #ifndef GL_GLEXT_PROTOTYPES |
| 39 #define GL_GLEXT_PROTOTYPES 1 | 40 #define GL_GLEXT_PROTOTYPES 1 |
| 40 #endif | 41 #endif |
| 41 #include "third_party/khronos/GLES2/gl2ext.h" | 42 #include "third_party/khronos/GLES2/gl2ext.h" |
| 42 | 43 |
| 43 #if defined(USE_X11) | |
| 44 #include "base/message_loop/message_pump_x11.h" | |
| 45 #endif | |
| 46 | |
| 47 using base::TimeTicks; | 44 using base::TimeTicks; |
| 48 using ui::Compositor; | 45 using ui::Compositor; |
| 49 using ui::Layer; | 46 using ui::Layer; |
| 50 using ui::LayerDelegate; | 47 using ui::LayerDelegate; |
| 51 | 48 |
| 52 namespace { | 49 namespace { |
| 53 | 50 |
| 54 class ColoredLayer : public Layer, public LayerDelegate { | 51 class ColoredLayer : public Layer, public LayerDelegate { |
| 55 public: | 52 public: |
| 56 explicit ColoredLayer(SkColor color) | 53 explicit ColoredLayer(SkColor color) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 } // namespace | 284 } // namespace |
| 288 | 285 |
| 289 int main(int argc, char** argv) { | 286 int main(int argc, char** argv) { |
| 290 CommandLine::Init(argc, argv); | 287 CommandLine::Init(argc, argv); |
| 291 | 288 |
| 292 base::AtExitManager exit_manager; | 289 base::AtExitManager exit_manager; |
| 293 | 290 |
| 294 #if defined(USE_X11) | 291 #if defined(USE_X11) |
| 295 // This demo uses InProcessContextFactory which uses X on a separate Gpu | 292 // This demo uses InProcessContextFactory which uses X on a separate Gpu |
| 296 // thread. | 293 // thread. |
| 297 XInitThreads(); | 294 gfx::InitializeThreadedX11(); |
| 298 #endif | 295 #endif |
| 299 | 296 |
| 300 gfx::GLSurface::InitializeOneOff(); | 297 gfx::GLSurface::InitializeOneOff(); |
| 301 | 298 |
| 302 // The ContextFactory must exist before any Compositors are created. | 299 // The ContextFactory must exist before any Compositors are created. |
| 303 scoped_ptr<ui::InProcessContextFactory> context_factory( | 300 scoped_ptr<ui::InProcessContextFactory> context_factory( |
| 304 new ui::InProcessContextFactory()); | 301 new ui::InProcessContextFactory()); |
| 305 ui::ContextFactory::SetInstance(context_factory.get()); | 302 ui::ContextFactory::SetInstance(context_factory.get()); |
| 306 | 303 |
| 307 base::i18n::InitializeICU(); | 304 base::i18n::InitializeICU(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 ui::PrintLayerHierarchy(host->window()->layer(), gfx::Point(100, 100)); | 358 ui::PrintLayerHierarchy(host->window()->layer(), gfx::Point(100, 100)); |
| 362 #endif | 359 #endif |
| 363 | 360 |
| 364 host->Show(); | 361 host->Show(); |
| 365 base::MessageLoopForUI::current()->Run(); | 362 base::MessageLoopForUI::current()->Run(); |
| 366 focus_client.reset(); | 363 focus_client.reset(); |
| 367 host.reset(); | 364 host.reset(); |
| 368 | 365 |
| 369 return 0; | 366 return 0; |
| 370 } | 367 } |
| OLD | NEW |