1 // Copyright 2015 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.
5 #include "mandoline/ui/aura/surface_context_factory.h"
7 #include "cc/output/output_surface.h"
8 #include "cc/resources/shared_bitmap_manager.h"
9 #include "cc/surfaces/surface_id_allocator.h"
10 #include "components/mus/public/cpp/view.h"
11 #include "mojo/application/public/interfaces/shell.mojom.h"
12 #include "ui/compositor/reflector.h"
13 #include "ui/gl/gl_bindings.h"
18 class FakeReflector
: public ui::Reflector
{
21 ~FakeReflector() override
{}
22 void OnMirroringCompositorResized() override
{}
23 void AddMirroringLayer(ui::Layer
* layer
) override
{}
24 void RemoveMirroringLayer(ui::Layer
* layer
) override
{}
29 SurfaceContextFactory::SurfaceContextFactory(mojo::Shell
* shell
,
31 : surface_binding_(shell
, view
), next_surface_id_namespace_(1u) {}
33 SurfaceContextFactory::~SurfaceContextFactory() {
36 void SurfaceContextFactory::CreateOutputSurface(
37 base::WeakPtr
<ui::Compositor
> compositor
) {
39 compositor
->SetOutputSurface(surface_binding_
.CreateOutputSurface());
42 scoped_ptr
<ui::Reflector
> SurfaceContextFactory::CreateReflector(
43 ui::Compositor
* mirroed_compositor
,
44 ui::Layer
* mirroring_layer
) {
46 return make_scoped_ptr(new FakeReflector
);
49 void SurfaceContextFactory::RemoveReflector(ui::Reflector
* reflector
) {
53 scoped_refptr
<cc::ContextProvider
>
54 SurfaceContextFactory::SharedMainThreadContextProvider() {
59 void SurfaceContextFactory::RemoveCompositor(ui::Compositor
* compositor
) {
63 bool SurfaceContextFactory::DoesCreateTestContexts() {
67 uint32
SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format
,
68 gfx::BufferUsage usage
) {
69 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D.
73 cc::SharedBitmapManager
* SurfaceContextFactory::GetSharedBitmapManager() {
78 gpu::GpuMemoryBufferManager
*
79 SurfaceContextFactory::GetGpuMemoryBufferManager() {
80 return &gpu_memory_buffer_manager_
;
83 cc::TaskGraphRunner
* SurfaceContextFactory::GetTaskGraphRunner() {
84 return raster_thread_helper_
.task_graph_runner();
87 scoped_ptr
<cc::SurfaceIdAllocator
>
88 SurfaceContextFactory::CreateSurfaceIdAllocator() {
89 return make_scoped_ptr(
90 new cc::SurfaceIdAllocator(next_surface_id_namespace_
++));
93 void SurfaceContextFactory::ResizeDisplay(ui::Compositor
* compositor
,
94 const gfx::Size
& size
) {
98 } // namespace mandoline