Use native radiobutton for Default Search Engine picker dialog.
[chromium-blink-merge.git] / content / browser / compositor / gpu_process_transport_factory.h
blob171c030f4e5bae8b9d39701b3b0b0c2e776e24fd
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 CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_
8 #include <map>
10 #include "base/id_map.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/observer_list.h"
15 #include "content/browser/compositor/image_transport_factory.h"
16 #include "content/common/gpu/client/gpu_channel_host.h"
17 #include "ui/compositor/compositor.h"
19 namespace base {
20 class SimpleThread;
21 class Thread;
24 namespace cc {
25 class SoftwareOutputDevice;
26 class SurfaceManager;
29 namespace content {
30 class BrowserCompositorOutputSurface;
31 class CompositorSwapClient;
32 class ContextProviderCommandBuffer;
33 class OutputDeviceBacking;
34 class ReflectorImpl;
35 class WebGraphicsContext3DCommandBufferImpl;
37 class GpuProcessTransportFactory
38 : public ui::ContextFactory,
39 public ImageTransportFactory {
40 public:
41 GpuProcessTransportFactory();
43 ~GpuProcessTransportFactory() override;
45 scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
46 CreateOffscreenCommandBufferContext();
48 // ui::ContextFactory implementation.
49 void CreateOutputSurface(base::WeakPtr<ui::Compositor> compositor) override;
50 scoped_ptr<ui::Reflector> CreateReflector(ui::Compositor* source,
51 ui::Layer* target) override;
52 void RemoveReflector(ui::Reflector* reflector) override;
53 void RemoveCompositor(ui::Compositor* compositor) override;
54 scoped_refptr<cc::ContextProvider> SharedMainThreadContextProvider() override;
55 bool DoesCreateTestContexts() override;
56 uint32 GetImageTextureTarget() override;
57 cc::SharedBitmapManager* GetSharedBitmapManager() override;
58 gpu::GpuMemoryBufferManager* GetGpuMemoryBufferManager() override;
59 cc::TaskGraphRunner* GetTaskGraphRunner() override;
60 scoped_ptr<cc::SurfaceIdAllocator> CreateSurfaceIdAllocator() override;
61 void ResizeDisplay(ui::Compositor* compositor,
62 const gfx::Size& size) override;
64 // ImageTransportFactory implementation.
65 ui::ContextFactory* GetContextFactory() override;
66 gfx::GLSurfaceHandle GetSharedSurfaceHandle() override;
67 cc::SurfaceManager* GetSurfaceManager() override;
68 GLHelper* GetGLHelper() override;
69 void AddObserver(ImageTransportFactoryObserver* observer) override;
70 void RemoveObserver(ImageTransportFactoryObserver* observer) override;
71 #if defined(OS_MACOSX)
72 void OnSurfaceDisplayed(int surface_id) override;
73 void SetCompositorSuspendedForRecycle(ui::Compositor* compositor,
74 bool suspended) override;
75 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle(
76 int surface_id) const override;
77 #endif
79 private:
80 struct PerCompositorData;
82 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor);
83 scoped_ptr<cc::SoftwareOutputDevice> CreateSoftwareOutputDevice(
84 ui::Compositor* compositor);
85 void EstablishedGpuChannel(base::WeakPtr<ui::Compositor> compositor,
86 bool create_gpu_output_surface,
87 int num_attempts);
88 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContextCommon(
89 scoped_refptr<GpuChannelHost> gpu_channel_host,
90 int surface_id);
92 void OnLostMainThreadSharedContextInsideCallback();
93 void OnLostMainThreadSharedContext();
95 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap;
96 PerCompositorDataMap per_compositor_data_;
97 scoped_refptr<ContextProviderCommandBuffer> shared_main_thread_contexts_;
98 scoped_ptr<GLHelper> gl_helper_;
99 ObserverList<ImageTransportFactoryObserver> observer_list_;
100 scoped_ptr<cc::SurfaceManager> surface_manager_;
101 uint32_t next_surface_id_namespace_;
102 scoped_ptr<cc::TaskGraphRunner> task_graph_runner_;
103 scoped_ptr<base::SimpleThread> raster_thread_;
105 #if defined(OS_WIN)
106 scoped_ptr<OutputDeviceBacking> software_backing_;
107 #endif
109 // The contents of this map and its methods may only be used on the compositor
110 // thread.
111 IDMap<BrowserCompositorOutputSurface> output_surface_map_;
113 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_;
115 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory);
118 } // namespace content
120 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_