| 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 "gpu/ipc/service/image_transport_surface_overlay_mac.h" | 5 #include "gpu/ipc/service/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> |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 pixel_damage_rect, &fullscreen_low_power_layer_valid); | 248 pixel_damage_rect, &fullscreen_low_power_layer_valid); |
| 249 } | 249 } |
| 250 | 250 |
| 251 base::TimeTicks after_transaction_time = base::TimeTicks::Now(); | 251 base::TimeTicks after_transaction_time = base::TimeTicks::Now(); |
| 252 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CATransactionTime", | 252 UMA_HISTOGRAM_TIMES("GPU.IOSurface.CATransactionTime", |
| 253 after_transaction_time - after_flush_before_commit_time); | 253 after_transaction_time - after_flush_before_commit_time); |
| 254 | 254 |
| 255 // Update the latency info to reflect the swap time. | 255 // Update the latency info to reflect the swap time. |
| 256 for (auto& latency_info : latency_info_) { | 256 for (auto& latency_info : latency_info_) { |
| 257 latency_info.AddLatencyNumberWithTimestamp( | 257 latency_info.AddLatencyNumberWithTimestamp( |
| 258 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, | 258 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, |
| 259 after_flush_before_commit_time, 1); | 259 after_flush_before_commit_time, 1); |
| 260 latency_info.AddLatencyNumberWithTimestamp( | 260 latency_info.AddLatencyNumberWithTimestamp( |
| 261 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, | 261 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, |
| 262 after_flush_before_commit_time, 1); | 262 after_flush_before_commit_time, 1); |
| 263 } | 263 } |
| 264 | 264 |
| 265 // Send acknowledgement to the browser. | 265 // Send acknowledgement to the browser. |
| 266 CAContextID ca_context_id = 0; | 266 CAContextID ca_context_id = 0; |
| 267 CAContextID fullscreen_low_power_ca_context_id = 0; | 267 CAContextID fullscreen_low_power_ca_context_id = 0; |
| 268 gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port; | 268 gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port; |
| 269 if (use_remote_layer_api_) { | 269 if (use_remote_layer_api_) { |
| 270 ca_context_id = [ca_context_ contextId]; | 270 ca_context_id = [ca_context_ contextId]; |
| 271 fullscreen_low_power_ca_context_id = | 271 fullscreen_low_power_ca_context_id = |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; | 405 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; |
| 406 | 406 |
| 407 // Post a task holding a reference to the new GL context. The reason for | 407 // Post a task holding a reference to the new GL context. The reason for |
| 408 // this is to avoid creating-then-destroying the context for every image | 408 // this is to avoid creating-then-destroying the context for every image |
| 409 // transport surface that is observing the GPU switch. | 409 // transport surface that is observing the GPU switch. |
| 410 base::ThreadTaskRunnerHandle::Get()->PostTask( | 410 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 411 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); | 411 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace gpu | 414 } // namespace gpu |
| OLD | NEW |