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