diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 17:46:07 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 17:46:07 +0000 |
commit | 3773020c131d144f0e0e1d849227b34d7c4cf6e1 (patch) | |
tree | 41149e9430a021044a811864c974aed26a89fb9c | |
parent | 6ed9b2141d30010e1a0c7055f03cbc726f3bd3a6 (diff) | |
download | chromium_src-3773020c131d144f0e0e1d849227b34d7c4cf6e1.zip chromium_src-3773020c131d144f0e0e1d849227b34d7c4cf6e1.tar.gz chromium_src-3773020c131d144f0e0e1d849227b34d7c4cf6e1.tar.bz2 |
Add a temporary flag to enable Core Animation mode for Flash (when possible)
This makes our Mac wmode hack--which prevents Flash from using "accelerated" QuickDraw mode, which is incredibly slow for us, but also prevents Flash 10.1 from using Core Animation in the same cases--conditional based on having both support for Core Animation mode in both Flash and Chromium, and on having a flag.
Once we are confident that there are no regressions preventing us from allowing Core Animation by default, the flag will be removed.
BUG=38932
TEST=Run with --enable-flash-core-animation and the current Flash 10.1 beta on 10.6; sites like YouTube should have negligable CPU usage.
Review URL: http://codereview.chromium.org/1115010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42356 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 1 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 4 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 41 |
4 files changed, 42 insertions, 5 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 8eeecfc..0757d17 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -555,6 +555,7 @@ void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( #if defined(OS_MACOSX) // Allow this to be set when invoking the browser and relayed along. switches::kEnableSandboxLogging, + switches::kEnableFlashCoreAnimation, #endif }; diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index cb93cbc..8e0ce91 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -841,6 +841,10 @@ const char kNoProcessSingletonDialog[] = "no-process-singleton-dialog"; // Cause the OS X sandbox write to syslog every time an access to a resource // is denied by the sandbox. const char kEnableSandboxLogging[] = "enable-sandbox-logging"; + +// Temporary flag to allow Flash to negotiate the Core Animation drawing model. +// This will eventually become the default, and the flag can be removed. +const char kEnableFlashCoreAnimation[] = "enable-flash-core-animation"; #else // Enable Kiosk mode. const char kKioskMode[] = "kiosk"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 27a53d2..652a344 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -246,6 +246,7 @@ extern const char kNoProcessSingletonDialog[]; #endif #if defined(OS_MACOSX) +extern const char kEnableFlashCoreAnimation[]; extern const char kEnableSandboxLogging[]; #else extern const char kKioskMode[]; diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 28a611e..216b39d 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -13,11 +13,14 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/basictypes.h" +#include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" #include "base/ref_counted.h" #include "base/string_util.h" +#include "base/sys_info.h" #include "chrome/common/child_process_logging.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" #include "chrome/plugin/npobject_proxy.h" @@ -281,13 +284,41 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, } } #if defined(OS_MACOSX) - // Until we have a way to support accelerated (3D) drawing on Macs, ask + // Unless we have a real way to support accelerated (3D) drawing on Macs + // (which for now at least means the Core Animation drawing model), ask // Flash to use windowless mode so that it use CoreGraphics instead of opening - // OpenGL contexts overlaying the browser window (which will fail or crash - // because Mac OS X does not allow that across processes). + // OpenGL contexts overlaying the browser window (which requires a very + // expensive extra copy for us). if (!transparent_ && mime_type_ == "application/x-shockwave-flash") { - params.arg_names.push_back("wmode"); - params.arg_values.push_back("opaque"); + bool force_opaque_mode = false; + if (StartsWith(info_.version, L"10.0", false) || + StartsWith(info_.version, L"9.", false)) { + // Older versions of Flash don't support CA (and they assume QuickDraw + // support, so we can't rely on negotiation to do the right thing). + force_opaque_mode = true; + } else if (!CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableFlashCoreAnimation)) { + // Temporary switch for testing; once we are confident that there are no + // regressions from CoreGraphics mode to CoreAnimation mode, this switch + // (and the chrome_switches.h and command_line.h includes) can be removed. + force_opaque_mode = true; + } else { + // Current betas of Flash 10.1 don't respect QuickDraw negotiation either, + // so we still have to force opaque mode on 10.5 (where we don't support + // Core Animation). If the final version of Flash 10.1 is fixed to do + // drawing model negotiation correctly instead of assuming that QuickDraw + // is available without asking, this whole block (and the sys_info.h + // include) can be removed. + int32 major, minor, bugfix; + base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix); + if (major < 10 || (major == 10 && minor < 6)) + force_opaque_mode = true; + } + + if (force_opaque_mode) { + params.arg_names.push_back("wmode"); + params.arg_values.push_back("opaque"); + } } params.containing_window_frame = render_view_->rootWindowRect(); |