From 011e02669045d1f825523c6d079c0c3c49d81be0 Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Fri, 20 Feb 2015 20:08:35 -0800 Subject: [PATCH 001/260] Incrementing VERSION to 42.0.2311.1 Cr-Commit-Position: refs/branch-heads/2311@{#1} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index c7553ee1235d6..720da9f9689c2 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=0 +PATCH=1 From e955e4f0e41584413d3a0a14ab85df714ae4bd5b Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Fri, 20 Feb 2015 20:37:00 -0800 Subject: [PATCH 002/260] Incrementing VERSION to 42.0.2311.2 Cr-Commit-Position: refs/branch-heads/2311@{#2} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index 720da9f9689c2..85bd78111a677 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=1 +PATCH=2 From 020b7695373a421d17bc13b61b3a6bd34a19ae05 Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Sat, 21 Feb 2015 01:56:52 -0800 Subject: [PATCH 003/260] Incrementing VERSION to 42.0.2311.3 Cr-Commit-Position: refs/branch-heads/2311@{#3} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index 85bd78111a677..aa334d0917d67 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=2 +PATCH=3 From f3d6206d3ba3c5e35c92c0848f0fdade10a33f47 Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Sat, 21 Feb 2015 19:21:56 -0800 Subject: [PATCH 004/260] Incrementing VERSION to 42.0.2311.4 Cr-Commit-Position: refs/branch-heads/2311@{#4} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index aa334d0917d67..50ac9b12afef5 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=3 +PATCH=4 From 4241851846d87ce3d9453bd6cc9de6ce6a78e766 Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Mon, 23 Feb 2015 10:46:57 -0800 Subject: [PATCH 005/260] Incrementing VERSION to 42.0.2311.5 Cr-Commit-Position: refs/branch-heads/2311@{#5} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index 50ac9b12afef5..b848c3a9ef90c 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=4 +PATCH=5 From 2293e1b352ae454494c943b522a9cf4993332a8c Mon Sep 17 00:00:00 2001 From: Alex Mineer Date: Mon, 23 Feb 2015 14:07:14 -0800 Subject: [PATCH 006/260] Add new SRT bubble string. BUG=440407 Review URL: https://codereview.chromium.org/950993002 (cherry picked from commit 9b3d6f1d977fc7fda607adc6ac4244a68466c477) Cr-Original-Commit-Position: refs/heads/master@{#317647} Cr-Commit-Position: refs/branch-heads/2311@{#6} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/app/generated_resources.grd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 7108c95927c64..4907d5a300d68 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -770,7 +770,7 @@ Psst! Incognito mode $1(Ctrl+Shift+N) may Open original &image in new tab - + &Loop @@ -8472,6 +8472,9 @@ I don't think this site should be blocked! Get the Software Removal Tool + + Run the Software Removal Tool + From a60b9e15465c2637c196536d7d876f9b489fb2b3 Mon Sep 17 00:00:00 2001 From: matthewyuan Date: Mon, 23 Feb 2015 16:57:17 -0800 Subject: [PATCH 007/260] Disable container overflow check on Linux and Mac. BUG=459632,460294 TBR=glider@chromium.org NOTRY=true Review URL: https://codereview.chromium.org/951083002 Cr-Commit-Position: refs/heads/master@{#317681} (cherry picked from commit 6c3ce96dedaf8f23fce9cbd9c5279fe20c531ac6) Review URL: https://codereview.chromium.org/948153003 Cr-Commit-Position: refs/branch-heads/2311@{#7} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- build/sanitizers/sanitizer_options.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build/sanitizers/sanitizer_options.cc b/build/sanitizers/sanitizer_options.cc index 6668c1eef3022..33090fb94b792 100644 --- a/build/sanitizers/sanitizer_options.cc +++ b/build/sanitizers/sanitizer_options.cc @@ -66,6 +66,8 @@ void _sanitizer_options_link_helper() { } // so the slow unwinder may not work properly. // detect_stack_use_after_return=1 - use fake stack to delay the reuse of // stack allocations and detect stack-use-after-return errors. +// detect_container_overflow=0 - do not detect overflows in containers +// until crbug.com/459632 is fixed. #if defined(OS_LINUX) #if defined(GOOGLE_CHROME_BUILD) // Default AddressSanitizer options for the official build. These do not affect @@ -74,20 +76,22 @@ void _sanitizer_options_link_helper() { } const char kAsanDefaultOptions[] = "legacy_pthread_cond=1 malloc_context_size=5 strict_memcmp=0 " "symbolize=false check_printf=1 use_sigaltstack=1 detect_leaks=0 " - "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1"; + "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " + "detect_container_overflow=0 "; #else // Default AddressSanitizer options for buildbots and non-official builds. const char *kAsanDefaultOptions = "strict_memcmp=0 symbolize=false check_printf=1 use_sigaltstack=1 " "detect_leaks=0 strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " - "detect_stack_use_after_return=1 "; + "detect_stack_use_after_return=1 detect_container_overflow=0 "; #endif // GOOGLE_CHROME_BUILD #elif defined(OS_MACOSX) const char *kAsanDefaultOptions = "strict_memcmp=0 replace_intrin=0 check_printf=1 use_sigaltstack=1 " "strip_path_prefix=Release/../../ fast_unwind_on_fatal=1 " - "detect_stack_use_after_return=1 detect_odr_violation=0 "; + "detect_stack_use_after_return=1 detect_odr_violation=0 " + "detect_container_overflow=0 "; static const char kNaClDefaultOptions[] = "handle_segv=0"; static const char kNaClFlag[] = "--type=nacl-loader"; #endif // OS_LINUX From a5fd4099a2d30a4a11c282ff5d23df4aac06a54a Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Mon, 23 Feb 2015 18:07:04 -0800 Subject: [PATCH 008/260] Incrementing VERSION to 42.0.2311.6 Cr-Commit-Position: refs/branch-heads/2311@{#8} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index b848c3a9ef90c..ecccec9760f46 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=5 +PATCH=6 From eb33cd5741d3406c1424e3e005d7b5124a54fd9b Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Mon, 23 Feb 2015 19:06:52 -0800 Subject: [PATCH 009/260] Incrementing VERSION to 42.0.2311.7 Cr-Commit-Position: refs/branch-heads/2311@{#9} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index ecccec9760f46..bffa2df3837d9 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=6 +PATCH=7 From 1dcbabeffc041e106ff59aada4af1b1d5ed1bcae Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Mon, 23 Feb 2015 21:01:46 -0800 Subject: [PATCH 010/260] Incrementing VERSION to 42.0.2311.8 Cr-Commit-Position: refs/branch-heads/2311@{#10} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index bffa2df3837d9..f497197ca9b43 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=7 +PATCH=8 From 52e1248a93618e54a6c2be92360a9b47a0b823e4 Mon Sep 17 00:00:00 2001 From: matthewyuan Date: Tue, 24 Feb 2015 01:46:30 -0800 Subject: [PATCH 011/260] download_sdk_extras: Catch the correct error. Catch the error raised by 'check_call' rather than the error emitted by the called process. BUG=chromium:460693,chromium:459681 TEST=local - Ran without fix, setting CHROME_HEADLESS=1. Script failed with the exception in the bug. - Ran with fix, 'gsutil' failed with AccessDeniedException output and the calling script successfully emitted a warning message. R=hinoka@chromium.org, navabi@chromium.org Review URL: https://codereview.chromium.org/949813002 Cr-Commit-Position: refs/heads/master@{#317608} (cherry picked from commit 63ab4fead51b043cb1f21ae2b31f9e593cbdc3ca) Review URL: https://codereview.chromium.org/953803002 Cr-Commit-Position: refs/branch-heads/2311@{#11} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- build/download_sdk_extras.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/download_sdk_extras.py b/build/download_sdk_extras.py index d22d8850c2e76..d7c5d6cad6c9e 100755 --- a/build/download_sdk_extras.py +++ b/build/download_sdk_extras.py @@ -59,9 +59,9 @@ def main(): try: subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7', 'cp', package_zip, local_zip]) - except AccessDeniedException: - print ('WARNING: Bot does not have permission to download SDK packages.' - ' If this bot compiles for Android, it may have errors.') + except subprocess.CalledProcessError: + print ('WARNING: Failed to download SDK packages. If this bot compiles ' + 'for Android, it may have errors.') return 0 # Always clean dir and extract zip to ensure correct contents. clean_and_extract(package['dir_name'], package['package'], package['zip']) From 340fa94e85659de18a305ffefa74cf29c509a4b2 Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Tue, 24 Feb 2015 01:56:53 -0800 Subject: [PATCH 012/260] Incrementing VERSION to 42.0.2311.9 Cr-Commit-Position: refs/branch-heads/2311@{#12} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index f497197ca9b43..55302970873b6 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=8 +PATCH=9 From fb0b694bfe0727df54efc9d30f08777e33f927aa Mon Sep 17 00:00:00 2001 From: Daniel Nicoara Date: Tue, 24 Feb 2015 10:12:53 -0500 Subject: [PATCH 013/260] [Ozone-Dri] Replace blend with copy to the modeset buffer By default Skia blends the source and destination buffers when drawing an image. This forces it to copy the source buffer to the modeset buffer. BUG=455605 Review URL: https://codereview.chromium.org/948903003 Cr-Commit-Position: refs/heads/master@{#317691} (cherry picked from commit 38ad735158807f7f25a3805ab650cc15913e3d18) Review URL: https://codereview.chromium.org/956553003 Cr-Commit-Position: refs/branch-heads/2311@{#13} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- ui/ozone/platform/dri/screen_manager.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/ozone/platform/dri/screen_manager.cc b/ui/ozone/platform/dri/screen_manager.cc index 2a1eaeca91bbc..fbf2edef55a95 100644 --- a/ui/ozone/platform/dri/screen_manager.cc +++ b/ui/ozone/platform/dri/screen_manager.cc @@ -54,7 +54,10 @@ void FillModesetBuffer(const scoped_refptr& dri, return; skia::RefPtr image = saved_buffer.image(); - modeset_buffer.canvas()->drawImage(image.get(), 0, 0); + SkPaint paint; + // Copy the source buffer. Do not perform any blending. + paint.setXfermodeMode(SkXfermode::kSrc_Mode); + modeset_buffer.canvas()->drawImage(image.get(), 0, 0, &paint); } } // namespace From 7f79bcbb6621515b9198fdfaa45a90ab6abfb528 Mon Sep 17 00:00:00 2001 From: matthewyuan Date: Tue, 24 Feb 2015 11:44:10 -0800 Subject: [PATCH 014/260] [Ozone-Dri] Gracefully handle DRM devices with no resources DRM devices such as VGEM do not have resources, so we want to ignore them rather than crash. BUG=460982 Review URL: https://codereview.chromium.org/947293002 Cr-Commit-Position: refs/heads/master@{#317687} (cherry picked from commit 3b2bde2e135f6125956bc4b526e1a6208111ae53) Review URL: https://codereview.chromium.org/956563004 Cr-Commit-Position: refs/branch-heads/2311@{#14} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- ui/ozone/platform/dri/dri_wrapper.cc | 27 ++++++++++++++++--- ui/ozone/platform/dri/dri_wrapper.h | 2 +- ui/ozone/platform/dri/drm_device_generator.cc | 6 +++-- ui/ozone/platform/dri/gbm_wrapper.cc | 14 +++++++--- ui/ozone/platform/dri/gbm_wrapper.h | 2 +- .../dri/hardware_display_plane_manager.cc | 2 +- .../dri/native_display_delegate_dri.cc | 12 ++++++--- ui/ozone/platform/dri/ozone_platform_dri.cc | 4 ++- ui/ozone/platform/dri/ozone_platform_gbm.cc | 10 ++++--- 9 files changed, 59 insertions(+), 20 deletions(-) diff --git a/ui/ozone/platform/dri/dri_wrapper.cc b/ui/ozone/platform/dri/dri_wrapper.cc index 9cdc994353a2e..a2b333f16e762 100644 --- a/ui/ozone/platform/dri/dri_wrapper.cc +++ b/ui/ozone/platform/dri/dri_wrapper.cc @@ -88,6 +88,14 @@ void HandlePageFlipEventOnUI(int fd, payload->callback.Run(frame, seconds, useconds); } +bool CanQueryForResources(int fd) { + drm_mode_card_res resources; + memset(&resources, 0, sizeof(resources)); + // If there is no error getting DRM resources then assume this is a + // modesetting device. + return !drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &resources); +} + } // namespace class DriWrapper::IOWatcher @@ -163,10 +171,23 @@ DriWrapper::~DriWrapper() { watcher_->Shutdown(); } -void DriWrapper::Initialize() { +bool DriWrapper::Initialize() { + // Ignore devices that cannot perform modesetting. + if (!CanQueryForResources(file_.GetPlatformFile())) { + VLOG(2) << "Cannot query for resources for '" << device_path_.value() + << "'"; + return false; + } + plane_manager_.reset(new HardwareDisplayPlaneManagerLegacy()); - if (!plane_manager_->Initialize(this)) - LOG(ERROR) << "Failed to initialize the plane manager"; + if (!plane_manager_->Initialize(this)) { + LOG(ERROR) << "Failed to initialize the plane manager for " + << device_path_.value(); + plane_manager_.reset(); + return false; + } + + return true; } void DriWrapper::InitializeTaskRunner( diff --git a/ui/ozone/platform/dri/dri_wrapper.h b/ui/ozone/platform/dri/dri_wrapper.h index b83b7a738ad28..d47c506db0239 100644 --- a/ui/ozone/platform/dri/dri_wrapper.h +++ b/ui/ozone/platform/dri/dri_wrapper.h @@ -48,7 +48,7 @@ class OZONE_EXPORT DriWrapper : public base::RefCountedThreadSafe { DriWrapper(const base::FilePath& device_path, base::File file); // Open device. - virtual void Initialize(); + virtual bool Initialize(); // |task_runner| will be used to asynchronously page flip. virtual void InitializeTaskRunner( diff --git a/ui/ozone/platform/dri/drm_device_generator.cc b/ui/ozone/platform/dri/drm_device_generator.cc index 7b4a568eeda67..13985db458abc 100644 --- a/ui/ozone/platform/dri/drm_device_generator.cc +++ b/ui/ozone/platform/dri/drm_device_generator.cc @@ -18,8 +18,10 @@ scoped_refptr DrmDeviceGenerator::CreateDevice( const base::FilePath& device_path, base::File file) { scoped_refptr drm = new DriWrapper(device_path, file.Pass()); - drm->Initialize(); - return drm; + if (drm->Initialize()) + return drm; + + return nullptr; } } // namespace ui diff --git a/ui/ozone/platform/dri/gbm_wrapper.cc b/ui/ozone/platform/dri/gbm_wrapper.cc index e75cc58a33587..e0d1f17ddc623 100644 --- a/ui/ozone/platform/dri/gbm_wrapper.cc +++ b/ui/ozone/platform/dri/gbm_wrapper.cc @@ -21,11 +21,17 @@ GbmWrapper::~GbmWrapper() { gbm_device_destroy(device_); } -void GbmWrapper::Initialize() { - DriWrapper::Initialize(); +bool GbmWrapper::Initialize() { + if (!DriWrapper::Initialize()) + return false; + device_ = gbm_create_device(get_fd()); - if (!device_) - LOG(FATAL) << "Unable to initialize GBM"; + if (!device_) { + LOG(ERROR) << "Unable to initialize GBM"; + return false; + } + + return true; } } // namespace ui diff --git a/ui/ozone/platform/dri/gbm_wrapper.h b/ui/ozone/platform/dri/gbm_wrapper.h index 41b2b6a9498b8..3df255042bcf8 100644 --- a/ui/ozone/platform/dri/gbm_wrapper.h +++ b/ui/ozone/platform/dri/gbm_wrapper.h @@ -19,7 +19,7 @@ class GbmWrapper : public DriWrapper { gbm_device* device() const { return device_; } // DriWrapper implementation: - void Initialize() override; + bool Initialize() override; private: ~GbmWrapper() override; diff --git a/ui/ozone/platform/dri/hardware_display_plane_manager.cc b/ui/ozone/platform/dri/hardware_display_plane_manager.cc index f465e6c1ffc7e..2a8b7cc37aaf4 100644 --- a/ui/ozone/platform/dri/hardware_display_plane_manager.cc +++ b/ui/ozone/platform/dri/hardware_display_plane_manager.cc @@ -69,7 +69,7 @@ bool HardwareDisplayPlaneManager::Initialize(DriWrapper* drm) { drm_ = drm; ScopedDrmResourcesPtr resources(drmModeGetResources(drm->get_fd())); if (!resources) { - LOG(ERROR) << "Failed to get resources."; + PLOG(ERROR) << "Failed to get resources"; return false; } diff --git a/ui/ozone/platform/dri/native_display_delegate_dri.cc b/ui/ozone/platform/dri/native_display_delegate_dri.cc index b242283a88b8b..ba5d2aed35cdf 100644 --- a/ui/ozone/platform/dri/native_display_delegate_dri.cc +++ b/ui/ozone/platform/dri/native_display_delegate_dri.cc @@ -219,13 +219,17 @@ void NativeDisplayDelegateDri::AddGraphicsDevice( auto it = std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); if (it != devices_.end()) { - LOG(WARNING) << "Got request to add existing device '" << path.value() - << "'"; + VLOG(2) << "Got request to add existing device '" << path.value() << "'"; return; } scoped_refptr device = drm_device_generator_->CreateDevice(path, file.Pass()); + if (!device) { + VLOG(2) << "Could not initialize DRM device for '" << path.value() << "'"; + return; + } + devices_.push_back(device); if (io_task_runner_) device->InitializeTaskRunner(io_task_runner_); @@ -236,8 +240,8 @@ void NativeDisplayDelegateDri::RemoveGraphicsDevice( auto it = std::find_if(devices_.begin(), devices_.end(), FindByDevicePath(path)); if (it == devices_.end()) { - LOG(ERROR) << "Got request to remove non-existent device '" << path.value() - << "'"; + VLOG(2) << "Got request to remove non-existent device '" << path.value() + << "'"; return; } diff --git a/ui/ozone/platform/dri/ozone_platform_dri.cc b/ui/ozone/platform/dri/ozone_platform_dri.cc index 905c9f49a95a4..b01cfc17bf8db 100644 --- a/ui/ozone/platform/dri/ozone_platform_dri.cc +++ b/ui/ozone/platform/dri/ozone_platform_dri.cc @@ -91,7 +91,9 @@ class OzonePlatformDri : public OzonePlatform { display_manager_.get())); } void InitializeUI() override { - dri_->Initialize(); + if (!dri_->Initialize()) + LOG(FATAL) << "Failed to initialize primary DRM device"; + // This makes sure that simple targets that do not handle display // configuration can still use the primary display. ForceInitializationOfPrimaryDisplay(dri_, screen_manager_.get()); diff --git a/ui/ozone/platform/dri/ozone_platform_gbm.cc b/ui/ozone/platform/dri/ozone_platform_gbm.cc index fe728f041c3f8..dcfbbcb8cb61d 100644 --- a/ui/ozone/platform/dri/ozone_platform_gbm.cc +++ b/ui/ozone/platform/dri/ozone_platform_gbm.cc @@ -96,8 +96,10 @@ class GbmDeviceGenerator : public DrmDeviceGenerator { scoped_refptr CreateDevice(const base::FilePath& path, base::File file) override { scoped_refptr drm = new GbmWrapper(path, file.Pass()); - drm->Initialize(); - return drm; + if (drm->Initialize()) + return drm; + + return nullptr; } private: @@ -173,7 +175,9 @@ class OzonePlatformGbm : public OzonePlatform { gl_api_loader_.reset(new GlApiLoader()); // Async page flips are supported only on surfaceless mode. gbm_ = new GbmWrapper(GetFirstDisplayCardPath()); - gbm_->Initialize(); + if (!gbm_->Initialize()) + LOG(FATAL) << "Failed to initialize primary DRM device"; + drm_device_manager_.reset(new DrmDeviceManager(gbm_)); buffer_generator_.reset(new GbmBufferGenerator()); screen_manager_.reset(new ScreenManager(buffer_generator_.get())); From 77ae0e3edb47974d8112f5d734bb96c0b02905d4 Mon Sep 17 00:00:00 2001 From: chrome-tpm Date: Tue, 24 Feb 2015 12:02:38 -0800 Subject: [PATCH 015/260] Incrementing VERSION to 42.0.2311.10 Cr-Commit-Position: refs/branch-heads/2311@{#15} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/VERSION b/chrome/VERSION index 55302970873b6..d8a04be467717 100644 --- a/chrome/VERSION +++ b/chrome/VERSION @@ -1,4 +1,4 @@ MAJOR=42 MINOR=0 BUILD=2311 -PATCH=9 +PATCH=10 From d2e4b7cb5102fc7280450529332f55c127b29049 Mon Sep 17 00:00:00 2001 From: Ben Greenstein Date: Tue, 24 Feb 2015 12:55:01 -0800 Subject: [PATCH 016/260] Context menu to view original image when Data Saver is being used. Show menu item to view original image if the request could go over the data reduction proxy. BUG=456247 Review URL: https://codereview.chromium.org/944533002 Cr-Commit-Position: refs/heads/master@{#317720} (cherry picked from commit f28021f2f6547ae1aef2bf350caab24edd656732) Review URL: https://codereview.chromium.org/953053003 Cr-Commit-Position: refs/branch-heads/2311@{#16} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/app/chrome_command_ids.h | 1 + .../render_view_context_menu.cc | 149 ++++++++++-------- .../render_view_context_menu_browsertest.cc | 65 +++++++- .../browser/data_reduction_proxy_settings.cc | 11 +- .../browser/data_reduction_proxy_settings.h | 20 ++- .../data_reduction_proxy_settings_unittest.cc | 17 ++ .../render_view_context_menu_base.cc | 16 +- .../render_view_context_menu_base.h | 7 + tools/metrics/histograms/histograms.xml | 1 + 9 files changed, 209 insertions(+), 78 deletions(-) diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index 4b7a3fed9f3a6..f7b060456ce5e 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h @@ -279,6 +279,7 @@ #define IDC_CONTENT_CONTEXT_COPYIMAGE 50112 #define IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB 50113 #define IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE 50114 +#define IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB 50115 // Audio/video items. #define IDC_CONTENT_CONTEXT_SAVEAVAS 50120 #define IDC_CONTENT_CONTEXT_COPYAVLOCATION 50121 diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index af666b7e166ad..fc76b17d38ab7 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -31,6 +31,8 @@ #include "chrome/browser/download/download_stats.h" #include "chrome/browser/extensions/devtools_util.h" #include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" +#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h" #include "chrome/browser/plugins/chrome_plugin_service_filter.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/profiles/profile.h" @@ -148,69 +150,70 @@ const struct UmaEnumCommandIdPair { int enum_id; int control_id; } kUmaEnumToControlId[] = { - /* - enum id for 0, 1 are detected using - RenderViewContextMenu::IsContentCustomCommandId and - ContextMenuMatcher::IsExtensionsCustomCommandId - */ - {2, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST}, - {3, IDC_CONTENT_CONTEXT_OPENLINKNEWTAB}, - {4, IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW}, - {5, IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD}, - {6, IDC_CONTENT_CONTEXT_SAVELINKAS}, - {7, IDC_CONTENT_CONTEXT_SAVEAVAS}, - {8, IDC_CONTENT_CONTEXT_SAVEIMAGEAS}, - {9, IDC_CONTENT_CONTEXT_COPYLINKLOCATION}, - {10, IDC_CONTENT_CONTEXT_COPYIMAGELOCATION}, - {11, IDC_CONTENT_CONTEXT_COPYAVLOCATION}, - {12, IDC_CONTENT_CONTEXT_COPYIMAGE}, - {13, IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB}, - {14, IDC_CONTENT_CONTEXT_OPENAVNEWTAB}, - {15, IDC_CONTENT_CONTEXT_PLAYPAUSE}, - {16, IDC_CONTENT_CONTEXT_MUTE}, - {17, IDC_CONTENT_CONTEXT_LOOP}, - {18, IDC_CONTENT_CONTEXT_CONTROLS}, - {19, IDC_CONTENT_CONTEXT_ROTATECW}, - {20, IDC_CONTENT_CONTEXT_ROTATECCW}, - {21, IDC_BACK}, - {22, IDC_FORWARD}, - {23, IDC_SAVE_PAGE}, - {24, IDC_RELOAD}, - {25, IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP}, - {26, IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP}, - {27, IDC_PRINT}, - {28, IDC_VIEW_SOURCE}, - {29, IDC_CONTENT_CONTEXT_INSPECTELEMENT}, - {30, IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE}, - {31, IDC_CONTENT_CONTEXT_VIEWPAGEINFO}, - {32, IDC_CONTENT_CONTEXT_TRANSLATE}, - {33, IDC_CONTENT_CONTEXT_RELOADFRAME}, - {34, IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE}, - {35, IDC_CONTENT_CONTEXT_VIEWFRAMEINFO}, - {36, IDC_CONTENT_CONTEXT_UNDO}, - {37, IDC_CONTENT_CONTEXT_REDO}, - {38, IDC_CONTENT_CONTEXT_CUT}, - {39, IDC_CONTENT_CONTEXT_COPY}, - {40, IDC_CONTENT_CONTEXT_PASTE}, - {41, IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE}, - {42, IDC_CONTENT_CONTEXT_DELETE}, - {43, IDC_CONTENT_CONTEXT_SELECTALL}, - {44, IDC_CONTENT_CONTEXT_SEARCHWEBFOR}, - {45, IDC_CONTENT_CONTEXT_GOTOURL}, - {46, IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS}, - {47, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS}, - {48, IDC_CONTENT_CONTEXT_ADDSEARCHENGINE}, - {52, IDC_CONTENT_CONTEXT_OPENLINKWITH}, - {53, IDC_CHECK_SPELLING_WHILE_TYPING}, - {54, IDC_SPELLCHECK_MENU}, - {55, IDC_CONTENT_CONTEXT_SPELLING_TOGGLE}, - {56, IDC_SPELLCHECK_LANGUAGES_FIRST}, - {57, IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE}, - {58, IDC_SPELLCHECK_SUGGESTION_0}, - {59, IDC_SPELLCHECK_ADD_TO_DICTIONARY}, - {60, IDC_SPELLPANEL_TOGGLE}, - // Add new items here and use |enum_id| from the next line. - {61, 0}, // Must be the last. Increment |enum_id| when new IDC was added. + /* + enum id for 0, 1 are detected using + RenderViewContextMenu::IsContentCustomCommandId and + ContextMenuMatcher::IsExtensionsCustomCommandId + */ + {2, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST}, + {3, IDC_CONTENT_CONTEXT_OPENLINKNEWTAB}, + {4, IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW}, + {5, IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD}, + {6, IDC_CONTENT_CONTEXT_SAVELINKAS}, + {7, IDC_CONTENT_CONTEXT_SAVEAVAS}, + {8, IDC_CONTENT_CONTEXT_SAVEIMAGEAS}, + {9, IDC_CONTENT_CONTEXT_COPYLINKLOCATION}, + {10, IDC_CONTENT_CONTEXT_COPYIMAGELOCATION}, + {11, IDC_CONTENT_CONTEXT_COPYAVLOCATION}, + {12, IDC_CONTENT_CONTEXT_COPYIMAGE}, + {13, IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB}, + {14, IDC_CONTENT_CONTEXT_OPENAVNEWTAB}, + {15, IDC_CONTENT_CONTEXT_PLAYPAUSE}, + {16, IDC_CONTENT_CONTEXT_MUTE}, + {17, IDC_CONTENT_CONTEXT_LOOP}, + {18, IDC_CONTENT_CONTEXT_CONTROLS}, + {19, IDC_CONTENT_CONTEXT_ROTATECW}, + {20, IDC_CONTENT_CONTEXT_ROTATECCW}, + {21, IDC_BACK}, + {22, IDC_FORWARD}, + {23, IDC_SAVE_PAGE}, + {24, IDC_RELOAD}, + {25, IDC_CONTENT_CONTEXT_RELOAD_PACKAGED_APP}, + {26, IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP}, + {27, IDC_PRINT}, + {28, IDC_VIEW_SOURCE}, + {29, IDC_CONTENT_CONTEXT_INSPECTELEMENT}, + {30, IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE}, + {31, IDC_CONTENT_CONTEXT_VIEWPAGEINFO}, + {32, IDC_CONTENT_CONTEXT_TRANSLATE}, + {33, IDC_CONTENT_CONTEXT_RELOADFRAME}, + {34, IDC_CONTENT_CONTEXT_VIEWFRAMESOURCE}, + {35, IDC_CONTENT_CONTEXT_VIEWFRAMEINFO}, + {36, IDC_CONTENT_CONTEXT_UNDO}, + {37, IDC_CONTENT_CONTEXT_REDO}, + {38, IDC_CONTENT_CONTEXT_CUT}, + {39, IDC_CONTENT_CONTEXT_COPY}, + {40, IDC_CONTENT_CONTEXT_PASTE}, + {41, IDC_CONTENT_CONTEXT_PASTE_AND_MATCH_STYLE}, + {42, IDC_CONTENT_CONTEXT_DELETE}, + {43, IDC_CONTENT_CONTEXT_SELECTALL}, + {44, IDC_CONTENT_CONTEXT_SEARCHWEBFOR}, + {45, IDC_CONTENT_CONTEXT_GOTOURL}, + {46, IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS}, + {47, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS}, + {48, IDC_CONTENT_CONTEXT_ADDSEARCHENGINE}, + {52, IDC_CONTENT_CONTEXT_OPENLINKWITH}, + {53, IDC_CHECK_SPELLING_WHILE_TYPING}, + {54, IDC_SPELLCHECK_MENU}, + {55, IDC_CONTENT_CONTEXT_SPELLING_TOGGLE}, + {56, IDC_SPELLCHECK_LANGUAGES_FIRST}, + {57, IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE}, + {58, IDC_SPELLCHECK_SUGGESTION_0}, + {59, IDC_SPELLCHECK_ADD_TO_DICTIONARY}, + {60, IDC_SPELLPANEL_TOGGLE}, + {61, IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB}, + // Add new items here and use |enum_id| from the next line. + {62, 0}, // Must be the last. Increment |enum_id| when new IDC was added. }; // Collapses large ranges of ids before looking for UMA enum. @@ -692,8 +695,16 @@ void RenderViewContextMenu::AppendImageItems() { IDS_CONTENT_CONTEXT_COPYIMAGELOCATION); menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE, IDS_CONTENT_CONTEXT_COPYIMAGE); - menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB, - IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB); + if (!browser_context_->IsOffTheRecord() && + DataReductionProxyChromeSettingsFactory::GetForBrowserContext( + browser_context_)->CanUseDataReductionProxy(params_.src_url)) { + menu_model_.AddItemWithStringId( + IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB, + IDS_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB); + } else { + menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB, + IDS_CONTENT_CONTEXT_OPENIMAGENEWTAB); + } } void RenderViewContextMenu::AppendSearchWebForImageItems() { @@ -1102,6 +1113,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { // The images shown in the most visited thumbnails can't be opened or // searched for conventionally. + case IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB: case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: case IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE: return params_.src_url.is_valid() && @@ -1400,6 +1412,13 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { GetImageThumbnailForSearch(); break; + case IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB: + OpenURLWithExtraHeaders( + params_.src_url, GetDocumentURL(params_), NEW_BACKGROUND_TAB, + ui::PAGE_TRANSITION_LINK, + data_reduction_proxy::kDataReductionPassThroughHeader); + break; + case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: case IDC_CONTENT_CONTEXT_OPENAVNEWTAB: OpenURL(params_.src_url, diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index 26a7ce8fe9b1a..7d50614d1f37f 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc @@ -4,6 +4,7 @@ #include +#include "base/command_line.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -20,6 +21,7 @@ #include "chrome/common/render_messages.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "components/data_reduction_proxy/core/common/data_reduction_proxy_switches.h" #include "components/search_engines/template_url_data.h" #include "components/search_engines/template_url_service.h" #include "content/public/browser/browser_message_filter.h" @@ -41,13 +43,17 @@ namespace { class ContextMenuBrowserTest : public InProcessBrowserTest { public: - ContextMenuBrowserTest() { } + ContextMenuBrowserTest() {} - TestRenderViewContextMenu* CreateContextMenu(GURL unfiltered_url, GURL url) { + TestRenderViewContextMenu* CreateContextMenu( + const GURL& unfiltered_url, + const GURL& url, + blink::WebContextMenuData::MediaType media_type) { content::ContextMenuParams params; - params.media_type = blink::WebContextMenuData::MediaTypeNone; + params.media_type = media_type; params.unfiltered_link_url = unfiltered_url; params.link_url = url; + params.src_url = url; WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents(); params.page_url = web_contents->GetController().GetActiveEntry()->GetURL(); @@ -62,13 +68,19 @@ class ContextMenuBrowserTest : public InProcessBrowserTest { menu->Init(); return menu; } + + TestRenderViewContextMenu* CreateContextMenuMediaTypeNone( + const GURL& unfiltered_url, + const GURL& url) { + return CreateContextMenu(unfiltered_url, url, + blink::WebContextMenuData::MediaTypeNone); + } }; IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenEntryPresentForNormalURLs) { - scoped_ptr menu( - CreateContextMenu(GURL("http://www.google.com/"), - GURL("http://www.google.com/"))); + scoped_ptr menu(CreateContextMenuMediaTypeNone( + GURL("http://www.google.com/"), GURL("http://www.google.com/"))); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); @@ -78,8 +90,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenEntryAbsentForFilteredURLs) { scoped_ptr menu( - CreateContextMenu(GURL("chrome://history"), - GURL())); + CreateContextMenuMediaTypeNone(GURL("chrome://history"), GURL())); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); @@ -298,6 +309,44 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ViewPageInfoWithNoEntry) { menu.ExecuteCommand(IDC_CONTENT_CONTEXT_VIEWPAGEINFO, 0); } +IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, DataSaverOpenOrigImageInNewTab) { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + command_line->AppendSwitch( + data_reduction_proxy::switches::kEnableDataReductionProxy); + + scoped_ptr menu( + CreateContextMenu(GURL(), GURL("http://url.com/image.png"), + blink::WebContextMenuData::MediaTypeImage)); + + ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB)); + ASSERT_TRUE(menu->IsItemPresent( + IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB)); +} + +IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, + DataSaverHttpsOpenImageInNewTab) { + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + command_line->AppendSwitch( + data_reduction_proxy::switches::kEnableDataReductionProxy); + + scoped_ptr menu( + CreateContextMenu(GURL(), GURL("https://url.com/image.png"), + blink::WebContextMenuData::MediaTypeImage)); + + ASSERT_FALSE( + menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB)); + ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB)); +} + +IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenImageInNewTab) { + scoped_ptr menu( + CreateContextMenu(GURL(), GURL("http://url.com/image.png"), + blink::WebContextMenuData::MediaTypeImage)); + ASSERT_FALSE( + menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB)); + ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB)); +} + class ThumbnailResponseWatcher : public content::NotificationObserver { public: enum QuitReason { diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc index 081c49f51c26d..534e60d547b4e 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc @@ -47,6 +47,9 @@ bool IsEnabledOnCommandLine() { namespace data_reduction_proxy { +const char kDataReductionPassThroughHeader[] = + "X-PSA-Client-Options: v=1,m=1\nCache-Control: no-cache"; + DataReductionProxySettings::DataReductionProxySettings() : unreachable_(false), allowed_(false), @@ -110,10 +113,16 @@ void DataReductionProxySettings::SetOnDataReductionEnabledCallback( on_data_reduction_proxy_enabled_.Run(IsDataReductionProxyEnabled()); } -bool DataReductionProxySettings::IsDataReductionProxyEnabled() { +bool DataReductionProxySettings::IsDataReductionProxyEnabled() const { return spdy_proxy_auth_enabled_.GetValue() || IsEnabledOnCommandLine(); } +bool DataReductionProxySettings::CanUseDataReductionProxy( + const GURL& url) const { + return url.is_valid() && url.scheme() == url::kHttpScheme && + IsDataReductionProxyEnabled(); +} + bool DataReductionProxySettings::IsDataReductionProxyAlternativeEnabled() const { return data_reduction_proxy_alternative_enabled_.GetValue(); diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h index f5b70a466c3a4..8107f0f3d057a 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h @@ -29,6 +29,11 @@ class DataReductionProxyStatisticsPrefs; // The number of days of bandwidth usage statistics that are tracked. const unsigned int kNumDaysInHistory = 60; +// The header used to request a data reduction proxy pass through. When a +// request is sent to the data reduction proxy with this header, it will respond +// with the original uncompressed response. +extern const char kDataReductionPassThroughHeader[]; + // The number of days of bandwidth usage statistics that are presented. const unsigned int kNumDaysInHistorySummary = 30; @@ -74,7 +79,17 @@ class DataReductionProxySettings { const base::Callback& on_data_reduction_proxy_enabled); // Returns true if the proxy is enabled. - bool IsDataReductionProxyEnabled(); + bool IsDataReductionProxyEnabled() const; + + // Returns true if the proxy can be used for the given url. This method does + // not take into account the proxy config or proxy retry list, so it can + // return true even when the proxy will not be used. Specifically, if + // another proxy configuration overrides use of data reduction proxy, or + // if data reduction proxy is in proxy retry list, then data reduction proxy + // will not be used, but this method will still return true. If this method + // returns false, then we are guaranteed that data reduction proxy will not be + // used. + bool CanUseDataReductionProxy(const GURL& url) const; // Returns true if the alternative proxy is enabled. bool IsDataReductionProxyAlternativeEnabled() const; @@ -186,7 +201,8 @@ class DataReductionProxySettings { FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, TestIsProxyEnabledOrManaged); FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, - TestContentLengths); + TestCanUseDataReductionProxy); + FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, TestContentLengths); FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, TestGetDailyContentLengths); FRIEND_TEST_ALL_PREFIXES(DataReductionProxySettingsTest, diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc index 93fec5885b26f..ea0f49c4383aa 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_unittest.cc @@ -71,6 +71,23 @@ TEST_F(DataReductionProxySettingsTest, TestIsProxyEnabledOrManaged) { test_context_->RunUntilIdle(); } +TEST_F(DataReductionProxySettingsTest, TestCanUseDataReductionProxy) { + settings_->InitPrefMembers(); + // The proxy is disabled initially. + test_context_->config()->SetStateForTest(false, false, false, false); + + GURL http_gurl("http://url.com/"); + EXPECT_FALSE(settings_->CanUseDataReductionProxy(http_gurl)); + + CheckOnPrefChange(true, true, false); + EXPECT_TRUE(settings_->CanUseDataReductionProxy(http_gurl)); + + GURL https_gurl("https://url.com/"); + EXPECT_FALSE(settings_->CanUseDataReductionProxy(https_gurl)); + + test_context_->RunUntilIdle(); +} + TEST_F(DataReductionProxySettingsTest, TestResetDataReductionStatistics) { int64 original_content_length; int64 received_content_length; diff --git a/components/renderer_context_menu/render_view_context_menu_base.cc b/components/renderer_context_menu/render_view_context_menu_base.cc index d6472dfb31160..80f26bc644ed9 100644 --- a/components/renderer_context_menu/render_view_context_menu_base.cc +++ b/components/renderer_context_menu/render_view_context_menu_base.cc @@ -378,6 +378,15 @@ void RenderViewContextMenuBase::OpenURL( const GURL& url, const GURL& referring_url, WindowOpenDisposition disposition, ui::PageTransition transition) { + OpenURLWithExtraHeaders(url, referring_url, disposition, transition, ""); +} + +void RenderViewContextMenuBase::OpenURLWithExtraHeaders( + const GURL& url, + const GURL& referring_url, + WindowOpenDisposition disposition, + ui::PageTransition transition, + const std::string& extra_headers) { content::Referrer referrer = content::Referrer::SanitizeForRequest( url, content::Referrer(referring_url.GetAsReferrer(), @@ -386,8 +395,11 @@ void RenderViewContextMenuBase::OpenURL( if (params_.link_url == url && disposition != OFF_THE_RECORD) params_.custom_context.link_followed = url; - WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( - url, referrer, disposition, transition, false)); + OpenURLParams open_url_params(url, referrer, disposition, transition, false); + if (!extra_headers.empty()) + open_url_params.extra_headers = extra_headers; + + WebContents* new_contents = source_web_contents_->OpenURL(open_url_params); if (!new_contents) return; diff --git a/components/renderer_context_menu/render_view_context_menu_base.h b/components/renderer_context_menu/render_view_context_menu_base.h index d6d7bbd5a5703..61dfbe4644bb2 100644 --- a/components/renderer_context_menu/render_view_context_menu_base.h +++ b/components/renderer_context_menu/render_view_context_menu_base.h @@ -161,6 +161,13 @@ class RenderViewContextMenuBase : public ui::SimpleMenuModel::Delegate, WindowOpenDisposition disposition, ui::PageTransition transition); + // Opens the specified URL string in a new tab with the extra headers. + void OpenURLWithExtraHeaders(const GURL& url, + const GURL& referrer, + WindowOpenDisposition disposition, + ui::PageTransition transition, + const std::string& extra_headers); + content::ContextMenuParams params_; content::WebContents* source_web_contents_; // In the case of a MimeHandlerView this will point to the WebContents that diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 6e8e8c5af65ff..f55dedbb336e4 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -57105,6 +57105,7 @@ To add a new entry, add it with any value and run test to compute valid value. + From 9702576c4d4979e73cf6f921725ddd0ccb0e2752 Mon Sep 17 00:00:00 2001 From: Thiemo Nagel Date: Tue, 24 Feb 2015 22:21:44 +0100 Subject: [PATCH 017/260] Work around bug in generate_policy_source.py to fix several policies. R=rogerta@chromium.org TBR=tnagel NOTREECHECKS=true BUG=451073 Review URL: https://codereview.chromium.org/949173004 Cr-Commit-Position: refs/branch-heads/2311@{#17} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- .../policy/resources/policy_templates.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index 9f18e244d5aeb..e2b6de8c85677 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json @@ -1195,7 +1195,7 @@ 'name': 'EnableDeprecatedWebBasedSignin', 'type': 'main', 'schema': { 'type': 'boolean' }, - 'supported_on': ['chrome.*:35-42'], + 'supported_on': ['chrome.*:35-'], 'features': { 'dynamic_refresh': False, 'per_profile': False, @@ -7074,10 +7074,10 @@ }, ], 'supported_on': [ - 'chrome.*:39-43', - 'chrome_os:39-43', - 'android:39-43', - 'ios:39-43', + 'chrome.*:39-', + 'chrome_os:39-', + 'android:39-', + 'ios:39-', ], 'features': { 'dynamic_refresh': True, @@ -7129,10 +7129,10 @@ }, ], 'supported_on': [ - 'chrome.*:39-43', - 'chrome_os:39-43', - 'android:39-43', - 'ios:39-43', + 'chrome.*:39-', + 'chrome_os:39-', + 'android:39-', + 'ios:39-', ], 'features': { 'dynamic_refresh': True, From 4bda951ed28b1e47ae0de179bbc03aad62b92b99 Mon Sep 17 00:00:00 2001 From: Yoyo Zhou Date: Tue, 24 Feb 2015 13:40:56 -0800 Subject: [PATCH 018/260] Merge 317853 - Make BackgroundContentsService start up BackgroundContents with a delay, as for ExtensionHosts. extensions::ProcessManager starts ExtensionHosts asynchronously with a queue to avoid using too much resources at startup; make BackgroundContentsService use the same queue implementation. (ExtensionHostQueue now accepts an interface that both BackgroundContentsService and ExtensionHost share.) This significantly reduces the time BackgroundContentsService contributes to ExtensionService startup (75th percentile was ~300ms, according to Extensions.BackgroundContentsServiceStartupTime). BUG=47236 Review URL: https://codereview.chromium.org/933423003 Cr-Commit-Position: refs/heads/master@{#317480} (cherry picked from commit d61dfe19ab3188101e511f633eeaaef3dc689e41) Review URL: https://codereview.chromium.org/955713004 Cr-Commit-Position: refs/branch-heads/2311@{#18} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- .../browser/background/background_contents.cc | 20 +++++++++++++- .../browser/background/background_contents.h | 21 ++++++++++++++- .../background/background_contents_service.cc | 5 +--- .../chrome_extension_host_delegate.cc | 9 +++++++ .../chrome_extension_host_delegate.h | 1 + .../browser/deferred_start_render_host.h | 27 +++++++++++++++++++ extensions/browser/extension_host.cc | 17 ++---------- extensions/browser/extension_host.h | 17 ++++++------ extensions/browser/extension_host_delegate.h | 5 ++++ extensions/browser/extension_host_queue.h | 6 ++--- .../browser/serial_extension_host_queue.cc | 8 +++--- .../browser/serial_extension_host_queue.h | 21 ++++++++------- extensions/extensions.gypi | 1 + .../browser/shell_extension_host_delegate.cc | 9 +++++++ .../browser/shell_extension_host_delegate.h | 1 + 15 files changed, 122 insertions(+), 46 deletions(-) create mode 100644 extensions/browser/deferred_start_render_host.h diff --git a/chrome/browser/background/background_contents.cc b/chrome/browser/background/background_contents.cc index 7a1150b347a98..bf94280656bfb 100644 --- a/chrome/browser/background/background_contents.cc +++ b/chrome/browser/background/background_contents.cc @@ -16,6 +16,9 @@ #include "content/public/browser/session_storage_namespace.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" +#include "extensions/browser/extension_host_delegate.h" +#include "extensions/browser/extension_host_queue.h" +#include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/view_type_utils.h" #include "ui/gfx/geometry/rect.h" @@ -29,7 +32,9 @@ BackgroundContents::BackgroundContents( Delegate* delegate, const std::string& partition_id, content::SessionStorageNamespace* session_storage_namespace) - : delegate_(delegate) { + : delegate_(delegate), + extension_host_delegate_(extensions::ExtensionsBrowserClient::Get() + ->CreateExtensionHostDelegate()) { profile_ = Profile::FromBrowserContext( site_instance->GetBrowserContext()); @@ -82,12 +87,19 @@ BackgroundContents::~BackgroundContents() { chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, content::Source(profile_), content::Details(this)); + + extension_host_delegate_->GetExtensionHostQueue()->Remove(this); } const GURL& BackgroundContents::GetURL() const { return web_contents_.get() ? web_contents_->GetURL() : GURL::EmptyGURL(); } +void BackgroundContents::CreateRenderViewSoon(const GURL& url) { + initial_url_ = url; + extension_host_delegate_->GetExtensionHostQueue()->Add(this); +} + void BackgroundContents::CloseContents(WebContents* source) { content::NotificationService::current()->Notify( chrome::NOTIFICATION_BACKGROUND_CONTENTS_CLOSED, @@ -160,3 +172,9 @@ void BackgroundContents::Observe(int type, break; } } + +void BackgroundContents::CreateRenderViewNow() { + web_contents()->GetController().LoadURL(initial_url_, content::Referrer(), + ui::PAGE_TRANSITION_LINK, + std::string()); +} diff --git a/chrome/browser/background/background_contents.h b/chrome/browser/background/background_contents.h index e7345e344c7c6..b4a94c4f55819 100644 --- a/chrome/browser/background/background_contents.h +++ b/chrome/browser/background/background_contents.h @@ -12,7 +12,9 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" +#include "extensions/browser/deferred_start_render_host.h" #include "ui/base/window_open_disposition.h" +#include "url/gurl.h" class Profile; @@ -21,10 +23,15 @@ class SessionStorageNamespace; class SiteInstance; }; +namespace extensions { +class ExtensionHostDelegate; +} + // This class maintains a WebContents used in the background. It can host a // renderer, but does not have any visible display. // TODO(atwilson): Unify this with background pages; http://crbug.com/77790 -class BackgroundContents : public content::WebContentsDelegate, +class BackgroundContents : public extensions::DeferredStartRenderHost, + public content::WebContentsDelegate, public content::WebContentsObserver, public content::NotificationObserver { public: @@ -56,6 +63,9 @@ class BackgroundContents : public content::WebContentsDelegate, content::WebContents* web_contents() const { return web_contents_.get(); } virtual const GURL& GetURL() const; + // Adds this BackgroundContents to the queue of RenderViews to create. + void CreateRenderViewSoon(const GURL& url); + // content::WebContentsDelegate implementation: void CloseContents(content::WebContents* source) override; bool ShouldSuppressDialogs(content::WebContents* source) override; @@ -81,13 +91,22 @@ class BackgroundContents : public content::WebContentsDelegate, BackgroundContents(); private: + // DeferredStartRenderHost implementation: + void CreateRenderViewNow() override; + // The delegate for this BackgroundContents. Delegate* delegate_; + // Delegate for choosing an ExtensionHostQueue. + scoped_ptr extension_host_delegate_; + Profile* profile_; scoped_ptr web_contents_; content::NotificationRegistrar registrar_; + // The initial URL to load. + GURL initial_url_; + DISALLOW_COPY_AND_ASSIGN(BackgroundContents); }; diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index 34f8446b24925..9cb64478d5850 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc @@ -634,10 +634,7 @@ void BackgroundContentsService::LoadBackgroundContents( std::string(), NULL); - // TODO(atwilson): Create RenderViews asynchronously to avoid increasing - // startup latency (http://crbug.com/47236). - contents->web_contents()->GetController().LoadURL( - url, content::Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); + contents->CreateRenderViewSoon(url); } BackgroundContents* BackgroundContentsService::CreateBackgroundContents( diff --git a/chrome/browser/extensions/chrome_extension_host_delegate.cc b/chrome/browser/extensions/chrome_extension_host_delegate.cc index 8cb4ec64e5bd6..6a1af5e4da65c 100644 --- a/chrome/browser/extensions/chrome_extension_host_delegate.cc +++ b/chrome/browser/extensions/chrome_extension_host_delegate.cc @@ -4,6 +4,7 @@ #include "chrome/browser/extensions/chrome_extension_host_delegate.h" +#include "base/lazy_instance.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_tab_util.h" @@ -12,6 +13,7 @@ #include "components/app_modal/javascript_dialog_manager.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_system.h" +#include "extensions/browser/serial_extension_host_queue.h" namespace extensions { @@ -66,4 +68,11 @@ bool ChromeExtensionHostDelegate::CheckMediaAccessPermission( web_contents, security_origin, type, extension); } +static base::LazyInstance g_queue = + LAZY_INSTANCE_INITIALIZER; + +ExtensionHostQueue* ChromeExtensionHostDelegate::GetExtensionHostQueue() const { + return g_queue.Pointer(); +} + } // namespace extensions diff --git a/chrome/browser/extensions/chrome_extension_host_delegate.h b/chrome/browser/extensions/chrome_extension_host_delegate.h index 0ba69555e7585..c34b0d828da43 100644 --- a/chrome/browser/extensions/chrome_extension_host_delegate.h +++ b/chrome/browser/extensions/chrome_extension_host_delegate.h @@ -32,6 +32,7 @@ class ChromeExtensionHostDelegate : public ExtensionHostDelegate { const GURL& security_origin, content::MediaStreamType type, const Extension* extension) override; + ExtensionHostQueue* GetExtensionHostQueue() const override; }; } // namespace extensions diff --git a/extensions/browser/deferred_start_render_host.h b/extensions/browser/deferred_start_render_host.h new file mode 100644 index 0000000000000..f6810c635a8e1 --- /dev/null +++ b/extensions/browser/deferred_start_render_host.h @@ -0,0 +1,27 @@ +// Copyright 2015 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 EXTENSIONS_BROWSER_DEFERRED_START_RENDER_HOST_H_ +#define EXTENSIONS_BROWSER_DEFERRED_START_RENDER_HOST_H_ + +namespace extensions { + +// A browser component that tracks a renderer. It allows for its renderer +// startup to be deferred, to throttle resource usage upon profile startup. +// To be used with ExtensionHostQueue. +// +// Note that if BackgroundContents and ExtensionHost are unified +// (crbug.com/77790), this interface will be no longer needed. +class DeferredStartRenderHost { + public: + virtual ~DeferredStartRenderHost() {} + + // DO NOT CALL THIS unless you're implementing an ExtensionHostQueue. + // Called by the ExtensionHostQueue to create the RenderView. + virtual void CreateRenderViewNow() = 0; +}; + +} // namespace extensions + +#endif // EXTENSIONS_BROWSER_DEFERRED_START_RENDER_HOST_H_ diff --git a/extensions/browser/extension_host.cc b/extensions/browser/extension_host.cc index 84b95313ab9a3..3d18bf9677db0 100644 --- a/extensions/browser/extension_host.cc +++ b/extensions/browser/extension_host.cc @@ -4,7 +4,6 @@ #include "extensions/browser/extension_host.h" -#include "base/lazy_instance.h" #include "base/logging.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" @@ -31,7 +30,6 @@ #include "extensions/browser/notification_types.h" #include "extensions/browser/process_manager.h" #include "extensions/browser/runtime_data.h" -#include "extensions/browser/serial_extension_host_queue.h" #include "extensions/browser/view_type_utils.h" #include "extensions/common/extension.h" #include "extensions/common/extension_messages.h" @@ -50,17 +48,6 @@ using content::WebContents; namespace extensions { -namespace { - -// Singleton which wraps our current ExtensionHostQueue implementation. -struct QueueWrapper { - QueueWrapper() : queue(new SerialExtensionHostQueue()) {} - scoped_ptr queue; -}; -base::LazyInstance g_queue_wrapper = LAZY_INSTANCE_INITIALIZER; - -} // namespace - ExtensionHost::ExtensionHost(const Extension* extension, SiteInstance* site_instance, const GURL& url, @@ -110,7 +97,7 @@ ExtensionHost::~ExtensionHost() { content::Details(this)); FOR_EACH_OBSERVER(ExtensionHostObserver, observer_list_, OnExtensionHostDestroyed(this)); - g_queue_wrapper.Get().queue->Remove(this); + delegate_->GetExtensionHostQueue()->Remove(this); // Immediately stop observing |host_contents_| because its destruction events // (like DidStopLoading, it turns out) can call back into ExtensionHost // re-entrantly, when anything declared after |host_contents_| has already @@ -138,7 +125,7 @@ void ExtensionHost::CreateRenderViewSoon() { // to defer. CreateRenderViewNow(); } else { - g_queue_wrapper.Get().queue->Add(this); + delegate_->GetExtensionHostQueue()->Add(this); } } diff --git a/extensions/browser/extension_host.h b/extensions/browser/extension_host.h index d7803cf9ec0a9..76daa00c4dc52 100644 --- a/extensions/browser/extension_host.h +++ b/extensions/browser/extension_host.h @@ -17,6 +17,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" +#include "extensions/browser/deferred_start_render_host.h" #include "extensions/browser/extension_function_dispatcher.h" #include "extensions/common/stack_frame.h" #include "extensions/common/view_type.h" @@ -44,7 +45,8 @@ class WindowController; // // If you are adding code that only affects visible extension views (and not // invisible background pages) you should add it to ExtensionViewHost. -class ExtensionHost : public content::WebContentsDelegate, +class ExtensionHost : public DeferredStartRenderHost, + public content::WebContentsDelegate, public content::WebContentsObserver, public ExtensionFunctionDispatcher::Delegate, public content::NotificationObserver { @@ -77,10 +79,6 @@ class ExtensionHost : public content::WebContentsDelegate, // (can be NULL). This happens delayed to avoid locking the UI. void CreateRenderViewSoon(); - // DO NOT CALL THIS. Always use CreateRenderViewSoon(). - // (Unless you're implementing an ExtensionHostQueue). - void CreateRenderViewNow(); - // Closes this host (results in [possibly asynchronous] deletion). void Close(); @@ -100,7 +98,7 @@ class ExtensionHost : public content::WebContentsDelegate, // finished. void OnNetworkRequestDone(uint64 request_id); - // content::WebContentsObserver + // content::WebContentsObserver: bool OnMessageReceived(const IPC::Message& message) override; void RenderViewCreated(content::RenderViewHost* render_view_host) override; void RenderViewDeleted(content::RenderViewHost* render_view_host) override; @@ -109,7 +107,7 @@ class ExtensionHost : public content::WebContentsDelegate, void DocumentAvailableInMainFrame() override; void DidStopLoading(content::RenderViewHost* render_view_host) override; - // content::WebContentsDelegate + // content::WebContentsDelegate: content::JavaScriptDialogManager* GetJavaScriptDialogManager( content::WebContents* source) override; void AddNewContents(content::WebContents* source, @@ -128,7 +126,7 @@ class ExtensionHost : public content::WebContentsDelegate, content::MediaStreamType type) override; bool IsNeverVisible(content::WebContents* web_contents) override; - // content::NotificationObserver + // content::NotificationObserver: void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) override; @@ -147,6 +145,9 @@ class ExtensionHost : public content::WebContentsDelegate, virtual bool IsBackgroundPage() const; private: + // DeferredStartRenderHost: + void CreateRenderViewNow() override; + // Message handlers. void OnRequest(const ExtensionHostMsg_Request_Params& params); void OnEventAck(int message_id); diff --git a/extensions/browser/extension_host_delegate.h b/extensions/browser/extension_host_delegate.h index 71c0990dc83e8..86726ff0dc84e 100644 --- a/extensions/browser/extension_host_delegate.h +++ b/extensions/browser/extension_host_delegate.h @@ -22,6 +22,7 @@ class Rect; namespace extensions { class Extension; class ExtensionHost; +class ExtensionHostQueue; // A delegate to support functionality that cannot exist in the extensions // module. This is not an inner class of ExtensionHost to allow it to be forward @@ -64,6 +65,10 @@ class ExtensionHostDelegate { const GURL& security_origin, content::MediaStreamType type, const Extension* extension) = 0; + + // Returns the ExtensionHostQueue implementation to use for creating + // ExtensionHost renderers. + virtual ExtensionHostQueue* GetExtensionHostQueue() const = 0; }; } // namespace extensions diff --git a/extensions/browser/extension_host_queue.h b/extensions/browser/extension_host_queue.h index 4c9cb5bfa0004..420800bf24078 100644 --- a/extensions/browser/extension_host_queue.h +++ b/extensions/browser/extension_host_queue.h @@ -7,7 +7,7 @@ namespace extensions { -class ExtensionHost; +class DeferredStartRenderHost; // An interface for a queue of ExtensionHosts waiting for initialization. // This is used to implement different throttling strategies. @@ -16,11 +16,11 @@ class ExtensionHostQueue { virtual ~ExtensionHostQueue() {} // Adds a host to the queue for RenderView creation. - virtual void Add(ExtensionHost* host) = 0; + virtual void Add(DeferredStartRenderHost* host) = 0; // Removes a host from the queue (for example, it may be deleted before // having a chance to start). - virtual void Remove(ExtensionHost* host) = 0; + virtual void Remove(DeferredStartRenderHost* host) = 0; }; } // namespace extensions diff --git a/extensions/browser/serial_extension_host_queue.cc b/extensions/browser/serial_extension_host_queue.cc index 7c8df68b93835..7986523c69d6d 100644 --- a/extensions/browser/serial_extension_host_queue.cc +++ b/extensions/browser/serial_extension_host_queue.cc @@ -6,7 +6,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" -#include "extensions/browser/extension_host.h" +#include "extensions/browser/deferred_start_render_host.h" namespace extensions { @@ -17,13 +17,13 @@ SerialExtensionHostQueue::SerialExtensionHostQueue() SerialExtensionHostQueue::~SerialExtensionHostQueue() { } -void SerialExtensionHostQueue::Add(ExtensionHost* host) { +void SerialExtensionHostQueue::Add(DeferredStartRenderHost* host) { queue_.push_back(host); PostTask(); } -void SerialExtensionHostQueue::Remove(ExtensionHost* host) { - std::list::iterator it = +void SerialExtensionHostQueue::Remove(DeferredStartRenderHost* host) { + std::list::iterator it = std::find(queue_.begin(), queue_.end(), host); if (it != queue_.end()) queue_.erase(it); diff --git a/extensions/browser/serial_extension_host_queue.h b/extensions/browser/serial_extension_host_queue.h index 794ff6061f50f..40d11edd22274 100644 --- a/extensions/browser/serial_extension_host_queue.h +++ b/extensions/browser/serial_extension_host_queue.h @@ -13,11 +13,11 @@ namespace extensions { -class ExtensionHost; +class DeferredStartRenderHost; -// An ExtensionHostQueue which initializes ExtensionHosts in the order they're -// Add()ed, with simple rate limiting logic that re-posts each task to the UI -// thread, to avoid clogging it for a long period of time. +// An ExtensionHostQueue which initializes DeferredStartRenderHosts in the order +// they're Add()ed, with simple rate limiting logic that re-posts each task to +// the UI thread, to avoid clogging it for a long period of time. class SerialExtensionHostQueue : public ExtensionHostQueue { public: SerialExtensionHostQueue(); @@ -25,21 +25,22 @@ class SerialExtensionHostQueue : public ExtensionHostQueue { private: // ExtensionHostQueue: - void Add(ExtensionHost* host) override; - void Remove(ExtensionHost* host) override; + void Add(DeferredStartRenderHost* host) override; + void Remove(DeferredStartRenderHost* host) override; - // Queues up a delayed task to process the next ExtensionHost in the queue. + // Queues up a delayed task to process the next DeferredStartRenderHost in + // the queue. void PostTask(); // Creates the RenderView for the next host in the queue. void ProcessOneHost(); // True if this queue is currently in the process of starting an - // ExtensionHost. + // DeferredStartRenderHost. bool pending_create_; - // The list of ExtensionHosts waiting to be started. - std::list queue_; + // The list of DeferredStartRenderHosts waiting to be started. + std::list queue_; base::WeakPtrFactory ptr_factory_; diff --git a/extensions/extensions.gypi b/extensions/extensions.gypi index d65c78f82ccd7..4a4515dca6e6b 100644 --- a/extensions/extensions.gypi +++ b/extensions/extensions.gypi @@ -540,6 +540,7 @@ 'browser/content_verify_job.h', 'browser/crx_file_info.cc', 'browser/crx_file_info.h', + 'browser/deferred_start_render_host.h', 'browser/error_map.cc', 'browser/error_map.h', 'browser/event_listener_map.cc', diff --git a/extensions/shell/browser/shell_extension_host_delegate.cc b/extensions/shell/browser/shell_extension_host_delegate.cc index d06363e31b83d..51c73341abfaf 100644 --- a/extensions/shell/browser/shell_extension_host_delegate.cc +++ b/extensions/shell/browser/shell_extension_host_delegate.cc @@ -4,7 +4,9 @@ #include "extensions/shell/browser/shell_extension_host_delegate.h" +#include "base/lazy_instance.h" #include "base/logging.h" +#include "extensions/browser/serial_extension_host_queue.h" #include "extensions/shell/browser/media_capture_util.h" #include "extensions/shell/browser/shell_extension_web_contents_observer.h" @@ -61,4 +63,11 @@ bool ShellExtensionHostDelegate::CheckMediaAccessPermission( return true; } +static base::LazyInstance g_queue = + LAZY_INSTANCE_INITIALIZER; + +ExtensionHostQueue* ShellExtensionHostDelegate::GetExtensionHostQueue() const { + return g_queue.Pointer(); +} + } // namespace extensions diff --git a/extensions/shell/browser/shell_extension_host_delegate.h b/extensions/shell/browser/shell_extension_host_delegate.h index ba2a3648aad87..d91b407e381e7 100644 --- a/extensions/shell/browser/shell_extension_host_delegate.h +++ b/extensions/shell/browser/shell_extension_host_delegate.h @@ -33,6 +33,7 @@ class ShellExtensionHostDelegate : public ExtensionHostDelegate { const GURL& security_origin, content::MediaStreamType type, const Extension* extension) override; + ExtensionHostQueue* GetExtensionHostQueue() const override; private: DISALLOW_COPY_AND_ASSIGN(ShellExtensionHostDelegate); From bec75be50521294c08526fad5524ca08687a8c26 Mon Sep 17 00:00:00 2001 From: Ted Choc Date: Tue, 24 Feb 2015 13:57:14 -0800 Subject: [PATCH 019/260] Disable alpha, translate animations in the app menu for ICS. The performance is horrendous, so let's disable the animations for each of the menu items for now as it looks 90% as good as a well performing animation on newer builds of android. BUG=428477 Review URL: https://codereview.chromium.org/948183003 Cr-Commit-Position: refs/heads/master@{#317692} Review URL: https://codereview.chromium.org/927103003 Cr-Commit-Position: refs/branch-heads/2311@{#19} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- .../java/src/org/chromium/chrome/browser/appmenu/AppMenu.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java index e4aa4b7417ea1..c8976b36c98ee 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java @@ -10,6 +10,7 @@ import android.content.res.Resources; import android.graphics.Rect; import android.graphics.drawable.Drawable; +import android.os.Build; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; @@ -171,7 +172,8 @@ public void onDismiss() { } // Don't animate the menu items for low end devices. - if (!SysUtils.isLowEndDevice()) { + if (!SysUtils.isLowEndDevice() + && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { mPopup.getListView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right, int bottom, From 33b73a4d03b2ab47476da91b206a66a64faf7fbc Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Tue, 24 Feb 2015 14:23:36 -0800 Subject: [PATCH 020/260] Disable the autofill/wallet settings in chrome://settings/autofill Will merge this to M42, then revert on trunk. BUG=460900 Review URL: https://codereview.chromium.org/949753006 Cr-Commit-Position: refs/heads/master@{#317638} (cherry picked from commit 0d59aeae3e815c53b10fb0ffc1199be524c62f86) Review URL: https://codereview.chromium.org/948343005 Cr-Commit-Position: refs/branch-heads/2311@{#20} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- chrome/browser/ui/webui/options/autofill_options_handler.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/chrome/browser/ui/webui/options/autofill_options_handler.cc b/chrome/browser/ui/webui/options/autofill_options_handler.cc index 374337baf846d..4bda089d4fddf 100644 --- a/chrome/browser/ui/webui/options/autofill_options_handler.cc +++ b/chrome/browser/ui/webui/options/autofill_options_handler.cc @@ -340,8 +340,7 @@ void AutofillOptionsHandler::GetLocalizedValues( SetCreditCardOverlayStrings(localized_strings); localized_strings->SetBoolean( - "enableAutofillWalletIntegration", - personal_data_->IsExperimentalWalletIntegrationEnabled()); + "enableAutofillWalletIntegration", false); localized_strings->SetString( "manageWalletAddressesUrl", autofill::wallet::GetManageAddressesUrl(0).spec()); From f5e34b374e2e07c844fe3607746ef16b8340d2f3 Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Tue, 24 Feb 2015 14:31:52 -0800 Subject: [PATCH 021/260] Hide Autofill/Wallet preferences on Android. Simply hide the Autofill/Wallet preferences. The correct fix will involve checking the state of the sync experiment, but for M42 it's enough to just disable this preference page. Will require merge to m42. BUG=460900 R=aurimas@chromium.org Review URL: https://codereview.chromium.org/947253002 Cr-Commit-Position: refs/heads/master@{#317699} (cherry picked from commit 652772cfbf2ccf99d63b13f606cbaed035efdf88) Review URL: https://codereview.chromium.org/947333003 Cr-Commit-Position: refs/branch-heads/2311@{#21} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- .../autofill/android/personal_data_manager_android.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/chrome/browser/autofill/android/personal_data_manager_android.cc b/chrome/browser/autofill/android/personal_data_manager_android.cc index d942bd1b6d3f1..9059f5db2b82c 100644 --- a/chrome/browser/autofill/android/personal_data_manager_android.cc +++ b/chrome/browser/autofill/android/personal_data_manager_android.cc @@ -342,10 +342,7 @@ static jboolean IsAutofillManaged(JNIEnv* env, jclass clazz) { // Returns whether the Wallet import feature is available. static jboolean IsWalletImportFeatureAvailable(JNIEnv* env, jclass clazz) { - // TODO(estade): what to do in the IsManaged case? - ProfileSyncService* service = - ProfileSyncServiceFactory::GetInstance()->GetForProfile(GetProfile()); - return service->IsSyncEnabledAndLoggedIn(); + return false; } // Returns whether the Wallet import feature is enabled. From 30b5caca59ff8a0c7378f9a7b6a753cc4c38a643 Mon Sep 17 00:00:00 2001 From: Lambros Lambrou Date: Tue, 24 Feb 2015 15:37:54 -0800 Subject: [PATCH 022/260] Android Chromoting: Remove title and add navigation button to disconnect BUG=430328 Review URL: https://codereview.chromium.org/943103002 Cr-Commit-Position: refs/heads/master@{#317489} (cherry picked from commit 01f8886bebfb9eab8dfb370db065a81a613feee1) Review URL: https://codereview.chromium.org/955843002 Cr-Commit-Position: refs/branch-heads/2311@{#22} Cr-Branched-From: 09b7de5dd7254947cd4306de907274fa63373d48-refs/heads/master@{#317474} --- remoting/android/java/AndroidManifest.xml.jinja2 | 1 + remoting/android/java/res/values-v17/styles.xml | 7 +++++++ .../android/java/src/org/chromium/chromoting/Desktop.java | 8 ++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/remoting/android/java/AndroidManifest.xml.jinja2 b/remoting/android/java/AndroidManifest.xml.jinja2 index 15e05c6ab4fc1..1b3209b779842 100644 --- a/remoting/android/java/AndroidManifest.xml.jinja2 +++ b/remoting/android/java/AndroidManifest.xml.jinja2 @@ -37,6 +37,7 @@ false true + + +