| 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 CC_SURFACES_DISPLAY_H_ | 5 #ifndef CC_SURFACES_DISPLAY_H_ |
| 6 #define CC_SURFACES_DISPLAY_H_ | 6 #define CC_SURFACES_DISPLAY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/output/output_surface_client.h" | 11 #include "cc/output/output_surface_client.h" |
| 12 #include "cc/output/renderer.h" | 12 #include "cc/output/renderer.h" |
| 13 #include "cc/resources/returned_resource.h" | 13 #include "cc/resources/returned_resource.h" |
| 14 #include "cc/scheduler/begin_frame_source.h" |
| 14 #include "cc/surfaces/display_scheduler.h" | 15 #include "cc/surfaces/display_scheduler.h" |
| 15 #include "cc/surfaces/surface_aggregator.h" | 16 #include "cc/surfaces/surface_aggregator.h" |
| 16 #include "cc/surfaces/surface_id.h" | 17 #include "cc/surfaces/surface_id.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 18 #include "cc/surfaces/surface_manager.h" |
| 18 #include "cc/surfaces/surfaces_export.h" | 19 #include "cc/surfaces/surfaces_export.h" |
| 19 #include "ui/events/latency_info.h" | 20 #include "ui/events/latency_info.h" |
| 20 | 21 |
| 21 namespace gpu { | 22 namespace gpu { |
| 22 class GpuMemoryBufferManager; | 23 class GpuMemoryBufferManager; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace gfx { | 26 namespace gfx { |
| 26 class Size; | 27 class Size; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace cc { | 30 namespace cc { |
| 30 | 31 |
| 32 class BeginFrameSource; |
| 31 class DirectRenderer; | 33 class DirectRenderer; |
| 32 class DisplayClient; | 34 class DisplayClient; |
| 33 class OutputSurface; | 35 class OutputSurface; |
| 34 class RendererSettings; | 36 class RendererSettings; |
| 35 class ResourceProvider; | 37 class ResourceProvider; |
| 36 class SharedBitmapManager; | 38 class SharedBitmapManager; |
| 37 class Surface; | 39 class Surface; |
| 38 class SurfaceAggregator; | 40 class SurfaceAggregator; |
| 39 class SurfaceIdAllocator; | 41 class SurfaceIdAllocator; |
| 40 class SurfaceFactory; | 42 class SurfaceFactory; |
| 41 class TextureMailboxDeleter; | 43 class TextureMailboxDeleter; |
| 42 | 44 |
| 43 // A Display produces a surface that can be used to draw to a physical display | 45 // A Display produces a surface that can be used to draw to a physical display |
| 44 // (OutputSurface). The client is responsible for creating and sizing the | 46 // (OutputSurface). The client is responsible for creating and sizing the |
| 45 // surface IDs used to draw into the display and deciding when to draw. | 47 // surface IDs used to draw into the display and deciding when to draw. |
| 46 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient, | 48 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient, |
| 47 public OutputSurfaceClient, | 49 public OutputSurfaceClient, |
| 48 public RendererClient, | 50 public RendererClient, |
| 51 public SurfaceAggregatorClient, |
| 49 public SurfaceDamageObserver { | 52 public SurfaceDamageObserver { |
| 50 public: | 53 public: |
| 51 Display(DisplayClient* client, | 54 Display(DisplayClient* client, |
| 52 SurfaceManager* manager, | 55 SurfaceManager* manager, |
| 53 SharedBitmapManager* bitmap_manager, | 56 SharedBitmapManager* bitmap_manager, |
| 54 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 57 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 55 const RendererSettings& settings); | 58 const RendererSettings& settings); |
| 56 ~Display() override; | 59 ~Display() override; |
| 57 | 60 |
| 58 bool Initialize(scoped_ptr<OutputSurface> output_surface, | 61 bool Initialize(scoped_ptr<OutputSurface> output_surface, |
| 59 DisplayScheduler* scheduler); | 62 DisplayScheduler* scheduler); |
| 60 | 63 |
| 61 // device_scale_factor is used to communicate to the external window system | 64 // device_scale_factor is used to communicate to the external window system |
| 62 // what scale this was rendered at. | 65 // what scale this was rendered at. |
| 63 void SetSurfaceId(SurfaceId id, float device_scale_factor); | 66 void SetSurfaceId(SurfaceId id, float device_scale_factor); |
| 64 void Resize(const gfx::Size& new_size); | 67 void Resize(const gfx::Size& new_size); |
| 65 void SetExternalClip(const gfx::Rect& clip); | 68 void SetExternalClip(const gfx::Rect& clip); |
| 66 | 69 |
| 67 SurfaceId CurrentSurfaceId(); | 70 SurfaceId CurrentSurfaceId(); |
| 68 | 71 |
| 72 // SurfaceAggregatorClient implementation |
| 73 void AddSurface(Surface* surface) override; |
| 74 void RemoveSurface(Surface* surface) override; |
| 75 |
| 69 // DisplaySchedulerClient implementation. | 76 // DisplaySchedulerClient implementation. |
| 70 bool DrawAndSwap() override; | 77 bool DrawAndSwap() override; |
| 71 | 78 |
| 72 // OutputSurfaceClient implementation. | 79 // OutputSurfaceClient implementation. |
| 73 void CommitVSyncParameters(base::TimeTicks timebase, | 80 void CommitVSyncParameters(base::TimeTicks timebase, |
| 74 base::TimeDelta interval) override; | 81 base::TimeDelta interval) override; |
| 75 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; | 82 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; |
| 76 void DidSwapBuffers() override; | 83 void DidSwapBuffers() override; |
| 77 void DidSwapBuffersComplete() override; | 84 void DidSwapBuffersComplete() override; |
| 78 void ReclaimResources(const CompositorFrameAck* ack) override; | 85 void ReclaimResources(const CompositorFrameAck* ack) override; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 scoped_ptr<DirectRenderer> renderer_; | 122 scoped_ptr<DirectRenderer> renderer_; |
| 116 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; | 123 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; |
| 117 std::vector<ui::LatencyInfo> stored_latency_info_; | 124 std::vector<ui::LatencyInfo> stored_latency_info_; |
| 118 | 125 |
| 119 DISALLOW_COPY_AND_ASSIGN(Display); | 126 DISALLOW_COPY_AND_ASSIGN(Display); |
| 120 }; | 127 }; |
| 121 | 128 |
| 122 } // namespace cc | 129 } // namespace cc |
| 123 | 130 |
| 124 #endif // CC_SURFACES_DISPLAY_H_ | 131 #endif // CC_SURFACES_DISPLAY_H_ |
| OLD | NEW |