| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "mojo/services/view_manager/context_factory_impl.h" | |
| 6 | |
| 7 #include "cc/output/output_surface.h" | |
| 8 #include "mojo/cc/context_provider_mojo.h" | |
| 9 #include "ui/compositor/reflector.h" | |
| 10 #include "ui/gl/gl_implementation.h" | |
| 11 #include "ui/gl/gl_surface.h" | |
| 12 #include "webkit/common/gpu/context_provider_in_process.h" | |
| 13 #include "webkit/common/gpu/grcontext_for_webgraphicscontext3d.h" | |
| 14 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | |
| 15 | |
| 16 namespace mojo { | |
| 17 namespace service { | |
| 18 | |
| 19 ContextFactoryImpl::ContextFactoryImpl( | |
| 20 ScopedMessagePipeHandle command_buffer_handle) | |
| 21 : command_buffer_handle_(command_buffer_handle.Pass()), | |
| 22 did_create_(false) { | |
| 23 DCHECK(command_buffer_handle_.is_valid()); | |
| 24 } | |
| 25 | |
| 26 ContextFactoryImpl::~ContextFactoryImpl() { | |
| 27 } | |
| 28 | |
| 29 scoped_ptr<cc::OutputSurface> ContextFactoryImpl::CreateOutputSurface( | |
| 30 ui::Compositor* compositor, bool software_fallback) { | |
| 31 DCHECK(!did_create_); | |
| 32 did_create_ = true; | |
| 33 DCHECK(command_buffer_handle_.is_valid()); | |
| 34 return make_scoped_ptr( | |
| 35 new cc::OutputSurface( | |
| 36 new ContextProviderMojo(command_buffer_handle_.Pass()))); | |
| 37 } | |
| 38 | |
| 39 scoped_refptr<ui::Reflector> ContextFactoryImpl::CreateReflector( | |
| 40 ui::Compositor* mirroed_compositor, | |
| 41 ui::Layer* mirroring_layer) { | |
| 42 return NULL; | |
| 43 } | |
| 44 | |
| 45 void ContextFactoryImpl::RemoveReflector( | |
| 46 scoped_refptr<ui::Reflector> reflector) { | |
| 47 } | |
| 48 | |
| 49 scoped_refptr<cc::ContextProvider> | |
| 50 ContextFactoryImpl::SharedMainThreadContextProvider() { | |
| 51 if (!shared_main_thread_contexts_.get() || | |
| 52 shared_main_thread_contexts_->DestroyedOnMainThread()) { | |
| 53 bool lose_context_when_out_of_memory = false; | |
| 54 shared_main_thread_contexts_ = | |
| 55 webkit::gpu::ContextProviderInProcess::CreateOffscreen( | |
| 56 lose_context_when_out_of_memory); | |
| 57 if (shared_main_thread_contexts_.get() && | |
| 58 !shared_main_thread_contexts_->BindToCurrentThread()) | |
| 59 shared_main_thread_contexts_ = NULL; | |
| 60 } | |
| 61 return shared_main_thread_contexts_; | |
| 62 } | |
| 63 | |
| 64 void ContextFactoryImpl::RemoveCompositor(ui::Compositor* compositor) { | |
| 65 } | |
| 66 | |
| 67 bool ContextFactoryImpl::DoesCreateTestContexts() { return false; } | |
| 68 | |
| 69 cc::SharedBitmapManager* ContextFactoryImpl::GetSharedBitmapManager() { | |
| 70 return NULL; | |
| 71 } | |
| 72 | |
| 73 base::MessageLoopProxy* ContextFactoryImpl::GetCompositorMessageLoop() { | |
| 74 return NULL; | |
| 75 } | |
| 76 | |
| 77 } // namespace service | |
| 78 } // namespace mojo | |
| OLD | NEW |