| Index: webkit/plugins/npapi/plugin_host.cc
|
| ===================================================================
|
| --- webkit/plugins/npapi/plugin_host.cc (revision 112101)
|
| +++ 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"
|
| @@ -16,6 +17,7 @@
|
| #include "third_party/npapi/bindings/npruntime.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
|
| +#include "ui/base/ui_base_switches.h"
|
| #include "ui/gfx/gl/gl_implementation.h"
|
| #include "ui/gfx/gl/gl_surface.h"
|
| #include "webkit/glue/webkit_glue.h"
|
| @@ -71,6 +73,11 @@
|
| }
|
| return (implementation == gfx::kGLImplementationDesktopGL);
|
| }
|
| +
|
| +static bool UsingCompositedCoreAnimationPlugins() {
|
| + return !CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kDisableCompositedCoreAnimationPlugins);
|
| +}
|
| #endif
|
|
|
| PluginHost::PluginHost() {
|
| @@ -826,8 +833,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 +912,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));
|
|
|