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/surface/accelerated_surface_mac.h" | 13 #include "ui/surface/accelerated_surface_mac.h" |
14 #include "ui/surface/transport_dib.h" | 14 #include "ui/surface/transport_dib.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 WebPluginAcceleratedSurfaceProxy* WebPluginAcceleratedSurfaceProxy::Create( | 18 WebPluginAcceleratedSurfaceProxy* WebPluginAcceleratedSurfaceProxy::Create( |
19 WebPluginProxy* plugin_proxy, | 19 WebPluginProxy* plugin_proxy, |
20 gfx::GpuPreference gpu_preference) { | 20 gfx::GpuPreference gpu_preference) { |
21 // 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 |
22 // because the CA drawing model shouldn't be advertised. | 22 // because the CA drawing model shouldn't be advertised. |
23 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( | 23 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( |
24 switches::kDisableCoreAnimationPlugins)); | 24 switches::kDisableCoreAnimationPlugins)); |
25 | 25 |
26 AcceleratedSurface* surface = new AcceleratedSurface; | 26 AcceleratedSurface* surface = new AcceleratedSurface; |
27 // 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 |
28 // mode is forced via flags), so handle that gracefully. | 28 // mode is forced via flags), so handle that gracefully. |
29 if (!surface->Initialize(NULL, true, gpu_preference)) { | 29 if (!surface->Initialize(NULL, true, gpu_preference)) { |
30 delete surface; | 30 delete surface; |
31 return NULL; | 31 return NULL; |
32 } | 32 } |
33 | 33 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { | 74 void WebPluginAcceleratedSurfaceProxy::EndDrawing() { |
75 if (!surface_) | 75 if (!surface_) |
76 return; | 76 return; |
77 | 77 |
78 surface_->SwapBuffers(); | 78 surface_->SwapBuffers(); |
79 plugin_proxy_->AcceleratedPluginSwappedIOSurface(); | 79 plugin_proxy_->AcceleratedPluginSwappedIOSurface(); |
80 } | 80 } |
81 | 81 |
82 } // namespace content | 82 } // namespace content |
OLD | NEW |