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> |
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/threading/thread_task_runner_handle.h" |
25 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
26 #include "gpu/ipc/common/gpu_messages.h" | 27 #include "gpu/ipc/common/gpu_messages.h" |
27 #include "gpu/ipc/service/gpu_channel_manager.h" | 28 #include "gpu/ipc/service/gpu_channel_manager.h" |
28 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" | 29 #include "gpu/ipc/service/gpu_channel_manager_delegate.h" |
29 #include "ui/accelerated_widget_mac/ca_layer_tree_coordinator.h" | 30 #include "ui/accelerated_widget_mac/ca_layer_tree_coordinator.h" |
30 #include "ui/accelerated_widget_mac/io_surface_context.h" | 31 #include "ui/accelerated_widget_mac/io_surface_context.h" |
31 #include "ui/base/cocoa/animation_utils.h" | 32 #include "ui/base/cocoa/animation_utils.h" |
32 #include "ui/base/cocoa/remote_layer_api.h" | 33 #include "ui/base/cocoa/remote_layer_api.h" |
33 #include "ui/gfx/geometry/rect_conversions.h" | 34 #include "ui/gfx/geometry/rect_conversions.h" |
34 #include "ui/gfx/swap_result.h" | 35 #include "ui/gfx/swap_result.h" |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 kCGLCPCurrentRendererID, | 374 kCGLCPCurrentRendererID, |
374 &context_renderer_id) != kCGLNoError) { | 375 &context_renderer_id) != kCGLNoError) { |
375 LOG(ERROR) << "Failed to create test context after GPU switch"; | 376 LOG(ERROR) << "Failed to create test context after GPU switch"; |
376 return; | 377 return; |
377 } | 378 } |
378 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; | 379 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; |
379 | 380 |
380 // Post a task holding a reference to the new GL context. The reason for | 381 // Post a task holding a reference to the new GL context. The reason for |
381 // this is to avoid creating-then-destroying the context for every image | 382 // this is to avoid creating-then-destroying the context for every image |
382 // transport surface that is observing the GPU switch. | 383 // transport surface that is observing the GPU switch. |
383 base::MessageLoop::current()->PostTask( | 384 base::ThreadTaskRunnerHandle::Get()->PostTask( |
384 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); | 385 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); |
385 } | 386 } |
386 | 387 |
387 } // namespace gpu | 388 } // namespace gpu |
OLD | NEW |