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 #ifndef MANDOLINE_UI_AURA_SURFACE_CONTEXT_FACTORY_H_
6 #define MANDOLINE_UI_AURA_SURFACE_CONTEXT_FACTORY_H_
8 #include "components/view_manager/gles2/mojo_gpu_memory_buffer_manager.h"
9 #include "components/view_manager/gles2/raster_thread_helper.h"
10 #include "mandoline/ui/aura/surface_binding.h"
11 #include "ui/compositor/compositor.h"
20 class SurfaceContextFactory
: public ui::ContextFactory
{
22 SurfaceContextFactory(mojo::Shell
* shell
, mojo::View
* view
);
23 ~SurfaceContextFactory() override
;
27 void CreateOutputSurface(base::WeakPtr
<ui::Compositor
> compositor
) override
;
28 scoped_ptr
<ui::Reflector
> CreateReflector(
29 ui::Compositor
* mirrored_compositor
,
30 ui::Layer
* mirroring_layer
) override
;
31 void RemoveReflector(ui::Reflector
* reflector
) override
;
32 scoped_refptr
<cc::ContextProvider
> SharedMainThreadContextProvider() override
;
33 void RemoveCompositor(ui::Compositor
* compositor
) override
;
34 bool DoesCreateTestContexts() override
;
35 uint32
GetImageTextureTarget(gfx::BufferFormat format
,
36 gfx::BufferUsage usage
) override
;
37 cc::SharedBitmapManager
* GetSharedBitmapManager() override
;
38 gpu::GpuMemoryBufferManager
* GetGpuMemoryBufferManager() override
;
39 cc::TaskGraphRunner
* GetTaskGraphRunner() override
;
40 scoped_ptr
<cc::SurfaceIdAllocator
> CreateSurfaceIdAllocator() override
;
41 void ResizeDisplay(ui::Compositor
* compositor
,
42 const gfx::Size
& size
) override
;
44 SurfaceBinding surface_binding_
;
45 uint32_t next_surface_id_namespace_
;
46 gles2::RasterThreadHelper raster_thread_helper_
;
47 gles2::MojoGpuMemoryBufferManager gpu_memory_buffer_manager_
;
49 DISALLOW_COPY_AND_ASSIGN(SurfaceContextFactory
);
52 } // namespace mandoline
54 #endif // MANDOLINE_UI_AURA_SURFACE_CONTEXT_FACTORY_H_