| 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 "mojo/examples/aura_demo/demo_context_factory.h" | 5 #include "mojo/examples/aura_demo/demo_context_factory.h" |
| 6 | 6 |
| 7 #include "cc/output/output_surface.h" | 7 #include "cc/output/output_surface.h" |
| 8 #include "mojo/examples/aura_demo/window_tree_host_mojo.h" | 8 #include "mojo/examples/aura_demo/window_tree_host_mojo.h" |
| 9 #include "mojo/examples/compositor_app/mojo_context_provider.h" | 9 #include "mojo/examples/compositor_app/mojo_context_provider.h" |
| 10 #include "ui/compositor/reflector.h" | 10 #include "ui/compositor/reflector.h" |
| 11 #include "ui/gl/gl_implementation.h" | 11 #include "ui/gl/gl_implementation.h" |
| 12 #include "ui/gl/gl_surface.h" | 12 #include "ui/gl/gl_surface.h" |
| 13 #include "webkit/common/gpu/context_provider_in_process.h" | 13 #include "webkit/common/gpu/context_provider_in_process.h" |
| 14 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | 14 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" |
| 15 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 15 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 16 | 16 |
| 17 namespace mojo { | 17 namespace mojo { |
| 18 namespace examples { | 18 namespace examples { |
| 19 | 19 |
| 20 DemoContextFactory::DemoContextFactory(WindowTreeHostMojo* rwhm) : rwhm_(rwhm) { | 20 DemoContextFactory::DemoContextFactory(WindowTreeHostMojo* rwhm) : rwhm_(rwhm) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 DemoContextFactory::~DemoContextFactory() { | 23 DemoContextFactory::~DemoContextFactory() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 bool DemoContextFactory::Initialize() { | 26 bool DemoContextFactory::Initialize() { |
| 27 if (gfx::GetGLImplementation() != gfx::kGLImplementationNone) { |
| 28 return true; |
| 29 } |
| 30 |
| 27 if (!gfx::GLSurface::InitializeOneOff() || | 31 if (!gfx::GLSurface::InitializeOneOff() || |
| 28 gfx::GetGLImplementation() == gfx::kGLImplementationNone) { | 32 gfx::GetGLImplementation() == gfx::kGLImplementationNone) { |
| 29 LOG(ERROR) << "Could not load the GL bindings"; | 33 LOG(ERROR) << "Could not load the GL bindings"; |
| 30 return false; | 34 return false; |
| 31 } | 35 } |
| 36 |
| 32 return true; | 37 return true; |
| 33 } | 38 } |
| 34 | 39 |
| 35 scoped_ptr<cc::OutputSurface> DemoContextFactory::CreateOutputSurface( | 40 scoped_ptr<cc::OutputSurface> DemoContextFactory::CreateOutputSurface( |
| 36 ui::Compositor* compositor, bool software_fallback) { | 41 ui::Compositor* compositor, bool software_fallback) { |
| 37 return make_scoped_ptr(new cc::OutputSurface( | 42 return make_scoped_ptr(new cc::OutputSurface( |
| 38 new MojoContextProvider(rwhm_->TakeGLES2PipeHandle()))); | 43 new MojoContextProvider(rwhm_->TakeGLES2PipeHandle()))); |
| 39 } | 44 } |
| 40 | 45 |
| 41 scoped_refptr<ui::Reflector> DemoContextFactory::CreateReflector( | 46 scoped_refptr<ui::Reflector> DemoContextFactory::CreateReflector( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 63 return shared_main_thread_contexts_; | 68 return shared_main_thread_contexts_; |
| 64 } | 69 } |
| 65 | 70 |
| 66 void DemoContextFactory::RemoveCompositor(ui::Compositor* compositor) { | 71 void DemoContextFactory::RemoveCompositor(ui::Compositor* compositor) { |
| 67 } | 72 } |
| 68 | 73 |
| 69 bool DemoContextFactory::DoesCreateTestContexts() { return false; } | 74 bool DemoContextFactory::DoesCreateTestContexts() { return false; } |
| 70 | 75 |
| 71 } // namespace examples | 76 } // namespace examples |
| 72 } // namespace mojo | 77 } // namespace mojo |
| 73 | |
| OLD | NEW |