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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 2321883002: cc: Remove SetMemoryPolicy from OutputSurface and Display. (Closed)
Patch Set: setmemorypolicy Created 4 years, 3 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer/gpu/render_widget_compositor.h" 5 #include "content/renderer/gpu/render_widget_compositor.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 491
492 if (cmd.HasSwitch(cc::switches::kEnableTileCompression)) { 492 if (cmd.HasSwitch(cc::switches::kEnableTileCompression)) {
493 settings.renderer_settings.preferred_tile_format = cc::ETC1; 493 settings.renderer_settings.preferred_tile_format = cc::ETC1;
494 } 494 }
495 495
496 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB 496 settings.max_staging_buffer_usage_in_bytes = 32 * 1024 * 1024; // 32MB
497 // Use 1/4th of staging buffers on low-end devices. 497 // Use 1/4th of staging buffers on low-end devices.
498 if (base::SysInfo::IsLowEndDevice()) 498 if (base::SysInfo::IsLowEndDevice())
499 settings.max_staging_buffer_usage_in_bytes /= 4; 499 settings.max_staging_buffer_usage_in_bytes /= 4;
500 500
501 cc::ManagedMemoryPolicy current = settings.memory_policy_; 501 cc::ManagedMemoryPolicy defaults = settings.gpu_memory_policy;
502 settings.memory_policy_ = GetGpuMemoryPolicy(current); 502 settings.gpu_memory_policy = GetGpuMemoryPolicy(defaults);
503
504 // These limits inherited from CompositorOutputSurface without
enne (OOO) 2016/09/09 22:46:16 Similarly, I don't think this comment adds anythin
danakj 2016/09/09 22:55:43 Oh, ya I got halfway on that, it was my intent. In
505 // explanation.
506 settings.software_memory_policy = cc::ManagedMemoryPolicy(
507 128 * 1024 * 1024, gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE,
508 base::SharedMemory::GetHandleLimit() / 3);
503 509
504 settings.use_cached_picture_raster = 510 settings.use_cached_picture_raster =
505 !cmd.HasSwitch(cc::switches::kDisableCachedPictureRaster); 511 !cmd.HasSwitch(cc::switches::kDisableCachedPictureRaster);
506 512
507 return settings; 513 return settings;
508 } 514 }
509 515
510 // static 516 // static
511 cc::ManagedMemoryPolicy RenderWidgetCompositor::GetGpuMemoryPolicy( 517 cc::ManagedMemoryPolicy RenderWidgetCompositor::GetGpuMemoryPolicy(
512 const cc::ManagedMemoryPolicy& policy) { 518 const cc::ManagedMemoryPolicy& default_policy) {
513 cc::ManagedMemoryPolicy actual = policy; 519 cc::ManagedMemoryPolicy actual = default_policy;
514 actual.bytes_limit_when_visible = 0; 520 actual.bytes_limit_when_visible = 0;
515 521
516 // If the value was overridden on the command line, use the specified value. 522 // If the value was overridden on the command line, use the specified value.
517 static bool client_hard_limit_bytes_overridden = 523 static bool client_hard_limit_bytes_overridden =
518 base::CommandLine::ForCurrentProcess()->HasSwitch( 524 base::CommandLine::ForCurrentProcess()->HasSwitch(
519 switches::kForceGpuMemAvailableMb); 525 switches::kForceGpuMemAvailableMb);
520 if (client_hard_limit_bytes_overridden) { 526 if (client_hard_limit_bytes_overridden) {
521 if (base::StringToSizeT( 527 if (base::StringToSizeT(
522 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 528 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
523 switches::kForceGpuMemAvailableMb), 529 switches::kForceGpuMemAvailableMb),
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 1147
1142 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); 1148 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized));
1143 } 1149 }
1144 1150
1145 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( 1151 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor(
1146 float device_scale) { 1152 float device_scale) {
1147 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); 1153 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale);
1148 } 1154 }
1149 1155
1150 } // namespace content 1156 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698