Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / mandoline / ui / aura / surface_context_factory.cc
blob0a75487128a093141062fc27d4c413529adbe74c
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"
15 namespace mandoline {
16 namespace {
18 class FakeReflector : public ui::Reflector {
19 public:
20 FakeReflector() {}
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,
30 mus::View* view)
31 : surface_binding_(shell, view), next_surface_id_namespace_(1u) {}
33 SurfaceContextFactory::~SurfaceContextFactory() {
36 void SurfaceContextFactory::CreateOutputSurface(
37 base::WeakPtr<ui::Compositor> compositor) {
38 NOTIMPLEMENTED();
39 compositor->SetOutputSurface(surface_binding_.CreateOutputSurface());
42 scoped_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector(
43 ui::Compositor* mirroed_compositor,
44 ui::Layer* mirroring_layer) {
45 NOTIMPLEMENTED();
46 return make_scoped_ptr(new FakeReflector);
49 void SurfaceContextFactory::RemoveReflector(ui::Reflector* reflector) {
50 NOTIMPLEMENTED();
53 scoped_refptr<cc::ContextProvider>
54 SurfaceContextFactory::SharedMainThreadContextProvider() {
55 NOTIMPLEMENTED();
56 return nullptr;
59 void SurfaceContextFactory::RemoveCompositor(ui::Compositor* compositor) {
60 NOTIMPLEMENTED();
63 bool SurfaceContextFactory::DoesCreateTestContexts() {
64 return false;
67 uint32 SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
68 gfx::BufferUsage usage) {
69 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D.
70 return GL_TEXTURE_2D;
73 cc::SharedBitmapManager* SurfaceContextFactory::GetSharedBitmapManager() {
74 NOTIMPLEMENTED();
75 return nullptr;
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) {
95 NOTIMPLEMENTED();
98 } // namespace mandoline