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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
12 #include "cc/surfaces/surface_manager.h" | 12 #include "cc/surfaces/surface_manager.h" |
13 #include "components/display_compositor/gl_helper.h" | 13 #include "components/viz/display_compositor/gl_helper.h" |
14 #include "gpu/command_buffer/client/gles2_interface.h" | 14 #include "gpu/command_buffer/client/gles2_interface.h" |
15 #include "ui/compositor/compositor.h" | 15 #include "ui/compositor/compositor.h" |
16 #include "ui/compositor/test/in_process_context_factory.h" | 16 #include "ui/compositor/test/in_process_context_factory.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 NoTransportImageTransportFactory::NoTransportImageTransportFactory() | 20 NoTransportImageTransportFactory::NoTransportImageTransportFactory() |
21 : frame_sink_manager_host_(base::MakeUnique<FrameSinkManagerHost>()), | 21 : frame_sink_manager_host_(base::MakeUnique<FrameSinkManagerHost>()), |
22 context_factory_(base::MakeUnique<ui::InProcessContextFactory>( | 22 context_factory_(base::MakeUnique<ui::InProcessContextFactory>( |
23 frame_sink_manager_host_->surface_manager())) { | 23 frame_sink_manager_host_->surface_manager())) { |
24 // The context factory created here is for unit tests, thus using a higher | 24 // The context factory created here is for unit tests, thus using a higher |
25 // refresh rate to spend less time waiting for BeginFrames. | 25 // refresh rate to spend less time waiting for BeginFrames. |
26 context_factory_->SetUseFastRefreshRateForTests(); | 26 context_factory_->SetUseFastRefreshRateForTests(); |
27 } | 27 } |
28 | 28 |
29 NoTransportImageTransportFactory::~NoTransportImageTransportFactory() { | 29 NoTransportImageTransportFactory::~NoTransportImageTransportFactory() { |
30 std::unique_ptr<display_compositor::GLHelper> lost_gl_helper = | 30 std::unique_ptr<viz::GLHelper> lost_gl_helper = std::move(gl_helper_); |
31 std::move(gl_helper_); | |
32 context_factory_->SendOnLostResources(); | 31 context_factory_->SendOnLostResources(); |
33 } | 32 } |
34 | 33 |
35 ui::ContextFactory* NoTransportImageTransportFactory::GetContextFactory() { | 34 ui::ContextFactory* NoTransportImageTransportFactory::GetContextFactory() { |
36 return context_factory_.get(); | 35 return context_factory_.get(); |
37 } | 36 } |
38 | 37 |
39 ui::ContextFactoryPrivate* | 38 ui::ContextFactoryPrivate* |
40 NoTransportImageTransportFactory::GetContextFactoryPrivate() { | 39 NoTransportImageTransportFactory::GetContextFactoryPrivate() { |
41 return context_factory_.get(); | 40 return context_factory_.get(); |
42 } | 41 } |
43 | 42 |
44 FrameSinkManagerHost* | 43 FrameSinkManagerHost* |
45 NoTransportImageTransportFactory::GetFrameSinkManagerHost() { | 44 NoTransportImageTransportFactory::GetFrameSinkManagerHost() { |
46 return frame_sink_manager_host_.get(); | 45 return frame_sink_manager_host_.get(); |
47 } | 46 } |
48 | 47 |
49 display_compositor::GLHelper* NoTransportImageTransportFactory::GetGLHelper() { | 48 viz::GLHelper* NoTransportImageTransportFactory::GetGLHelper() { |
50 if (!gl_helper_) { | 49 if (!gl_helper_) { |
51 context_provider_ = context_factory_->SharedMainThreadContextProvider(); | 50 context_provider_ = context_factory_->SharedMainThreadContextProvider(); |
52 gl_helper_.reset(new display_compositor::GLHelper( | 51 gl_helper_.reset(new viz::GLHelper(context_provider_->ContextGL(), |
53 context_provider_->ContextGL(), context_provider_->ContextSupport())); | 52 context_provider_->ContextSupport())); |
54 } | 53 } |
55 return gl_helper_.get(); | 54 return gl_helper_.get(); |
56 } | 55 } |
57 | 56 |
58 void NoTransportImageTransportFactory::SetGpuChannelEstablishFactory( | 57 void NoTransportImageTransportFactory::SetGpuChannelEstablishFactory( |
59 gpu::GpuChannelEstablishFactory* factory) {} | 58 gpu::GpuChannelEstablishFactory* factory) {} |
60 | 59 |
61 } // namespace content | 60 } // namespace content |
OLD | NEW |