Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: webkit/plugins/npapi/plugin_host.cc

Issue 8678037: Render Core Animation plugins through WebKit's compositor rather than (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Final patch to be committed Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/surface/accelerated_surface_mac.cc ('k') | webkit/plugins/npapi/webplugin.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/npapi/plugin_host.h" 5 #include "webkit/plugins/npapi/plugin_host.h"
6 6
7 #include "base/command_line.h"
7 #include "base/file_util.h" 8 #include "base/file_util.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "base/string_piece.h" 11 #include "base/string_piece.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/sys_string_conversions.h" 13 #include "base/sys_string_conversions.h"
13 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
16 #include "third_party/npapi/bindings/npruntime.h" 17 #include "third_party/npapi/bindings/npruntime.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
20 #include "ui/base/ui_base_switches.h"
19 #include "ui/gfx/gl/gl_implementation.h" 21 #include "ui/gfx/gl/gl_implementation.h"
20 #include "ui/gfx/gl/gl_surface.h" 22 #include "ui/gfx/gl/gl_surface.h"
21 #include "webkit/glue/webkit_glue.h" 23 #include "webkit/glue/webkit_glue.h"
22 #include "webkit/plugins/npapi/default_plugin_shared.h" 24 #include "webkit/plugins/npapi/default_plugin_shared.h"
23 #include "webkit/plugins/npapi/plugin_instance.h" 25 #include "webkit/plugins/npapi/plugin_instance.h"
24 #include "webkit/plugins/npapi/plugin_lib.h" 26 #include "webkit/plugins/npapi/plugin_lib.h"
25 #include "webkit/plugins/npapi/plugin_list.h" 27 #include "webkit/plugins/npapi/plugin_list.h"
26 #include "webkit/plugins/npapi/plugin_stream_url.h" 28 #include "webkit/plugins/npapi/plugin_stream_url.h"
27 #include "webkit/plugins/npapi/webplugin_delegate.h" 29 #include "webkit/plugins/npapi/webplugin_delegate.h"
28 #include "webkit/plugins/webplugininfo.h" 30 #include "webkit/plugins/webplugininfo.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 gfx::GLImplementation implementation = gfx::GetGLImplementation(); 66 gfx::GLImplementation implementation = gfx::GetGLImplementation();
65 if (implementation == gfx::kGLImplementationNone) { 67 if (implementation == gfx::kGLImplementationNone) {
66 // Not initialized yet. 68 // Not initialized yet.
67 if (!gfx::GLSurface::InitializeOneOff()) { 69 if (!gfx::GLSurface::InitializeOneOff()) {
68 return false; 70 return false;
69 } 71 }
70 implementation = gfx::GetGLImplementation(); 72 implementation = gfx::GetGLImplementation();
71 } 73 }
72 return (implementation == gfx::kGLImplementationDesktopGL); 74 return (implementation == gfx::kGLImplementationDesktopGL);
73 } 75 }
76
77 static bool UsingCompositedCoreAnimationPlugins() {
78 return !CommandLine::ForCurrentProcess()->HasSwitch(
79 switches::kDisableCompositedCoreAnimationPlugins);
80 }
74 #endif 81 #endif
75 82
76 PluginHost::PluginHost() { 83 PluginHost::PluginHost() {
77 InitializeHostFuncs(); 84 InitializeHostFuncs();
78 } 85 }
79 86
80 PluginHost::~PluginHost() { 87 PluginHost::~PluginHost() {
81 } 88 }
82 89
83 PluginHost *PluginHost::Singleton() { 90 PluginHost *PluginHost::Singleton() {
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 // We only support the Core Animation model on 10.6 and higher 826 // We only support the Core Animation model on 10.6 and higher
820 // TODO(stuartmorgan): Once existing CA plugins have implemented the 827 // TODO(stuartmorgan): Once existing CA plugins have implemented the
821 // invalidating version, remove support for this one. 828 // invalidating version, remove support for this one.
822 NPBool* supports_model = reinterpret_cast<NPBool*>(value); 829 NPBool* supports_model = reinterpret_cast<NPBool*>(value);
823 *supports_model = webkit::npapi::SupportsSharingAcceleratedSurfaces() ? 830 *supports_model = webkit::npapi::SupportsSharingAcceleratedSurfaces() ?
824 true : false; 831 true : false;
825 rv = NPERR_NO_ERROR; 832 rv = NPERR_NO_ERROR;
826 break; 833 break;
827 } 834 }
828 case NPNVsupportsInvalidatingCoreAnimationBool: { 835 case NPNVsupportsInvalidatingCoreAnimationBool: {
836 // The composited code path for this model only works on 10.6 and higher.
837 // The old direct-to-screen code path supports 10.5.
829 NPBool* supports_model = reinterpret_cast<NPBool*>(value); 838 NPBool* supports_model = reinterpret_cast<NPBool*>(value);
830 *supports_model = true; 839 bool composited = webkit::npapi::UsingCompositedCoreAnimationPlugins();
840 *supports_model = composited ?
841 webkit::npapi::SupportsSharingAcceleratedSurfaces() : true;
831 rv = NPERR_NO_ERROR; 842 rv = NPERR_NO_ERROR;
832 break; 843 break;
833 } 844 }
834 case NPNVsupportsOpenGLBool: { 845 case NPNVsupportsOpenGLBool: {
835 // This drawing model was never widely supported, and we don't plan to 846 // This drawing model was never widely supported, and we don't plan to
836 // support it. 847 // support it.
837 NPBool* supports_model = reinterpret_cast<NPBool*>(value); 848 NPBool* supports_model = reinterpret_cast<NPBool*>(value);
838 *supports_model = false; 849 *supports_model = false;
839 rv = NPERR_NO_ERROR; 850 rv = NPERR_NO_ERROR;
840 break; 851 break;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 case NPPVpluginKeepLibraryInMemory: 905 case NPPVpluginKeepLibraryInMemory:
895 // Tells browser that plugin library should live longer than usual. 906 // Tells browser that plugin library should live longer than usual.
896 // TODO: implement me 907 // TODO: implement me
897 DVLOG(1) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not " 908 DVLOG(1) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not "
898 "implemented."; 909 "implemented.";
899 return NPERR_GENERIC_ERROR; 910 return NPERR_GENERIC_ERROR;
900 #if defined(OS_MACOSX) 911 #if defined(OS_MACOSX)
901 case NPPVpluginDrawingModel: { 912 case NPPVpluginDrawingModel: {
902 int model = reinterpret_cast<int>(value); 913 int model = reinterpret_cast<int>(value);
903 if (model == NPDrawingModelCoreGraphics || 914 if (model == NPDrawingModelCoreGraphics ||
904 model == NPDrawingModelInvalidatingCoreAnimation || 915 (model == NPDrawingModelInvalidatingCoreAnimation &&
916 (webkit::npapi::SupportsSharingAcceleratedSurfaces() ||
917 !webkit::npapi::UsingCompositedCoreAnimationPlugins())) ||
905 (model == NPDrawingModelCoreAnimation && 918 (model == NPDrawingModelCoreAnimation &&
906 webkit::npapi::SupportsSharingAcceleratedSurfaces())) { 919 webkit::npapi::SupportsSharingAcceleratedSurfaces())) {
907 plugin->set_drawing_model(static_cast<NPDrawingModel>(model)); 920 plugin->set_drawing_model(static_cast<NPDrawingModel>(model));
908 return NPERR_NO_ERROR; 921 return NPERR_NO_ERROR;
909 } 922 }
910 return NPERR_GENERIC_ERROR; 923 return NPERR_GENERIC_ERROR;
911 } 924 }
912 case NPPVpluginEventModel: { 925 case NPPVpluginEventModel: {
913 // we support Carbon and Cocoa event models 926 // we support Carbon and Cocoa event models
914 int model = reinterpret_cast<int>(value); 927 int model = reinterpret_cast<int>(value);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 } 1145 }
1133 1146
1134 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { 1147 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) {
1135 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); 1148 scoped_refptr<PluginInstance> plugin(FindInstance(instance));
1136 if (plugin.get()) { 1149 if (plugin.get()) {
1137 plugin->URLRedirectResponse(!!allow, notify_data); 1150 plugin->URLRedirectResponse(!!allow, notify_data);
1138 } 1151 }
1139 } 1152 }
1140 1153
1141 } // extern "C" 1154 } // extern "C"
OLDNEW
« no previous file with comments | « ui/gfx/surface/accelerated_surface_mac.cc ('k') | webkit/plugins/npapi/webplugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698