diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 07:20:09 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 07:20:09 +0000 |
commit | 25900c9b553986979371eb78f68c070aa1b429f3 (patch) | |
tree | a0d513c9e6c4bc059f7eb151cc571312d07a257c | |
parent | ba4ce1c8f606c3b428964ee4afe44d9330a8a7df (diff) | |
download | chromium_src-25900c9b553986979371eb78f68c070aa1b429f3.zip chromium_src-25900c9b553986979371eb78f68c070aa1b429f3.tar.gz chromium_src-25900c9b553986979371eb78f68c070aa1b429f3.tar.bz2 |
Enable the in-browser thumbnailing by default on supported platforms.
This CL flips --enable-in-browser-thumbnailing to --disable-inbrowser-thumbnailing, and enables the in-browser thumbnailing by default on the following platforms.
- Windows Vista or later
- Mac
- Chrome OS
On the following platform, in-browser thumbnailing is not enabled because it's not supported yet.
- Non-Aura (GTK) Linux
- Windows XP
BUG=120003
TEST=Manually tested on each platform
Review URL: https://chromiumcodereview.appspot.com/10310153
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139748 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chrome_content_browser_client.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/tab_contents/tab_contents_wrapper.cc | 4 | ||||
-rw-r--r-- | chrome/chrome_common.gypi | 2 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 10 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 2 | ||||
-rw-r--r-- | chrome/common/thumbnail_support.cc | 30 | ||||
-rw-r--r-- | chrome/common/thumbnail_support.h | 16 | ||||
-rw-r--r-- | chrome/renderer/chrome_render_view_observer.cc | 9 | ||||
-rw-r--r-- | chrome/test/perf/rendering/latency_tests.cc | 3 |
9 files changed, 61 insertions, 17 deletions
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 3552195..9735799 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -763,12 +763,12 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( switches::kDisableAsynchronousSpellChecking, switches::kDisableBundledPpapiFlash, switches::kDisableExtensionsResourceWhitelist, + switches::kDisableInBrowserThumbnailing, switches::kDumpHistogramsOnExit, switches::kEnableBenchmarking, switches::kEnableBundledPpapiFlash, switches::kEnableCrxlessWebApps, switches::kEnableExperimentalExtensionApis, - switches::kEnableInBrowserThumbnailing, switches::kEnableIPCFuzzing, switches::kEnableNaCl, switches::kEnableNaClIPCProxy, diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index b9c464e..b1e87e6c 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -47,6 +47,7 @@ #include "chrome/browser/view_type_utils.h" #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/thumbnail_support.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" @@ -148,8 +149,7 @@ TabContentsWrapper::TabContentsWrapper(WebContents* contents) #endif // Start the in-browser thumbnailing if the feature is enabled. - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableInBrowserThumbnailing)) { + if (ShouldEnableInBrowserThumbnailing()) { thumbnail_generator_.reset(new ThumbnailGenerator); thumbnail_generator_->StartThumbnailing(web_contents_.get()); } diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 31135ad..222e34e 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -269,6 +269,8 @@ 'common/switch_utils.h', 'common/thumbnail_score.cc', 'common/thumbnail_score.h', + 'common/thumbnail_support.cc', + 'common/thumbnail_support.h', 'common/time_format.cc', 'common/time_format.h', 'common/url_constants.cc', diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index c47195f..da4531f 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -321,6 +321,11 @@ const char kDisableHistoryURLProvider[] = "disable-history-url-provider"; const char kDisableImprovedDownloadProtection[] = "disable-improved-download-protection"; +// Disables the in-browser thumbnailing, which is more efficient than the +// in-renderer thumbnailing, as we can use more information to determine if we +// need to update thumbnails. +const char kDisableInBrowserThumbnailing[] = "disable-in-browser-thumbnailing"; + // Disable the internal Flash Player. const char kDisableInternalFlash[] = "disable-internal-flash"; @@ -518,11 +523,6 @@ const char kEnableFileCookies[] = "enable-file-cookies"; // Without this flag, pipelining will never be used. const char kEnableHttpPipelining[] = "enable-http-pipelining"; -// Enables the in-browser thumbnailing, which is more efficient than the -// in-renderer thumbnailing, as we can use more information to determine if we -// need to update thumbnails. -const char kEnableInBrowserThumbnailing[] = "enable-in-browser-thumbnailing"; - // Enables IPv6 support, even if probes suggest that it may not be fully // supported. Some probes may require internet connections, and this flag will // allow support independent of application testing. This flag overrides diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index c2ccf9b..78e227b 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -96,6 +96,7 @@ extern const char kDisableFlashSandbox[]; extern const char kDisableHistoryQuickProvider[]; extern const char kDisableHistoryURLProvider[]; extern const char kDisableImprovedDownloadProtection[]; +extern const char kDisableInBrowserThumbnailing[]; extern const char kDisableInternalFlash[]; extern const char kDisableIPv6[]; extern const char kDisableIPPooling[]; @@ -150,7 +151,6 @@ extern const char kEnableExtensionActivityUI[]; extern const char kEnableExtensionTimelineApi[]; extern const char kEnableFileCookies[]; extern const char kEnableHttpPipelining[]; -extern const char kEnableInBrowserThumbnailing[]; extern const char kEnableIPv6[]; extern const char kEnableIPCFuzzing[]; extern const char kEnableIPPooling[]; diff --git a/chrome/common/thumbnail_support.cc b/chrome/common/thumbnail_support.cc new file mode 100644 index 0000000..ef378f2 --- /dev/null +++ b/chrome/common/thumbnail_support.cc @@ -0,0 +1,30 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/thumbnail_support.h" + +#include "base/command_line.h" +#include "chrome/common/chrome_switches.h" + +#if defined(OS_WIN) +#include "base/win/windows_version.h" +#endif + +bool ShouldEnableInBrowserThumbnailing() { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableInBrowserThumbnailing)) + return false; + +#if defined(OS_WIN) + // Disables in-browser thumbnailing on Windows XP where not supported yet. + if (base::win::GetVersion() < base::win::VERSION_VISTA) + return false; + return true; +#elif defined(OS_LINUX) && !defined(USE_AURA) + // Disables in-browser thumbnailing on non-Aura Linux where not supported yet. + return false; +#else + return true; +#endif +} diff --git a/chrome/common/thumbnail_support.h b/chrome/common/thumbnail_support.h new file mode 100644 index 0000000..cb642ae --- /dev/null +++ b/chrome/common/thumbnail_support.h @@ -0,0 +1,16 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_THUMBNAIL_SUPPORT_H_ +#define CHROME_COMMON_THUMBNAIL_SUPPORT_H_ +#pragma once + +// TODO(mazda): Remove this file once in-browser thumbnailing is supported on +// all platforms. + +// Returns true if in-browser thumbnailing is supported and not disabled by the +// command line flag. +bool ShouldEnableInBrowserThumbnailing(); + +#endif // CHROME_COMMON_THUMBNAIL_SUPPORT_H_ diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index 2371ac2..742b1e9 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -17,6 +17,7 @@ #include "chrome/common/prerender_messages.h" #include "chrome/common/render_messages.h" #include "chrome/common/thumbnail_score.h" +#include "chrome/common/thumbnail_support.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/chrome_render_process_observer.h" #include "chrome/renderer/content_settings_observer.h" @@ -832,12 +833,10 @@ void ChromeRenderViewObserver::CapturePageInfo(bool preliminary_capture) { } // Generate the thumbnail here if the in-browser thumbnailing isn't - // enabled. TODO(satorux): Remove this and related code once - // crbug.com/65936 is complete. - if (!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableInBrowserThumbnailing)) { + // enabled. TODO(mazda): Remove this and related code once in-browser + // thumbnailing is supported on all platforms (http://crbug.com/120003). + if (!ShouldEnableInBrowserThumbnailing()) CaptureThumbnail(); - } #if defined(ENABLE_SAFE_BROWSING) // Will swap out the string. diff --git a/chrome/test/perf/rendering/latency_tests.cc b/chrome/test/perf/rendering/latency_tests.cc index 6e94151..de72c18 100644 --- a/chrome/test/perf/rendering/latency_tests.cc +++ b/chrome/test/perf/rendering/latency_tests.cc @@ -229,9 +229,6 @@ void LatencyTest::SetUpCommandLine(CommandLine* command_line) { HasSwitch(switches::kEnableThreadedCompositing)) { command_line->AppendSwitch(switches::kEnableThreadedCompositing); } - // Default behavior is to thumbnail the tab after 0.5 seconds, causing - // a nasty frame hitch and disturbing the latency test. Fix that: - command_line->AppendSwitch(switches::kEnableInBrowserThumbnailing); command_line->AppendSwitch(switches::kDisableBackgroundNetworking); } |