Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / compositor / test / in_process_context_factory.h
blobe996bc2d4ec82d8056cd3ef0f5397242440b6710
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_image_factory.h"
10 #include "cc/test/test_shared_bitmap_manager.h"
11 #include "cc/test/test_task_graph_runner.h"
12 #include "ui/compositor/compositor.h"
14 namespace base {
15 class Thread;
18 namespace cc {
19 class OnscreenDisplayClient;
20 class SurfaceManager;
23 namespace ui {
25 class InProcessContextFactory : public ContextFactory {
26 public:
27 // surface_manager is owned by the creator of this and must outlive the
28 // context factory.
29 InProcessContextFactory(bool context_factory_for_test,
30 cc::SurfaceManager* surface_manager);
31 ~InProcessContextFactory() override;
33 // If true (the default) an OutputSurface is created that does not display
34 // anything. Set to false if you want to see results on the screen.
35 void set_use_test_surface(bool use_test_surface) {
36 use_test_surface_ = use_test_surface;
39 // ContextFactory implementation
40 void CreateOutputSurface(base::WeakPtr<Compositor> compositor) override;
42 scoped_ptr<Reflector> CreateReflector(Compositor* mirrored_compositor,
43 Layer* mirroring_layer) override;
44 void RemoveReflector(Reflector* reflector) override;
46 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override;
47 void RemoveCompositor(Compositor* compositor) override;
48 bool DoesCreateTestContexts() override;
49 uint32 GetImageTextureTarget(gfx::GpuMemoryBuffer::Format format,
50 gfx::GpuMemoryBuffer::Usage usage) override;
51 cc::SharedBitmapManager* GetSharedBitmapManager() override;
52 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
53 cc::TaskGraphRunner* GetTaskGraphRunner() override;
54 scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() override;
55 void ResizeDisplay(ui::Compositor* compositor,
56 const gfx::Size& size) override;
58 private:
59 scoped_refptr<cc::ContextProvider> shared_main_thread_contexts_;
60 cc::TestSharedBitmapManager shared_bitmap_manager_;
61 cc::TestGpuMemoryBufferManager gpu_memory_buffer_manager_;
62 cc::TestImageFactory image_factory_;
63 cc::TestTaskGraphRunner task_graph_runner_;
64 uint32_t next_surface_id_namespace_;
65 bool use_test_surface_;
66 bool context_factory_for_test_;
67 cc::SurfaceManager* surface_manager_;
69 base::hash_map<Compositor*, cc::OnscreenDisplayClient*> per_compositor_data_;
71 DISALLOW_COPY_AND_ASSIGN(InProcessContextFactory);
74 } // namespace ui
76 #endif // UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_FACTORY_H_