| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 6 #define CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
| 11 #include "cc/output/output_surface.h" | 11 #include "cc/output/output_surface.h" |
| 12 | 12 |
| 13 namespace base { class MessageLoopProxy; } | 13 namespace base { class MessageLoopProxy; } |
| 14 | 14 |
| 15 namespace cc { |
| 16 class SoftwareOutputDevice; |
| 17 } |
| 18 |
| 15 namespace ui { class Compositor; } | 19 namespace ui { class Compositor; } |
| 16 | 20 |
| 17 namespace content { | 21 namespace content { |
| 18 class ContextProviderCommandBuffer; | 22 class ContextProviderCommandBuffer; |
| 19 class ReflectorImpl; | 23 class ReflectorImpl; |
| 20 class WebGraphicsContext3DCommandBufferImpl; | 24 class WebGraphicsContext3DCommandBufferImpl; |
| 21 | 25 |
| 22 // Adapts a WebGraphicsContext3DCommandBufferImpl into a | |
| 23 // cc::OutputSurface that also handles vsync parameter updates | |
| 24 // arriving from the GPU process. | |
| 25 class BrowserCompositorOutputSurface | 26 class BrowserCompositorOutputSurface |
| 26 : public cc::OutputSurface, | 27 : public cc::OutputSurface, |
| 27 public base::NonThreadSafe { | 28 public base::NonThreadSafe { |
| 28 public: | 29 public: |
| 30 virtual ~BrowserCompositorOutputSurface(); |
| 31 |
| 32 // cc::OutputSurface implementation. |
| 33 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
| 34 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; |
| 35 |
| 36 void OnUpdateVSyncParameters(base::TimeTicks timebase, |
| 37 base::TimeDelta interval); |
| 38 |
| 39 void SetReflector(ReflectorImpl* reflector); |
| 40 |
| 41 protected: |
| 42 // Constructor used by the accelerated implementation. |
| 29 BrowserCompositorOutputSurface( | 43 BrowserCompositorOutputSurface( |
| 30 const scoped_refptr<ContextProviderCommandBuffer>& context, | 44 const scoped_refptr<ContextProviderCommandBuffer>& context, |
| 31 int surface_id, | 45 int surface_id, |
| 32 IDMap<BrowserCompositorOutputSurface>* output_surface_map, | 46 IDMap<BrowserCompositorOutputSurface>* output_surface_map, |
| 33 base::MessageLoopProxy* compositor_message_loop, | 47 base::MessageLoopProxy* compositor_message_loop, |
| 34 base::WeakPtr<ui::Compositor> compositor); | 48 base::WeakPtr<ui::Compositor> compositor); |
| 35 | 49 |
| 36 virtual ~BrowserCompositorOutputSurface(); | 50 // Constructor used by the software implementation. |
| 51 BrowserCompositorOutputSurface( |
| 52 scoped_ptr<cc::SoftwareOutputDevice> software_device, |
| 53 int surface_id, |
| 54 IDMap<BrowserCompositorOutputSurface>* output_surface_map, |
| 55 base::MessageLoopProxy* compositor_message_loop, |
| 56 base::WeakPtr<ui::Compositor> compositor); |
| 37 | 57 |
| 38 // cc::OutputSurface implementation. | |
| 39 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; | |
| 40 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE; | |
| 41 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; | |
| 42 | |
| 43 void OnUpdateVSyncParameters(base::TimeTicks timebase, | |
| 44 base::TimeDelta interval); | |
| 45 | |
| 46 void SetReflector(ReflectorImpl* reflector); | |
| 47 | |
| 48 private: | |
| 49 int surface_id_; | 58 int surface_id_; |
| 50 IDMap<BrowserCompositorOutputSurface>* output_surface_map_; | 59 IDMap<BrowserCompositorOutputSurface>* output_surface_map_; |
| 51 | 60 |
| 52 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; | 61 scoped_refptr<base::MessageLoopProxy> compositor_message_loop_; |
| 53 base::WeakPtr<ui::Compositor> compositor_; | 62 base::WeakPtr<ui::Compositor> compositor_; |
| 54 scoped_refptr<ReflectorImpl> reflector_; | 63 scoped_refptr<ReflectorImpl> reflector_; |
| 55 }; | 64 }; |
| 56 | 65 |
| 57 } // namespace content | 66 } // namespace content |
| 58 | 67 |
| 59 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 68 #endif // CONTENT_BROWSER_AURA_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |