OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <OpenGL/OpenGL.h> | 5 #import <OpenGL/OpenGL.h> |
6 | 6 |
7 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" | 7 #include "content/plugin/webplugin_accelerated_surface_proxy_mac.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "content/plugin/webplugin_proxy.h" | 11 #include "content/plugin/webplugin_proxy.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "ui/gl/io_surface_support_mac.h" | |
14 #include "ui/surface/accelerated_surface_mac.h" | 13 #include "ui/surface/accelerated_surface_mac.h" |
15 #include "ui/surface/transport_dib.h" | 14 #include "ui/surface/transport_dib.h" |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 | 17 |
19 WebPluginAcceleratedSurfaceProxy* WebPluginAcceleratedSurfaceProxy::Create( | 18 WebPluginAcceleratedSurfaceProxy* WebPluginAcceleratedSurfaceProxy::Create( |
20 WebPluginProxy* plugin_proxy, | 19 WebPluginProxy* plugin_proxy, |
21 gfx::GpuPreference gpu_preference) { | 20 gfx::GpuPreference gpu_preference) { |
22 // This code path shouldn't be taken if CA plugins are disabled | 21 // This code path shouldn't be taken if CA plugins are disabled |
23 // because the CA drawing model shouldn't be advertised. | 22 // because the CA drawing model shouldn't be advertised. |
24 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( | 23 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( |
25 switches::kDisableCoreAnimationPlugins)); | 24 switches::kDisableCoreAnimationPlugins)); |
26 | 25 |
27 // Require IOSurface support for drawing Core Animation plugins. | |
28 if (!IOSurfaceSupport::Initialize()) | |
29 return NULL; | |
30 | |
31 AcceleratedSurface* surface = new AcceleratedSurface; | 26 AcceleratedSurface* surface = new AcceleratedSurface; |
32 // It's possible for OpenGL to fail to initialize (e.g., if an incompatible | 27 // It's possible for OpenGL to fail to initialize (e.g., if an incompatible |
33 // mode is forced via flags), so handle that gracefully. | 28 // mode is forced via flags), so handle that gracefully. |
34 if (!surface->Initialize(NULL, true, gpu_preference)) { | 29 if (!surface->Initialize(NULL, true, gpu_preference)) { |
35 delete surface; | 30 delete surface; |
36 return NULL; | 31 return NULL; |
37 } | 32 } |
38 | 33 |
39 return new WebPluginAcceleratedSurfaceProxy(plugin_proxy, surface); | 34 return new WebPluginAcceleratedSurfaceProxy(plugin_proxy, surface); |
40 } | 35 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 73 |
79 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { | 74 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { |
80 if (!surface_) | 75 if (!surface_) |
81 return; | 76 return; |
82 | 77 |
83 surface_->SwapBuffers(); | 78 surface_->SwapBuffers(); |
84 plugin_proxy_->AcceleratedPluginSwappedIOSurface(); | 79 plugin_proxy_->AcceleratedPluginSwappedIOSurface(); |
85 } | 80 } |
86 | 81 |
87 } // namespace content | 82 } // namespace content |
OLD | NEW |