Chromium Code Reviews| Index: webkit/plugins/npapi/plugin_host.cc |
| =================================================================== |
| --- webkit/plugins/npapi/plugin_host.cc (revision 111400) |
| +++ webkit/plugins/npapi/plugin_host.cc (working copy) |
| @@ -4,6 +4,7 @@ |
| #include "webkit/plugins/npapi/plugin_host.h" |
| +#include "base/command_line.h" |
| #include "base/file_util.h" |
| #include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -71,6 +72,13 @@ |
| } |
| return (implementation == gfx::kGLImplementationDesktopGL); |
| } |
| + |
| +static bool UsingCompositedCoreAnimationPlugins() { |
| + // We can't reference the kDisableCompositedCoreAnimationPlugins |
|
jam
2011/11/29 18:56:21
duplicating the switch seems unfortunate. perhaps
Ken Russell (switch to Gerrit)
2011/11/30 00:23:32
Thanks for the suggestion. Ended up putting it in
|
| + // constant in content/ here. |
| + return !CommandLine::ForCurrentProcess()->HasSwitch( |
| + "disable-composited-core-animation-plugins"); |
| +} |
| #endif |
| PluginHost::PluginHost() { |
| @@ -826,8 +834,12 @@ |
| break; |
| } |
| case NPNVsupportsInvalidatingCoreAnimationBool: { |
| + // The composited code path for this model only works on 10.6 and higher. |
| + // The old direct-to-screen code path supports 10.5. |
| NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
| - *supports_model = true; |
| + bool composited = webkit::npapi::UsingCompositedCoreAnimationPlugins(); |
| + *supports_model = composited ? |
| + webkit::npapi::SupportsSharingAcceleratedSurfaces() : true; |
| rv = NPERR_NO_ERROR; |
| break; |
| } |
| @@ -901,7 +913,9 @@ |
| case NPPVpluginDrawingModel: { |
| int model = reinterpret_cast<int>(value); |
| if (model == NPDrawingModelCoreGraphics || |
| - model == NPDrawingModelInvalidatingCoreAnimation || |
| + (model == NPDrawingModelInvalidatingCoreAnimation && |
| + (webkit::npapi::SupportsSharingAcceleratedSurfaces() || |
| + !webkit::npapi::UsingCompositedCoreAnimationPlugins())) || |
| (model == NPDrawingModelCoreAnimation && |
| webkit::npapi::SupportsSharingAcceleratedSurfaces())) { |
| plugin->set_drawing_model(static_cast<NPDrawingModel>(model)); |