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 #include "services/ui/surfaces/display_output_surface.h" | 5 #include "services/ui/surfaces/display_output_surface.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 bool has_alpha, | 72 bool has_alpha, |
73 bool use_stencil) { | 73 bool use_stencil) { |
74 size_ = size; | 74 size_ = size; |
75 has_set_draw_rectangle_since_last_resize_ = false; | 75 has_set_draw_rectangle_since_last_resize_ = false; |
76 context_provider()->ContextGL()->ResizeCHROMIUM( | 76 context_provider()->ContextGL()->ResizeCHROMIUM( |
77 size.width(), size.height(), device_scale_factor, has_alpha); | 77 size.width(), size.height(), device_scale_factor, has_alpha); |
78 } | 78 } |
79 | 79 |
80 void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { | 80 void DisplayOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { |
81 DCHECK(context_provider_); | 81 DCHECK(context_provider_); |
| 82 |
| 83 if (frame.latency_info.size() > 0) |
| 84 context_provider_->ContextSupport()->AddLatencyInfo(frame.latency_info); |
| 85 |
82 set_draw_rectangle_for_frame_ = false; | 86 set_draw_rectangle_for_frame_ = false; |
83 if (frame.sub_buffer_rect) { | 87 if (frame.sub_buffer_rect) { |
84 context_provider_->ContextSupport()->PartialSwapBuffers( | 88 context_provider_->ContextSupport()->PartialSwapBuffers( |
85 *frame.sub_buffer_rect); | 89 *frame.sub_buffer_rect); |
86 } else { | 90 } else { |
87 context_provider_->ContextSupport()->Swap(); | 91 context_provider_->ContextSupport()->Swap(); |
88 } | 92 } |
89 } | 93 } |
90 | 94 |
91 uint32_t DisplayOutputSurface::GetFramebufferCopyTextureFormat() { | 95 uint32_t DisplayOutputSurface::GetFramebufferCopyTextureFormat() { |
(...skipping 24 matching lines...) Expand all Loading... |
116 return false; | 120 return false; |
117 } | 121 } |
118 | 122 |
119 void DisplayOutputSurface::ApplyExternalStencil() {} | 123 void DisplayOutputSurface::ApplyExternalStencil() {} |
120 | 124 |
121 void DisplayOutputSurface::DidReceiveSwapBuffersAck(gfx::SwapResult result) { | 125 void DisplayOutputSurface::DidReceiveSwapBuffersAck(gfx::SwapResult result) { |
122 client_->DidReceiveSwapBuffersAck(); | 126 client_->DidReceiveSwapBuffersAck(); |
123 } | 127 } |
124 | 128 |
125 void DisplayOutputSurface::OnGpuSwapBuffersCompleted( | 129 void DisplayOutputSurface::OnGpuSwapBuffersCompleted( |
126 const std::vector<ui::LatencyInfo>& latency_info, | 130 const std::vector<LatencyInfo>& latency_info, |
127 gfx::SwapResult result, | 131 gfx::SwapResult result, |
128 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { | 132 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| 133 for (const auto& latency : latency_info) { |
| 134 if (latency.latency_components().size() > 0) |
| 135 latency_tracker_.OnGpuSwapBuffersCompleted(latency); |
| 136 } |
129 DidReceiveSwapBuffersAck(result); | 137 DidReceiveSwapBuffersAck(result); |
130 } | 138 } |
131 | 139 |
132 void DisplayOutputSurface::OnVSyncParametersUpdated(base::TimeTicks timebase, | 140 void DisplayOutputSurface::OnVSyncParametersUpdated(base::TimeTicks timebase, |
133 base::TimeDelta interval) { | 141 base::TimeDelta interval) { |
134 // TODO(brianderson): We should not be receiving 0 intervals. | 142 // TODO(brianderson): We should not be receiving 0 intervals. |
135 synthetic_begin_frame_source_->OnUpdateVSyncParameters( | 143 synthetic_begin_frame_source_->OnUpdateVSyncParameters( |
136 timebase, | 144 timebase, |
137 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); | 145 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); |
138 } | 146 } |
139 | 147 |
140 } // namespace ui | 148 } // namespace ui |
OLD | NEW |