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

Side by Side Diff: content/browser/renderer_host/delegated_frame_host.cc

Issue 1690013002: Remove --tab-capture-upscale/downscale-quality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address piman's comments. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/delegated_frame_host.h" 5 #include "content/browser/renderer_host/delegated_frame_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 DCHECK(texture_mailbox.IsTexture()); 677 DCHECK(texture_mailbox.IsTexture());
678 678
679 gfx::Rect result_rect(result->size()); 679 gfx::Rect result_rect(result->size());
680 680
681 content::ReadbackYUVInterface* yuv_readback_pipeline = 681 content::ReadbackYUVInterface* yuv_readback_pipeline =
682 dfh->yuv_readback_pipeline_.get(); 682 dfh->yuv_readback_pipeline_.get();
683 if (yuv_readback_pipeline == NULL || 683 if (yuv_readback_pipeline == NULL ||
684 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || 684 yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() ||
685 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || 685 yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect ||
686 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { 686 yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) {
687 GLHelper::ScalerQuality quality = GLHelper::SCALER_QUALITY_FAST; 687 // The scaler chosen here is based on performance measurements of full
688 std::string quality_switch = switches::kTabCaptureDownscaleQuality; 688 // end-to-end systems. When down-scaling, always use the "fast" scaler
689 // If we're scaling up, we can use the "best" quality. 689 // because it performs well on both low- and high- end machines, provides
690 if (result_rect.size().width() < region_in_frame.size().width() && 690 // decent image quality, and doesn't overwhelm downstream video encoders
691 result_rect.size().height() < region_in_frame.size().height()) 691 // with too much entropy (which can drastically increase CPU utilization).
692 quality_switch = switches::kTabCaptureUpscaleQuality; 692 // When up-scaling, always use "best" because the quality improvement is
693 693 // huge with insignificant performance penalty. Note that this strategy
694 std::string switch_value = 694 // differs from single-frame snapshot capture.
695 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 695 GLHelper::ScalerQuality quality =
696 quality_switch); 696 ((result_rect.size().width() < region_in_frame.size().width()) &&
697 if (switch_value == "fast") 697 (result_rect.size().height() < region_in_frame.size().height()))
698 quality = GLHelper::SCALER_QUALITY_FAST; 698 ? GLHelper::SCALER_QUALITY_BEST
699 else if (switch_value == "good") 699 : GLHelper::SCALER_QUALITY_FAST;
700 quality = GLHelper::SCALER_QUALITY_GOOD;
701 else if (switch_value == "best")
702 quality = GLHelper::SCALER_QUALITY_BEST;
703 700
704 dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV( 701 dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV(
705 quality, result_rect.size(), result_rect, region_in_frame.size(), true, 702 quality, result_rect.size(), result_rect, region_in_frame.size(), true,
706 true)); 703 true));
707 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); 704 yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get();
708 } 705 }
709 706
710 ignore_result(scoped_callback_runner.Release()); 707 ignore_result(scoped_callback_runner.Release());
711 ignore_result(scoped_return_subscriber_texture.Release()); 708 ignore_result(scoped_return_subscriber_texture.Release());
712 709
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 872 cc::SurfaceManager* manager = factory->GetSurfaceManager();
876 new_layer->SetShowSurface( 873 new_layer->SetShowSurface(
877 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)), 874 surface_id_, base::Bind(&SatisfyCallback, base::Unretained(manager)),
878 base::Bind(&RequireCallback, base::Unretained(manager)), 875 base::Bind(&RequireCallback, base::Unretained(manager)),
879 current_surface_size_, current_scale_factor_, 876 current_surface_size_, current_scale_factor_,
880 current_frame_size_in_dip_); 877 current_frame_size_in_dip_);
881 } 878 }
882 } 879 }
883 880
884 } // namespace content 881 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tab_capture/tab_capture_performancetest.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698