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