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 "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 5 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
11 #include "cc/surfaces/surface_manager.h" | 11 #include "cc/surfaces/surface_manager.h" |
| 12 #include "components/display_compositor/display_compositor.h" |
12 #include "components/display_compositor/gl_helper.h" | 13 #include "components/display_compositor/gl_helper.h" |
13 #include "gpu/command_buffer/client/gles2_interface.h" | 14 #include "gpu/command_buffer/client/gles2_interface.h" |
14 #include "ui/compositor/compositor.h" | 15 #include "ui/compositor/compositor.h" |
15 #include "ui/compositor/test/in_process_context_factory.h" | 16 #include "ui/compositor/test/in_process_context_factory.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 NoTransportImageTransportFactory::NoTransportImageTransportFactory() | 20 NoTransportImageTransportFactory::NoTransportImageTransportFactory() |
20 : surface_manager_(new cc::SurfaceManager), | 21 : display_compositor_client_binding_(this) { |
21 // The context factory created here is for unit tests, thus passing in | 22 display_compositor_ = base::MakeUnique<display_compositor::DisplayCompositor>( |
22 // true in constructor. | 23 MakeRequest(&display_compositor_ptr_), |
23 context_factory_( | 24 display_compositor_client_binding_.CreateInterfacePtrAndBind()); |
24 new ui::InProcessContextFactory(true, surface_manager_.get())) {} | 25 |
| 26 // The context factory created here is for unit tests, thus passing in |
| 27 // true in constructor. |
| 28 context_factory_ = base::MakeUnique<ui::InProcessContextFactory>( |
| 29 true, display_compositor_.get()); |
| 30 } |
25 | 31 |
26 NoTransportImageTransportFactory::~NoTransportImageTransportFactory() { | 32 NoTransportImageTransportFactory::~NoTransportImageTransportFactory() { |
27 std::unique_ptr<display_compositor::GLHelper> lost_gl_helper = | 33 std::unique_ptr<display_compositor::GLHelper> lost_gl_helper = |
28 std::move(gl_helper_); | 34 std::move(gl_helper_); |
29 context_factory_->SendOnLostResources(); | 35 context_factory_->SendOnLostResources(); |
30 } | 36 } |
31 | 37 |
32 ui::ContextFactory* NoTransportImageTransportFactory::GetContextFactory() { | 38 ui::ContextFactory* NoTransportImageTransportFactory::GetContextFactory() { |
33 return context_factory_.get(); | 39 return context_factory_.get(); |
34 } | 40 } |
35 | 41 |
36 ui::ContextFactoryPrivate* | 42 ui::ContextFactoryPrivate* |
37 NoTransportImageTransportFactory::GetContextFactoryPrivate() { | 43 NoTransportImageTransportFactory::GetContextFactoryPrivate() { |
38 return context_factory_.get(); | 44 return context_factory_.get(); |
39 } | 45 } |
40 | 46 |
41 display_compositor::GLHelper* NoTransportImageTransportFactory::GetGLHelper() { | 47 display_compositor::GLHelper* NoTransportImageTransportFactory::GetGLHelper() { |
42 if (!gl_helper_) { | 48 if (!gl_helper_) { |
43 context_provider_ = context_factory_->SharedMainThreadContextProvider(); | 49 context_provider_ = context_factory_->SharedMainThreadContextProvider(); |
44 gl_helper_.reset(new display_compositor::GLHelper( | 50 gl_helper_.reset(new display_compositor::GLHelper( |
45 context_provider_->ContextGL(), context_provider_->ContextSupport())); | 51 context_provider_->ContextGL(), context_provider_->ContextSupport())); |
46 } | 52 } |
47 return gl_helper_.get(); | 53 return gl_helper_.get(); |
48 } | 54 } |
49 | 55 |
50 void NoTransportImageTransportFactory::SetGpuChannelEstablishFactory( | 56 void NoTransportImageTransportFactory::SetGpuChannelEstablishFactory( |
51 gpu::GpuChannelEstablishFactory* factory) {} | 57 gpu::GpuChannelEstablishFactory* factory) {} |
52 | 58 |
| 59 void NoTransportImageTransportFactory::OnSurfaceCreated( |
| 60 const cc::SurfaceInfo& surface_info) {} |
| 61 |
53 } // namespace content | 62 } // namespace content |
OLD | NEW |