| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/feature/compositor/blimp_layer_tree_settings.h" | 5 #include "blimp/client/support/compositor/blimp_layer_tree_settings.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
| 12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 13 #include "cc/base/switches.h" | 13 #include "cc/base/switches.h" |
| 14 #include "cc/trees/layer_tree_settings.h" | 14 #include "cc/trees/layer_tree_settings.h" |
| 15 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // source here. | 86 // source here. |
| 87 // settings->use_external_begin_frame_source = true; | 87 // settings->use_external_begin_frame_source = true; |
| 88 | 88 |
| 89 #elif !defined(OS_MACOSX) | 89 #elif !defined(OS_MACOSX) |
| 90 settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 90 settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
| 91 settings->solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 91 settings->solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
| 92 settings->scrollbar_fade_delay_ms = 500; | 92 settings->scrollbar_fade_delay_ms = 500; |
| 93 settings->scrollbar_fade_resize_delay_ms = 500; | 93 settings->scrollbar_fade_resize_delay_ms = 500; |
| 94 settings->scrollbar_fade_duration_ms = 300; | 94 settings->scrollbar_fade_duration_ms = 300; |
| 95 | 95 |
| 96 // When pinching in, only show the pinch-viewport overlay scrollbars if the | 96 // When pinching in, only show the pinch-viewport overlay scrollbars if the |
| 97 // page scale is at least some threshold away from the minimum. i.e. don't | 97 // page scale is at least some threshold away from the minimum. i.e. don't |
| 98 // show the pinch scrollbars when at minimum scale. | 98 // show the pinch scrollbars when at minimum scale. |
| 99 // TODO(dtrainor): Update this since https://crrev.com/1267603004 landed. | 99 // TODO(dtrainor): Update this since https://crrev.com/1267603004 landed. |
| 100 // settings->scrollbar_show_scale_threshold = 1.05f; | 100 // settings->scrollbar_show_scale_threshold = 1.05f; |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 // Set the GpuMemoryPolicy. | 103 // Set the GpuMemoryPolicy. |
| 104 cc::ManagedMemoryPolicy memory_policy = settings->memory_policy_; | 104 cc::ManagedMemoryPolicy memory_policy = settings->memory_policy_; |
| 105 memory_policy.bytes_limit_when_visible = 0; | 105 memory_policy.bytes_limit_when_visible = 0; |
| 106 | 106 |
| 107 #if defined(OS_ANDROID) | 107 #if defined(OS_ANDROID) |
| 108 // We can't query available GPU memory from the system on Android. | 108 // We can't query available GPU memory from the system on Android. |
| 109 // Physical memory is also mis-reported sometimes (eg. Nexus 10 reports | 109 // Physical memory is also mis-reported sometimes (eg. Nexus 10 reports |
| 110 // 1262MB when it actually has 2GB, while Razr M has 1GB but only reports | 110 // 1262MB when it actually has 2GB, while Razr M has 1GB but only reports |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 physical_memory_mb / 12; // <64MB | 145 physical_memory_mb / 12; // <64MB |
| 146 } else { | 146 } else { |
| 147 // Low-end devices have 512MB or less memory by definition | 147 // Low-end devices have 512MB or less memory by definition |
| 148 // so we hard code the limit rather than relying on the heuristics | 148 // so we hard code the limit rather than relying on the heuristics |
| 149 // above. Low-end devices use 4444 textures so we can use a lower limit. | 149 // above. Low-end devices use 4444 textures so we can use a lower limit. |
| 150 memory_policy.bytes_limit_when_visible = 8; | 150 memory_policy.bytes_limit_when_visible = 8; |
| 151 } | 151 } |
| 152 memory_policy.bytes_limit_when_visible = | 152 memory_policy.bytes_limit_when_visible = |
| 153 memory_policy.bytes_limit_when_visible * 1024 * 1024; | 153 memory_policy.bytes_limit_when_visible * 1024 * 1024; |
| 154 // Clamp the observed value to a specific range on Android. | 154 // Clamp the observed value to a specific range on Android. |
| 155 memory_policy.bytes_limit_when_visible = std::max( | 155 memory_policy.bytes_limit_when_visible = |
| 156 memory_policy.bytes_limit_when_visible, | 156 std::max(memory_policy.bytes_limit_when_visible, |
| 157 static_cast<size_t>(8 * 1024 * 1024)); | 157 static_cast<size_t>(8 * 1024 * 1024)); |
| 158 memory_policy.bytes_limit_when_visible = | 158 memory_policy.bytes_limit_when_visible = |
| 159 std::min(memory_policy.bytes_limit_when_visible, | 159 std::min(memory_policy.bytes_limit_when_visible, |
| 160 static_cast<size_t>(256 * 1024 * 1024)); | 160 static_cast<size_t>(256 * 1024 * 1024)); |
| 161 } | 161 } |
| 162 memory_policy.priority_cutoff_when_visible = | 162 memory_policy.priority_cutoff_when_visible = |
| 163 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING; | 163 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING; |
| 164 #else | 164 #else |
| 165 // Ignore what the system said and give all clients the same maximum | 165 // Ignore what the system said and give all clients the same maximum |
| 166 // allocation on desktop platforms. | 166 // allocation on desktop platforms. |
| 167 memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; | 167 memory_policy.bytes_limit_when_visible = 512 * 1024 * 1024; |
| 168 memory_policy.priority_cutoff_when_visible = | 168 memory_policy.priority_cutoff_when_visible = |
| 169 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; | 169 gpu::MemoryAllocation::CUTOFF_ALLOW_NICE_TO_HAVE; |
| 170 #endif | 170 #endif |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace client | 173 } // namespace client |
| 174 } // namespace blimp | 174 } // namespace blimp |
| OLD | NEW |