Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: cc/surfaces/display.h

Issue 1821863002: Hook up ui::Compositor to Display's BeginFrameSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Display member destruction order Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/output_surface_unittest.cc ('k') | cc/surfaces/display.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // surface IDs used to draw into the display and deciding when to draw. 48 // surface IDs used to draw into the display and deciding when to draw.
49 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient, 49 class CC_SURFACES_EXPORT Display : public DisplaySchedulerClient,
50 public OutputSurfaceClient, 50 public OutputSurfaceClient,
51 public RendererClient, 51 public RendererClient,
52 public SurfaceDamageObserver { 52 public SurfaceDamageObserver {
53 public: 53 public:
54 Display(DisplayClient* client, 54 Display(DisplayClient* client,
55 SurfaceManager* manager, 55 SurfaceManager* manager,
56 SharedBitmapManager* bitmap_manager, 56 SharedBitmapManager* bitmap_manager,
57 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 57 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
58 const RendererSettings& settings); 58 const RendererSettings& settings,
59 uint32_t compositor_surface_namespace);
59 ~Display() override; 60 ~Display() override;
60 61
61 bool Initialize(std::unique_ptr<OutputSurface> output_surface, 62 bool Initialize(std::unique_ptr<OutputSurface> output_surface,
62 DisplayScheduler* scheduler); 63 base::SingleThreadTaskRunner* task_runner);
63 64
64 // device_scale_factor is used to communicate to the external window system 65 // device_scale_factor is used to communicate to the external window system
65 // what scale this was rendered at. 66 // what scale this was rendered at.
66 void SetSurfaceId(SurfaceId id, float device_scale_factor); 67 void SetSurfaceId(SurfaceId id, float device_scale_factor);
67 void Resize(const gfx::Size& new_size); 68 void Resize(const gfx::Size& new_size);
68 void SetExternalClip(const gfx::Rect& clip); 69 void SetExternalClip(const gfx::Rect& clip);
69 70
70 SurfaceId CurrentSurfaceId(); 71 SurfaceId CurrentSurfaceId();
71 72
72 // DisplaySchedulerClient implementation. 73 // DisplaySchedulerClient implementation.
73 bool DrawAndSwap() override; 74 bool DrawAndSwap() override;
74 75
75 // OutputSurfaceClient implementation. 76 // OutputSurfaceClient implementation.
76 void CommitVSyncParameters(base::TimeTicks timebase, 77 void CommitVSyncParameters(base::TimeTicks timebase,
77 base::TimeDelta interval) override; 78 base::TimeDelta interval) override {}
79 void SetBeginFrameSource(BeginFrameSource* source) override;
78 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; 80 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
79 void DidSwapBuffers() override; 81 void DidSwapBuffers() override;
80 void DidSwapBuffersComplete() override; 82 void DidSwapBuffersComplete() override;
81 void ReclaimResources(const CompositorFrameAck* ack) override; 83 void ReclaimResources(const CompositorFrameAck* ack) override;
82 void DidLoseOutputSurface() override; 84 void DidLoseOutputSurface() override;
83 void SetExternalTilePriorityConstraints( 85 void SetExternalTilePriorityConstraints(
84 const gfx::Rect& viewport_rect, 86 const gfx::Rect& viewport_rect,
85 const gfx::Transform& transform) override; 87 const gfx::Transform& transform) override;
86 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; 88 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
87 void SetTreeActivationCallback(const base::Closure& callback) override; 89 void SetTreeActivationCallback(const base::Closure& callback) override;
88 void OnDraw(const gfx::Transform& transform, 90 void OnDraw(const gfx::Transform& transform,
89 const gfx::Rect& viewport, 91 const gfx::Rect& viewport,
90 const gfx::Rect& clip, 92 const gfx::Rect& clip,
91 bool resourceless_software_draw) override; 93 bool resourceless_software_draw) override;
92 94
93 // RendererClient implementation. 95 // RendererClient implementation.
94 void SetFullRootLayerDamage() override; 96 void SetFullRootLayerDamage() override;
95 97
96 // SurfaceDamageObserver implementation. 98 // SurfaceDamageObserver implementation.
97 void OnSurfaceDamaged(SurfaceId surface, bool* changed) override; 99 void OnSurfaceDamaged(SurfaceId surface, bool* changed) override;
98 100
99 private: 101 protected:
102 // Virtual for tests.
103 virtual void CreateScheduler(base::SingleThreadTaskRunner* task_runner);
104
100 void InitializeRenderer(); 105 void InitializeRenderer();
101 void UpdateRootSurfaceResourcesLocked(); 106 void UpdateRootSurfaceResourcesLocked();
102 107
103 DisplayClient* client_; 108 DisplayClient* client_;
104 SurfaceManager* manager_; 109 SurfaceManager* surface_manager_;
105 SharedBitmapManager* bitmap_manager_; 110 SharedBitmapManager* bitmap_manager_;
106 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 111 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
107 RendererSettings settings_; 112 RendererSettings settings_;
108 SurfaceId current_surface_id_; 113 SurfaceId current_surface_id_;
114 uint32_t compositor_surface_namespace_;
109 gfx::Size current_surface_size_; 115 gfx::Size current_surface_size_;
110 float device_scale_factor_; 116 float device_scale_factor_;
111 bool swapped_since_resize_; 117 bool swapped_since_resize_;
112 gfx::Rect external_clip_; 118 gfx::Rect external_clip_;
113 std::unique_ptr<OutputSurface> output_surface_; 119 std::unique_ptr<OutputSurface> output_surface_;
114 DisplayScheduler* scheduler_; 120 // An internal synthetic BFS. May be null when not used.
121 std::unique_ptr<BeginFrameSource> internal_begin_frame_source_;
122 // The real BFS tied to vsync provided by the BrowserCompositorOutputSurface.
123 BeginFrameSource* vsync_begin_frame_source_;
124 // The current BFS driving the Display/DisplayScheduler.
125 BeginFrameSource* observed_begin_frame_source_;
126 std::unique_ptr<DisplayScheduler> scheduler_;
115 std::unique_ptr<ResourceProvider> resource_provider_; 127 std::unique_ptr<ResourceProvider> resource_provider_;
116 std::unique_ptr<SurfaceAggregator> aggregator_; 128 std::unique_ptr<SurfaceAggregator> aggregator_;
117 std::unique_ptr<DirectRenderer> renderer_; 129 std::unique_ptr<DirectRenderer> renderer_;
118 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; 130 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
119 std::vector<ui::LatencyInfo> stored_latency_info_; 131 std::vector<ui::LatencyInfo> stored_latency_info_;
120 132
133 private:
121 DISALLOW_COPY_AND_ASSIGN(Display); 134 DISALLOW_COPY_AND_ASSIGN(Display);
122 }; 135 };
123 136
124 } // namespace cc 137 } // namespace cc
125 138
126 #endif // CC_SURFACES_DISPLAY_H_ 139 #endif // CC_SURFACES_DISPLAY_H_
OLDNEW
« no previous file with comments | « cc/output/output_surface_unittest.cc ('k') | cc/surfaces/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698