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

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

Issue 2527283003: cc: Introduce BeginFrame sequence numbers and acknowledgements.
Patch Set: Address Brian's comments. Created 4 years 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/surfaces/direct_compositor_frame_sink_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
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "cc/output/output_surface_client.h" 12 #include "cc/output/output_surface_client.h"
13 #include "cc/resources/returned_resource.h" 13 #include "cc/resources/returned_resource.h"
14 #include "cc/scheduler/begin_frame_source.h"
15 #include "cc/surfaces/display_scheduler.h" 14 #include "cc/surfaces/display_scheduler.h"
16 #include "cc/surfaces/frame_sink_id.h" 15 #include "cc/surfaces/frame_sink_id.h"
17 #include "cc/surfaces/surface_aggregator.h" 16 #include "cc/surfaces/surface_aggregator.h"
18 #include "cc/surfaces/surface_id.h" 17 #include "cc/surfaces/surface_id.h"
19 #include "cc/surfaces/surface_manager.h" 18 #include "cc/surfaces/surface_manager.h"
20 #include "cc/surfaces/surfaces_export.h" 19 #include "cc/surfaces/surfaces_export.h"
21 #include "gpu/command_buffer/common/texture_in_use_response.h" 20 #include "gpu/command_buffer/common/texture_in_use_response.h"
22 #include "ui/events/latency_info.h" 21 #include "ui/events/latency_info.h"
23 #include "ui/gfx/color_space.h" 22 #include "ui/gfx/color_space.h"
24 23
25 namespace gpu { 24 namespace gpu {
26 class GpuMemoryBufferManager; 25 class GpuMemoryBufferManager;
27 } 26 }
28 27
29 namespace gfx { 28 namespace gfx {
30 class Size; 29 class Size;
31 } 30 }
32 31
33 namespace cc { 32 namespace cc {
34 33
35 class BeginFrameSource; 34 class BeginFrameSource;
36 class DirectRenderer; 35 class DirectRenderer;
36 class DisplayBeginFrameSource;
37 class DisplayClient; 37 class DisplayClient;
38 class OutputSurface; 38 class OutputSurface;
39 class RendererSettings; 39 class RendererSettings;
40 class ResourceProvider; 40 class ResourceProvider;
41 class SharedBitmapManager; 41 class SharedBitmapManager;
42 class SoftwareRenderer; 42 class SoftwareRenderer;
43 class SurfaceAggregator; 43 class SurfaceAggregator;
44 class TextureMailboxDeleter; 44 class TextureMailboxDeleter;
45 45
46 // A Display produces a surface that can be used to draw to a physical display 46 // A Display produces a surface that can be used to draw to a physical display
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void OnSurfaceDamaged(const SurfaceId& surface, bool* changed) override; 88 void OnSurfaceDamaged(const SurfaceId& surface, bool* changed) override;
89 void OnSurfaceCreated(const SurfaceId& surface_id, 89 void OnSurfaceCreated(const SurfaceId& surface_id,
90 const gfx::Size& frame, 90 const gfx::Size& frame,
91 float device_scale_factor) override; 91 float device_scale_factor) override;
92 92
93 bool has_scheduler() const { return !!scheduler_; } 93 bool has_scheduler() const { return !!scheduler_; }
94 DirectRenderer* renderer_for_testing() const { return renderer_.get(); } 94 DirectRenderer* renderer_for_testing() const { return renderer_.get(); }
95 95
96 void ForceImmediateDrawAndSwapIfPossible(); 96 void ForceImmediateDrawAndSwapIfPossible();
97 97
98 // Swap the Display's current BeginFrameSource with the provided one. The
99 // provided unique_ptr will be updated to point to the previous source. Used
100 // to set an ExternalBeginFrameSource for manual control over BeginFrames
101 // through DevTools.
102 void SwapBeginFrameSource(
103 std::unique_ptr<BeginFrameSource>* begin_frame_source);
104
98 private: 105 private:
99 void InitializeRenderer(); 106 void InitializeRenderer();
100 void UpdateRootSurfaceResourcesLocked(); 107 void UpdateRootSurfaceResourcesLocked();
101 void DidLoseContextProvider(); 108 void DidLoseContextProvider();
102 109
103 SharedBitmapManager* const bitmap_manager_; 110 SharedBitmapManager* const bitmap_manager_;
104 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; 111 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_;
105 const RendererSettings settings_; 112 const RendererSettings settings_;
106 113
107 DisplayClient* client_ = nullptr; 114 DisplayClient* client_ = nullptr;
108 SurfaceManager* surface_manager_ = nullptr; 115 SurfaceManager* surface_manager_ = nullptr;
109 const FrameSinkId frame_sink_id_; 116 const FrameSinkId frame_sink_id_;
110 SurfaceId current_surface_id_; 117 SurfaceId current_surface_id_;
111 gfx::Size current_surface_size_; 118 gfx::Size current_surface_size_;
112 float device_scale_factor_ = 1.f; 119 float device_scale_factor_ = 1.f;
113 gfx::ColorSpace device_color_space_; 120 gfx::ColorSpace device_color_space_;
114 bool visible_ = false; 121 bool visible_ = false;
115 bool swapped_since_resize_ = false; 122 bool swapped_since_resize_ = false;
116 bool output_is_secure_ = false; 123 bool output_is_secure_ = false;
117 124
118 // The begin_frame_source_ is often known by the output_surface_ and 125 // The begin_frame_source_ is often known by the output_surface_ and
119 // the scheduler_. 126 // the scheduler_.
120 std::unique_ptr<BeginFrameSource> begin_frame_source_; 127 std::unique_ptr<DisplayBeginFrameSource> begin_frame_source_;
121 std::unique_ptr<OutputSurface> output_surface_; 128 std::unique_ptr<OutputSurface> output_surface_;
122 std::unique_ptr<DisplayScheduler> scheduler_; 129 std::unique_ptr<DisplayScheduler> scheduler_;
123 std::unique_ptr<ResourceProvider> resource_provider_; 130 std::unique_ptr<ResourceProvider> resource_provider_;
124 std::unique_ptr<SurfaceAggregator> aggregator_; 131 std::unique_ptr<SurfaceAggregator> aggregator_;
125 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; 132 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
126 std::unique_ptr<DirectRenderer> renderer_; 133 std::unique_ptr<DirectRenderer> renderer_;
127 SoftwareRenderer* software_renderer_ = nullptr; 134 SoftwareRenderer* software_renderer_ = nullptr;
128 std::vector<ui::LatencyInfo> stored_latency_info_; 135 std::vector<ui::LatencyInfo> stored_latency_info_;
129 136
130 private: 137 private:
131 DISALLOW_COPY_AND_ASSIGN(Display); 138 DISALLOW_COPY_AND_ASSIGN(Display);
132 }; 139 };
133 140
134 } // namespace cc 141 } // namespace cc
135 142
136 #endif // CC_SURFACES_DISPLAY_H_ 143 #endif // CC_SURFACES_DISPLAY_H_
OLDNEW
« no previous file with comments | « cc/surfaces/direct_compositor_frame_sink_unittest.cc ('k') | cc/surfaces/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698