| 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/surfaces/display_scheduler.h" | |
| 15 #include "cc/surfaces/surface_aggregator.h" | 14 #include "cc/surfaces/surface_aggregator.h" |
| 16 #include "cc/surfaces/surface_id.h" | 15 #include "cc/surfaces/surface_id.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 16 #include "cc/surfaces/surface_manager.h" |
| 18 #include "cc/surfaces/surfaces_export.h" | 17 #include "cc/surfaces/surfaces_export.h" |
| 19 #include "ui/events/latency_info.h" | 18 #include "ui/events/latency_info.h" |
| 20 | 19 |
| 21 namespace gpu { | 20 namespace gpu { |
| 22 class GpuMemoryBufferManager; | 21 class GpuMemoryBufferManager; |
| 23 } | 22 } |
| 24 | 23 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 37 class SharedBitmapManager; | 36 class SharedBitmapManager; |
| 38 class Surface; | 37 class Surface; |
| 39 class SurfaceAggregator; | 38 class SurfaceAggregator; |
| 40 class SurfaceIdAllocator; | 39 class SurfaceIdAllocator; |
| 41 class SurfaceFactory; | 40 class SurfaceFactory; |
| 42 class TextureMailboxDeleter; | 41 class TextureMailboxDeleter; |
| 43 | 42 |
| 44 // A Display produces a surface that can be used to draw to a physical display | 43 // A Display produces a surface that can be used to draw to a physical display |
| 45 // (OutputSurface). The client is responsible for creating and sizing the | 44 // (OutputSurface). The client is responsible for creating and sizing the |
| 46 // surface IDs used to draw into the display and deciding when to draw. | 45 // surface IDs used to draw into the display and deciding when to draw. |
| 47 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient, | 46 class CC_SURFACES_EXPORT Display : public OutputSurfaceClient, |
| 48 public OutputSurfaceClient, | |
| 49 public RendererClient, | 47 public RendererClient, |
| 50 public SurfaceDamageObserver { | 48 public SurfaceDamageObserver { |
| 51 public: | 49 public: |
| 52 Display(DisplayClient* client, | 50 Display(DisplayClient* client, |
| 53 SurfaceManager* manager, | 51 SurfaceManager* manager, |
| 54 SharedBitmapManager* bitmap_manager, | 52 SharedBitmapManager* bitmap_manager, |
| 55 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 53 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 56 const RendererSettings& settings); | 54 const RendererSettings& settings); |
| 57 ~Display() override; | 55 ~Display() override; |
| 58 | 56 |
| 59 bool Initialize(scoped_ptr<OutputSurface> output_surface, | 57 bool Initialize(scoped_ptr<OutputSurface> output_surface); |
| 60 DisplayScheduler* scheduler); | |
| 61 | 58 |
| 62 // device_scale_factor is used to communicate to the external window system | 59 // device_scale_factor is used to communicate to the external window system |
| 63 // what scale this was rendered at. | 60 // what scale this was rendered at. |
| 64 void SetSurfaceId(SurfaceId id, float device_scale_factor); | 61 void SetSurfaceId(SurfaceId id, float device_scale_factor); |
| 65 void Resize(const gfx::Size& new_size); | 62 void Resize(const gfx::Size& new_size); |
| 63 bool Draw(); |
| 66 | 64 |
| 67 SurfaceId CurrentSurfaceId(); | 65 SurfaceId CurrentSurfaceId(); |
| 68 | 66 int GetMaxFramesPending(); |
| 69 // DisplaySchedulerClient implementation. | |
| 70 bool DrawAndSwap() override; | |
| 71 | 67 |
| 72 // OutputSurfaceClient implementation. | 68 // OutputSurfaceClient implementation. |
| 73 void CommitVSyncParameters(base::TimeTicks timebase, | 69 void CommitVSyncParameters(base::TimeTicks timebase, |
| 74 base::TimeDelta interval) override; | 70 base::TimeDelta interval) override; |
| 75 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; | 71 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; |
| 76 void DidSwapBuffers() override; | 72 void DidSwapBuffers() override; |
| 77 void DidSwapBuffersComplete() override; | 73 void DidSwapBuffersComplete() override; |
| 78 void ReclaimResources(const CompositorFrameAck* ack) override; | 74 void ReclaimResources(const CompositorFrameAck* ack) override; |
| 79 void DidLoseOutputSurface() override; | 75 void DidLoseOutputSurface() override; |
| 80 void SetExternalDrawConstraints( | 76 void SetExternalDrawConstraints( |
| 81 const gfx::Transform& transform, | 77 const gfx::Transform& transform, |
| 82 const gfx::Rect& viewport, | 78 const gfx::Rect& viewport, |
| 83 const gfx::Rect& clip, | 79 const gfx::Rect& clip, |
| 84 const gfx::Rect& viewport_rect_for_tile_priority, | 80 const gfx::Rect& viewport_rect_for_tile_priority, |
| 85 const gfx::Transform& transform_for_tile_priority, | 81 const gfx::Transform& transform_for_tile_priority, |
| 86 bool resourceless_software_draw) override; | 82 bool resourceless_software_draw) override; |
| 87 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; | 83 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; |
| 88 void SetTreeActivationCallback(const base::Closure& callback) override; | 84 void SetTreeActivationCallback(const base::Closure& callback) override; |
| 89 void OnDraw() override; | 85 void OnDraw() override; |
| 90 | 86 |
| 91 // RendererClient implementation. | 87 // RendererClient implementation. |
| 92 void SetFullRootLayerDamage() override; | 88 void SetFullRootLayerDamage() override; |
| 93 | 89 |
| 94 // SurfaceDamageObserver implementation. | 90 // SurfaceDamageObserver implementation. |
| 95 void OnSurfaceDamaged(SurfaceId surface, bool* changed) override; | 91 void OnSurfaceDamaged(SurfaceId surface, bool* changed) override; |
| 96 | 92 |
| 97 private: | 93 private: |
| 98 void InitializeRenderer(); | 94 void InitializeRenderer(); |
| 99 void UpdateResourcesLockedByBrowser(); | |
| 100 | 95 |
| 101 DisplayClient* client_; | 96 DisplayClient* client_; |
| 102 SurfaceManager* manager_; | 97 SurfaceManager* manager_; |
| 103 SharedBitmapManager* bitmap_manager_; | 98 SharedBitmapManager* bitmap_manager_; |
| 104 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 99 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 105 RendererSettings settings_; | 100 RendererSettings settings_; |
| 106 SurfaceId current_surface_id_; | 101 SurfaceId current_surface_id_; |
| 107 gfx::Size current_surface_size_; | 102 gfx::Size current_surface_size_; |
| 108 float device_scale_factor_; | 103 float device_scale_factor_; |
| 109 scoped_ptr<OutputSurface> output_surface_; | 104 scoped_ptr<OutputSurface> output_surface_; |
| 110 DisplayScheduler* scheduler_; | |
| 111 scoped_ptr<ResourceProvider> resource_provider_; | 105 scoped_ptr<ResourceProvider> resource_provider_; |
| 112 scoped_ptr<SurfaceAggregator> aggregator_; | 106 scoped_ptr<SurfaceAggregator> aggregator_; |
| 113 scoped_ptr<DirectRenderer> renderer_; | 107 scoped_ptr<DirectRenderer> renderer_; |
| 114 scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_; | 108 scoped_ptr<BlockingTaskRunner> blocking_main_thread_task_runner_; |
| 115 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; | 109 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; |
| 116 std::vector<ui::LatencyInfo> stored_latency_info_; | 110 std::vector<ui::LatencyInfo> stored_latency_info_; |
| 117 | 111 |
| 118 DISALLOW_COPY_AND_ASSIGN(Display); | 112 DISALLOW_COPY_AND_ASSIGN(Display); |
| 119 }; | 113 }; |
| 120 | 114 |
| 121 } // namespace cc | 115 } // namespace cc |
| 122 | 116 |
| 123 #endif // CC_SURFACES_DISPLAY_H_ | 117 #endif // CC_SURFACES_DISPLAY_H_ |
| OLD | NEW |