| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "content/browser/compositor/image_transport_factory.h" | 15 #include "content/browser/compositor/image_transport_factory.h" |
| 16 #include "ui/compositor/compositor.h" | 16 #include "ui/compositor/compositor.h" |
| 17 | 17 |
| 18 namespace base { |
| 19 class Thread; |
| 20 } |
| 21 |
| 18 namespace content { | 22 namespace content { |
| 19 class BrowserCompositorOutputSurface; | 23 class BrowserCompositorOutputSurface; |
| 20 class BrowserCompositorOutputSurfaceProxy; | 24 class BrowserCompositorOutputSurfaceProxy; |
| 21 class CompositorSwapClient; | 25 class CompositorSwapClient; |
| 22 class ContextProviderCommandBuffer; | 26 class ContextProviderCommandBuffer; |
| 23 class ReflectorImpl; | 27 class ReflectorImpl; |
| 24 class WebGraphicsContext3DCommandBufferImpl; | 28 class WebGraphicsContext3DCommandBufferImpl; |
| 25 | 29 |
| 26 class GpuProcessTransportFactory | 30 class GpuProcessTransportFactory |
| 27 : public ui::ContextFactory, | 31 : public ui::ContextFactory, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 virtual scoped_refptr<ui::Reflector> CreateReflector( | 44 virtual scoped_refptr<ui::Reflector> CreateReflector( |
| 41 ui::Compositor* source, | 45 ui::Compositor* source, |
| 42 ui::Layer* target) OVERRIDE; | 46 ui::Layer* target) OVERRIDE; |
| 43 virtual void RemoveReflector( | 47 virtual void RemoveReflector( |
| 44 scoped_refptr<ui::Reflector> reflector) OVERRIDE; | 48 scoped_refptr<ui::Reflector> reflector) OVERRIDE; |
| 45 virtual void RemoveCompositor(ui::Compositor* compositor) OVERRIDE; | 49 virtual void RemoveCompositor(ui::Compositor* compositor) OVERRIDE; |
| 46 virtual scoped_refptr<cc::ContextProvider> | 50 virtual scoped_refptr<cc::ContextProvider> |
| 47 SharedMainThreadContextProvider() OVERRIDE; | 51 SharedMainThreadContextProvider() OVERRIDE; |
| 48 virtual bool DoesCreateTestContexts() OVERRIDE; | 52 virtual bool DoesCreateTestContexts() OVERRIDE; |
| 49 virtual cc::SharedBitmapManager* GetSharedBitmapManager() OVERRIDE; | 53 virtual cc::SharedBitmapManager* GetSharedBitmapManager() OVERRIDE; |
| 54 virtual base::MessageLoopProxy* GetCompositorMessageLoop() OVERRIDE; |
| 50 | 55 |
| 51 // ImageTransportFactory implementation. | 56 // ImageTransportFactory implementation. |
| 52 virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() OVERRIDE; | 57 virtual gfx::GLSurfaceHandle GetSharedSurfaceHandle() OVERRIDE; |
| 53 virtual GLHelper* GetGLHelper() OVERRIDE; | 58 virtual GLHelper* GetGLHelper() OVERRIDE; |
| 54 virtual void AddObserver(ImageTransportFactoryObserver* observer) OVERRIDE; | 59 virtual void AddObserver(ImageTransportFactoryObserver* observer) OVERRIDE; |
| 55 virtual void RemoveObserver( | 60 virtual void RemoveObserver( |
| 56 ImageTransportFactoryObserver* observer) OVERRIDE; | 61 ImageTransportFactoryObserver* observer) OVERRIDE; |
| 57 | 62 |
| 58 private: | 63 private: |
| 59 struct PerCompositorData; | 64 struct PerCompositorData; |
| 60 | 65 |
| 61 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); | 66 PerCompositorData* CreatePerCompositorData(ui::Compositor* compositor); |
| 62 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 67 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 63 CreateContextCommon(int surface_id); | 68 CreateContextCommon(int surface_id); |
| 64 | 69 |
| 65 void OnLostMainThreadSharedContextInsideCallback(); | 70 void OnLostMainThreadSharedContextInsideCallback(); |
| 66 void OnLostMainThreadSharedContext(); | 71 void OnLostMainThreadSharedContext(); |
| 67 | 72 |
| 68 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap; | 73 typedef std::map<ui::Compositor*, PerCompositorData*> PerCompositorDataMap; |
| 74 scoped_ptr<base::Thread> compositor_thread_; |
| 69 PerCompositorDataMap per_compositor_data_; | 75 PerCompositorDataMap per_compositor_data_; |
| 70 scoped_refptr<ContextProviderCommandBuffer> shared_main_thread_contexts_; | 76 scoped_refptr<ContextProviderCommandBuffer> shared_main_thread_contexts_; |
| 71 scoped_ptr<GLHelper> gl_helper_; | 77 scoped_ptr<GLHelper> gl_helper_; |
| 72 ObserverList<ImageTransportFactoryObserver> observer_list_; | 78 ObserverList<ImageTransportFactoryObserver> observer_list_; |
| 73 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; | 79 base::WeakPtrFactory<GpuProcessTransportFactory> callback_factory_; |
| 74 | 80 |
| 75 // The contents of this map and its methods may only be used on the compositor | 81 // The contents of this map and its methods may only be used on the compositor |
| 76 // thread. | 82 // thread. |
| 77 IDMap<BrowserCompositorOutputSurface> output_surface_map_; | 83 IDMap<BrowserCompositorOutputSurface> output_surface_map_; |
| 78 | 84 |
| 79 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; | 85 scoped_refptr<BrowserCompositorOutputSurfaceProxy> output_surface_proxy_; |
| 80 | 86 |
| 81 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); | 87 DISALLOW_COPY_AND_ASSIGN(GpuProcessTransportFactory); |
| 82 }; | 88 }; |
| 83 | 89 |
| 84 } // namespace content | 90 } // namespace content |
| 85 | 91 |
| 86 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ | 92 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_PROCESS_TRANSPORT_FACTORY_H_ |
| OLD | NEW |