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
3 // found in the LICENSE file.
5 #ifndef UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_
6 #define UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_
8 #include "cc/test/test_gpu_memory_buffer_manager.h"
9 #include "cc/test/test_shared_bitmap_manager.h"
10 #include "ui/compositor/compositor.h"
18 class ContextProviderInProcess
;
24 class InProcessContextFactory
: public ContextFactory
{
26 InProcessContextFactory();
27 ~InProcessContextFactory() override
;
29 // If true (the default) an OutputSurface is created that does not display
30 // anything. Set to false if you want to see results on the screen.
31 void set_use_test_surface(bool use_test_surface
) {
32 use_test_surface_
= use_test_surface
;
35 // ContextFactory implementation
36 void CreateOutputSurface(base::WeakPtr
<Compositor
> compositor
,
37 bool software_fallback
) override
;
39 scoped_refptr
<Reflector
> CreateReflector(Compositor
* mirrored_compositor
,
40 Layer
* mirroring_layer
) override
;
41 void RemoveReflector(scoped_refptr
<Reflector
> reflector
) override
;
43 scoped_refptr
<cc::ContextProvider
> SharedMainThreadContextProvider() override
;
44 void RemoveCompositor(Compositor
* compositor
) override
;
45 bool DoesCreateTestContexts() override
;
46 cc::SharedBitmapManager
* GetSharedBitmapManager() override
;
47 gpu::GpuMemoryBufferManager
* GetGpuMemoryBufferManager() override
;
48 base::MessageLoopProxy
* GetCompositorMessageLoop() override
;
49 scoped_ptr
<cc::SurfaceIdAllocator
> CreateSurfaceIdAllocator() override
;
50 void ResizeDisplay(ui::Compositor
* compositor
,
51 const gfx::Size
& size
) override
;
54 scoped_ptr
<base::Thread
> compositor_thread_
;
55 scoped_refptr
<webkit::gpu::ContextProviderInProcess
>
56 shared_main_thread_contexts_
;
57 cc::TestSharedBitmapManager shared_bitmap_manager_
;
58 cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_
;
59 uint32_t next_surface_id_namespace_
;
60 bool use_test_surface_
;
62 DISALLOW_COPY_AND_ASSIGN(InProcessContextFactory
);
67 #endif // UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_