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

Side by Side Diff: content/common/gpu/image_transport_surface_overlay_mac.mm

Issue 1830193002: Move buffer_presented_params_mac to content/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/common/gpu/image_transport_surface_overlay_mac.h" 5 #include "content/common/gpu/image_transport_surface_overlay_mac.h"
6 6
7 #include <CoreGraphics/CoreGraphics.h> 7 #include <CoreGraphics/CoreGraphics.h>
8 #include <IOSurface/IOSurface.h> 8 #include <IOSurface/IOSurface.h>
9 #include <OpenGL/CGLRenderers.h> 9 #include <OpenGL/CGLRenderers.h>
10 #include <OpenGL/CGLTypes.h> 10 #include <OpenGL/CGLTypes.h>
11 #include <OpenGL/gl.h> 11 #include <OpenGL/gl.h>
12 #include <stddef.h> 12 #include <stddef.h>
13 13
14 #include <algorithm> 14 #include <algorithm>
15 15
16 // This type consistently causes problem on Mac, and needs to be dealt with 16 // This type consistently causes problem on Mac, and needs to be dealt with
17 // in a systemic way. 17 // in a systemic way.
18 // http://crbug.com/517208 18 // http://crbug.com/517208
19 #ifndef GL_OES_EGL_image 19 #ifndef GL_OES_EGL_image
20 typedef void* GLeglImageOES; 20 typedef void* GLeglImageOES;
21 #endif 21 #endif
22 22
23 #include "base/bind.h" 23 #include "base/bind.h"
24 #include "base/bind_helpers.h" 24 #include "base/bind_helpers.h"
25 #include "base/mac/scoped_cftyperef.h" 25 #include "base/mac/scoped_cftyperef.h"
26 #include "base/trace_event/trace_event.h" 26 #include "base/trace_event/trace_event.h"
27 #include "content/common/gpu/buffer_presented_params_mac.h"
28 #include "content/common/gpu/ca_layer_partial_damage_tree_mac.h" 27 #include "content/common/gpu/ca_layer_partial_damage_tree_mac.h"
29 #include "content/common/gpu/ca_layer_tree_mac.h" 28 #include "content/common/gpu/ca_layer_tree_mac.h"
30 #include "content/common/gpu/gpu_channel_manager.h" 29 #include "content/common/gpu/gpu_channel_manager.h"
31 #include "content/common/gpu/gpu_channel_manager_delegate.h" 30 #include "content/common/gpu/gpu_channel_manager_delegate.h"
32 #include "ui/accelerated_widget_mac/io_surface_context.h" 31 #include "ui/accelerated_widget_mac/io_surface_context.h"
33 #include "ui/base/cocoa/animation_utils.h" 32 #include "ui/base/cocoa/animation_utils.h"
34 #include "ui/base/cocoa/remote_layer_api.h" 33 #include "ui/base/cocoa/remote_layer_api.h"
35 #include "ui/gfx/geometry/rect_conversions.h" 34 #include "ui/gfx/geometry/rect_conversions.h"
36 #include "ui/gfx/transform.h" 35 #include "ui/gfx/transform.h"
37 #include "ui/gl/gl_context.h" 36 #include "ui/gl/gl_context.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 return false; 176 return false;
178 } 177 }
179 178
180 void ImageTransportSurfaceOverlayMac::SetLatencyInfo( 179 void ImageTransportSurfaceOverlayMac::SetLatencyInfo(
181 const std::vector<ui::LatencyInfo>& latency_info) { 180 const std::vector<ui::LatencyInfo>& latency_info) {
182 latency_info_.insert(latency_info_.end(), latency_info.begin(), 181 latency_info_.insert(latency_info_.end(), latency_info.begin(),
183 latency_info.end()); 182 latency_info.end());
184 } 183 }
185 184
186 void ImageTransportSurfaceOverlayMac::BufferPresented( 185 void ImageTransportSurfaceOverlayMac::BufferPresented(
187 const BufferPresentedParams& params) { 186 int32_t surface_id,
188 vsync_timebase_ = params.vsync_timebase; 187 const base::TimeTicks& vsync_timebase,
189 vsync_interval_ = params.vsync_interval; 188 const base::TimeDelta& vsync_interval) {
189 vsync_timebase_ = vsync_timebase;
190 vsync_interval_ = vsync_interval;
190 vsync_parameters_valid_ = (vsync_interval_ != base::TimeDelta()); 191 vsync_parameters_valid_ = (vsync_interval_ != base::TimeDelta());
191 192
192 // Compute |vsync_timebase_| to be the first vsync after time zero. 193 // Compute |vsync_timebase_| to be the first vsync after time zero.
193 if (vsync_parameters_valid_) { 194 if (vsync_parameters_valid_) {
194 vsync_timebase_ -= 195 vsync_timebase_ -=
195 vsync_interval_ * 196 vsync_interval_ *
196 ((vsync_timebase_ - base::TimeTicks()) / vsync_interval_); 197 ((vsync_timebase_ - base::TimeTicks()) / vsync_interval_);
197 } 198 }
198 } 199 }
199 200
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // Compute the previous vsync time. 554 // Compute the previous vsync time.
554 base::TimeTicks previous_vsync = 555 base::TimeTicks previous_vsync =
555 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + 556 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) +
556 vsync_timebase_; 557 vsync_timebase_;
557 558
558 // Return |interval_fraction| through the next vsync. 559 // Return |interval_fraction| through the next vsync.
559 return previous_vsync + (1 + interval_fraction) * vsync_interval_; 560 return previous_vsync + (1 + interval_fraction) * vsync_interval_;
560 } 561 }
561 562
562 } // namespace content 563 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_overlay_mac.h ('k') | content/common/gpu_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698