diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 03:21:14 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 03:21:14 +0000 |
commit | d2139663640f674e7c56b1e139616c62c2b58885 (patch) | |
tree | 9afede65658f12bd00bf6cbf416a66e33c7737f1 | |
parent | 665112a28e524eed5892bc1eebb453ae3f0d64c3 (diff) | |
download | chromium_src-d2139663640f674e7c56b1e139616c62c2b58885.zip chromium_src-d2139663640f674e7c56b1e139616c62c2b58885.tar.gz chromium_src-d2139663640f674e7c56b1e139616c62c2b58885.tar.bz2 |
Re-enable the build of Pepper support by default (issue 464074, svn revision 34161).
There were problems building Skia and others for the 64-bit linux versions of the
Pepper test plugin, so I have disabled building that plugin except on Windows for now
and added a TODO.
One significant addition to the previous comment lines. The flag enable_gpu=1 now
causes the build definition ENABLE_GPU=1 to allow guarding of dependent code.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/481001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34227 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/all.gyp | 7 | ||||
-rw-r--r-- | build/common.gypi | 8 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 1 | ||||
-rwxr-xr-x | chrome/chrome_renderer.gypi | 2 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 32 | ||||
-rw-r--r-- | webkit/glue/plugins/npapi_extension_thunk.cc | 17 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_host.cc | 7 | ||||
-rw-r--r-- | webkit/glue/webplugin.h | 4 | ||||
-rw-r--r-- | webkit/tools/pepper_test_plugin/README | 10 | ||||
-rw-r--r-- | webkit/tools/pepper_test_plugin/event_handler.cc | 5 | ||||
-rw-r--r-- | webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp | 3 |
13 files changed, 46 insertions, 54 deletions
diff --git a/build/all.gyp b/build/all.gyp index 9bdd75f..d39a730 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -35,6 +35,7 @@ '../third_party/sqlite/sqlite.gyp:*', '../third_party/WebKit/WebKit/chromium/WebKit.gyp:*', '../third_party/zlib/zlib.gyp:*', + '../webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp:*', '../webkit/tools/test_shell/test_shell.gyp:*', '../webkit/webkit.gyp:*', 'util/build_util.gyp:*', @@ -51,9 +52,8 @@ '../chrome_frame/chrome_frame.gyp:*', ], }], - ['enable_pepper==1', { + ['enable_gpu==1', { 'dependencies': [ - '../webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp:*', '../gpu/gpu.gyp:*', ], }], @@ -103,6 +103,9 @@ '../third_party/bspatch/bspatch.gyp:*', '../third_party/cld/cld.gyp:*', '../tools/memory_watcher/memory_watcher.gyp:*', + # As of now Skia build has problems with Linux and/or 64 bits. + # TODO(sehr,brettw): Make this unconditional. + '../webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp:*', ], }, { 'dependencies': [ diff --git a/build/common.gypi b/build/common.gypi index 0f42c37..8261c9e 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -162,8 +162,8 @@ # Whether to add the experimental build define. 'chrome_frame_define%': 0, - # Whether pepper APIs are enabled. - 'enable_pepper%': 0, + # Whether GPU plugin build is enabled. + 'enable_gpu%': 0, # Whether usage of OpenMAX is enabled. 'enable_openmax%': 0, @@ -341,8 +341,8 @@ ['chromeos==1 or toolkit_views==1', { 'defines': ['OS_CHROMEOS=1'], }], - ['enable_pepper==1', { - 'defines': ['ENABLE_PEPPER=1'], + ['enable_gpu==1', { + 'defines': ['ENABLE_GPU=1'], }], ['fastbuild!=0', { 'conditions': [ diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index c7325ad..05a452d 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -517,6 +517,7 @@ void BrowserRenderProcessHost::PropogateBrowserCommandLineToRenderer( switches::kSimpleDataSource, switches::kEnableBenchmarking, switches::kInternalNaCl, + switches::kInternalPepper, switches::kDisableByteRangeSupport, switches::kDisableDatabases, switches::kDisableDesktopNotifications, diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index f1e7c36c..ebe31de 100755 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -148,7 +148,7 @@ ], }, 'conditions': [ - ['enable_pepper==1', { + ['enable_gpu==1', { 'dependencies': [ '../gpu/gpu.gyp:gpu_plugin', ], diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 3160bd8..f64b451 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -313,6 +313,9 @@ const char kIncognito[] = "incognito"; // Runs the Native Client inside the renderer process. const char kInternalNaCl[] = "internal-nacl"; +// Runs a trusted Pepper plugin inside the renderer process. +const char kInternalPepper[] = "internal-pepper"; + // Specifies the flags passed to JS engine const char kJavaScriptFlags[] = "js-flags"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 5d97788..9698cdf 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -99,6 +99,7 @@ extern const char kImport[]; extern const char kInProcessPlugins[]; extern const char kIncognito[]; extern const char kInternalNaCl[]; +extern const char kInternalPepper[]; extern const char kJavaScriptFlags[]; extern const char kLoadExtension[]; extern const char kLoadPlugin[]; diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 4718a5c..c9d4f44 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if defined(ENABLE_PEPPER) -#define PEPPER_APIS_ENABLED -#endif - #include "chrome/renderer/render_view.h" #include <algorithm> @@ -2641,24 +2637,36 @@ webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate( else mime_type_to_use = &mime_type; -#if defined(PEPPER_APIS_ENABLED) + bool use_pepper_host = false; + bool in_process_plugin = RenderProcess::current()->in_process_plugins(); + // Check for trusted Pepper plugins. const char kPepperPrefix[] = "pepper-"; if (StartsWithASCII(*mime_type_to_use, kPepperPrefix, true)) { - return WebPluginDelegatePepper::Create( - path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); + if (CommandLine::ForCurrentProcess()-> + HasSwitch(switches::kInternalPepper)) { + in_process_plugin = true; + use_pepper_host = true; + } else { + // In process Pepper plugins must be explicitly enabled. + return NULL; + } } -#endif - - bool in_process_plugin = RenderProcess::current()->in_process_plugins(); + // Check for Native Client modules. if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl)) { if (mime_type == "application/x-nacl-srpc") { in_process_plugin = true; + use_pepper_host = true; } } if (in_process_plugin) { #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. - return WebPluginDelegateImpl::Create( - path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); + if (use_pepper_host) { + return WebPluginDelegatePepper::Create( + path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); + } else { + return WebPluginDelegateImpl::Create( + path, *mime_type_to_use, gfx::NativeViewFromId(host_window_)); + } #else NOTIMPLEMENTED(); return NULL; diff --git a/webkit/glue/plugins/npapi_extension_thunk.cc b/webkit/glue/plugins/npapi_extension_thunk.cc index db1ca2e..e07bff2 100644 --- a/webkit/glue/plugins/npapi_extension_thunk.cc +++ b/webkit/glue/plugins/npapi_extension_thunk.cc @@ -9,9 +9,7 @@ #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/webplugin.h" #include "webkit/glue/webplugin_delegate.h" -//#include "third_party/npapi/bindings/npruntime.h" -#if defined(ENABLE_PEPPER) // FindInstance() // Finds a PluginInstance from an NPP. @@ -245,18 +243,3 @@ NPError GetPepperExtensionsFunctions(void* value) { } } // namespace NPAPI - -#else // Not compiling with pepper support - -namespace NPAPI { - -// This NOP function implements the getter for the extensions when the -// extensions aren't available. -NPError GetPepperExtensionsFunctions(void* value) { - return NPERR_GENERIC_ERROR; -} - -} // namespace NPAPI - -#endif // defined(ENABLE_PEPPER) - diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index 291aa13..0c6e54d 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -2,9 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Pepper API support should be turned on for this module. -#define PEPPER_APIS_ENABLED - #include "webkit/glue/plugins/plugin_host.h" #include "base/file_util.h" @@ -803,6 +800,10 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { } #endif // OS_MACOSX case NPNVPepperExtensions: + // Available for any plugin that attempts to get it. + // If the plugin is not started in a Pepper implementation, it + // will likely fail when it tries to use any of the functions + // attached to the extension vector. rv = NPAPI::GetPepperExtensionsFunctions(value); break; default: diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h index 90ac44a..a549b5f 100644 --- a/webkit/glue/webplugin.h +++ b/webkit/glue/webplugin.h @@ -129,8 +129,8 @@ class WebPlugin { bool defer) = 0; // Gets the WebPluginDelegate that implements the interface. - // This API is only for use with Pepper, and hence only with - // in renderer process plugins. + // This API is only for use with Pepper, and is only overridden + // by in-renderer implementations. virtual WebPluginDelegate* delegate() { return NULL; } }; diff --git a/webkit/tools/pepper_test_plugin/README b/webkit/tools/pepper_test_plugin/README index 96c6397..4c8003b 100644 --- a/webkit/tools/pepper_test_plugin/README +++ b/webkit/tools/pepper_test_plugin/README @@ -1,18 +1,12 @@ This is a test plugin for manual testing of the Pepper plugin API. See https://wiki.mozilla.org/Plugins:PlatformIndependentNPAPI -To generate a project from the gyp file, set the GYP_DEFINES environment -variable to "enable_pepper=1". From a Windows command prompt: - set GYP_DEFINES=enable_pepper=1 - -Then rebuild the project files: - gclient runhooks --force - -Then open the Chrome all.sln solution and rebuild the pepper_test_plugin and +Open the Chrome all.sln solution and rebuild the pepper_test_plugin and chrome projects. To load this plugin in Chrome, use the command line flags: --no-sandbox + --internal-pepper --load-plugin=<<<YOUR CHECKOUT ROOT>>\src\webkit\tools\pepper_test_plugin\Debug\pepper_test_plugin.dll A simple way to launch Chrome with these command line flags is to run the diff --git a/webkit/tools/pepper_test_plugin/event_handler.cc b/webkit/tools/pepper_test_plugin/event_handler.cc index 75ede4e..7884fac 100644 --- a/webkit/tools/pepper_test_plugin/event_handler.cc +++ b/webkit/tools/pepper_test_plugin/event_handler.cc @@ -28,6 +28,7 @@ #include <stdio.h> #include <string> +#include "base/basictypes.h" #include "base/logging.h" #include "base/string_util.h" #include "webkit/tools/pepper_test_plugin/plugin_object.h" @@ -127,11 +128,11 @@ int EventHandler::handle(void* event) { str += StringPrintf(": mod %x, text: ", npevent->u.character.modifier); size_t i; - for (i = 0; i < ARRAYSIZE(npevent->u.character.text); ++i) { + for (i = 0; i < arraysize(npevent->u.character.text); ++i) { str += StringPrintf("%x ", npevent->u.character.text[i]); } str += ", unmod: "; - for (i = 0; i < ARRAYSIZE(npevent->u.character.unmodifiedText); ++i) { + for (i = 0; i < arraysize(npevent->u.character.unmodifiedText); ++i) { str += StringPrintf("%x ", npevent->u.character.unmodifiedText[i]); } break; diff --git a/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp b/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp index a19574e..5144e76 100644 --- a/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp +++ b/webkit/tools/pepper_test_plugin/pepper_test_plugin.gyp @@ -12,9 +12,6 @@ 'include_dirs': [ '../../..', # Root of Chrome Checkout ], - 'defines': [ - 'PEPPER_APIS_ENABLED', - ], 'conditions': [ ['OS=="win"', { 'product_name': 'pepper_test_plugin', |