OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
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> |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 pixel_size_ = pixel_size; | 703 pixel_size_ = pixel_size; |
704 scale_factor_ = scale_factor; | 704 scale_factor_ = scale_factor; |
705 } | 705 } |
706 | 706 |
707 void ImageTransportSurfaceOverlayMac::SetLatencyInfo( | 707 void ImageTransportSurfaceOverlayMac::SetLatencyInfo( |
708 const std::vector<ui::LatencyInfo>& latency_info) { | 708 const std::vector<ui::LatencyInfo>& latency_info) { |
709 latency_info_.insert( | 709 latency_info_.insert( |
710 latency_info_.end(), latency_info.begin(), latency_info.end()); | 710 latency_info_.end(), latency_info.begin(), latency_info.end()); |
711 } | 711 } |
712 | 712 |
713 void ImageTransportSurfaceOverlayMac::WakeUpGpu() {} | |
714 | |
715 void ImageTransportSurfaceOverlayMac::OnGpuSwitched() { | 713 void ImageTransportSurfaceOverlayMac::OnGpuSwitched() { |
716 // Create a new context, and use the GL renderer ID that the new context gets. | 714 // Create a new context, and use the GL renderer ID that the new context gets. |
717 scoped_refptr<ui::IOSurfaceContext> context_on_new_gpu = | 715 scoped_refptr<ui::IOSurfaceContext> context_on_new_gpu = |
718 ui::IOSurfaceContext::Get(ui::IOSurfaceContext::kCALayerContext); | 716 ui::IOSurfaceContext::Get(ui::IOSurfaceContext::kCALayerContext); |
719 if (!context_on_new_gpu) | 717 if (!context_on_new_gpu) |
720 return; | 718 return; |
721 GLint context_renderer_id = -1; | 719 GLint context_renderer_id = -1; |
722 if (CGLGetParameter(context_on_new_gpu->cgl_context(), | 720 if (CGLGetParameter(context_on_new_gpu->cgl_context(), |
723 kCGLCPCurrentRendererID, | 721 kCGLCPCurrentRendererID, |
724 &context_renderer_id) != kCGLNoError) { | 722 &context_renderer_id) != kCGLNoError) { |
(...skipping 17 matching lines...) Expand all Loading... |
742 // Compute the previous vsync time. | 740 // Compute the previous vsync time. |
743 base::TimeTicks previous_vsync = | 741 base::TimeTicks previous_vsync = |
744 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + | 742 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + |
745 vsync_timebase_; | 743 vsync_timebase_; |
746 | 744 |
747 // Return |interval_fraction| through the next vsync. | 745 // Return |interval_fraction| through the next vsync. |
748 return previous_vsync + (1 + interval_fraction) * vsync_interval_; | 746 return previous_vsync + (1 + interval_fraction) * vsync_interval_; |
749 } | 747 } |
750 | 748 |
751 } // namespace content | 749 } // namespace content |
OLD | NEW |