Commit 422a39e7 authored by Kenneth Russell's avatar Kenneth Russell Committed by Commit Bot

Address feedback in GPU switching code.

Address review comments from jdarpinian.

Bug: 681341
Change-Id: I68923295cbc6699c1a313e18af4dd8c0ea226354
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1907106Reviewed-by: default avatarJames Darpinian <jdarpinian@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713950}
parent 5b61513a
......@@ -31,9 +31,9 @@ Platform::ContextAttributes ToPlatformContextAttributes(
Platform::ContextType context_type,
bool support_own_offscreen_surface) {
Platform::ContextAttributes result;
// Must keep the meaning of the "default" GPU choice in sync with the code
// below, in PowerPreferenceToGpuPreference.
result.prefer_low_power_gpu = attrs.power_preference == "low-power";
result.prefer_low_power_gpu =
(PowerPreferenceToGpuPreference(attrs.power_preference) ==
gl::GpuPreference::kLowPower);
result.fail_if_major_performance_caveat =
attrs.fail_if_major_performance_caveat;
result.context_type = context_type;
......@@ -49,8 +49,7 @@ Platform::ContextAttributes ToPlatformContextAttributes(
}
gl::GpuPreference PowerPreferenceToGpuPreference(String power_preference) {
// Must keep the interpretation of the "default" GPU in sync with the code
// above which sets the prefer_low_power_gpu attribute.
// This code determines the handling of the "default" power preference.
if (power_preference == "low-power")
return gl::GpuPreference::kLowPower;
return gl::GpuPreference::kHighPerformance;
......
......@@ -841,6 +841,7 @@ void WebGLRenderingContextBase::
UpdateNumberOfUserAllocatedMultisampledRenderbuffers(int delta) {
DCHECK(delta >= -1 && delta <= 1);
number_of_user_allocated_multisampled_renderbuffers_ += delta;
DCHECK_GE(number_of_user_allocated_multisampled_renderbuffers_, 0);
}
namespace {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment