0
Files
src/ui/gl/gl_display_egl_util.h
Arthur Sonzogni 3eb9fd5188 Rename {absl => std}::optional in //ui/
#cleanup

Automated patch. This is a no-op. Please avoid, as much as possible,
assigning unrelated bugs to this.

Context:
--------
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email
As of https://crrev.com/1204351, absl::optional is now a type alias
for std::optional. We should migrate toward it.

This patch:
----------
This applies the rename to ui/

Script:
-------
````
cd ui
function replace {
  echo "Replacing $1 by $2"
  git grep -l "$1" \
    | cut -f1 -d: \
    | grep \
      -e "\.h" \
      -e "\.cc" \
      -e "\.mm" \
    | sort \
    | uniq \
    | xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place," "std::in_place,"
replace "absl::in_place_t," "std::in_place_t,"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
cd ..

git status
echo "Formatting"

echo "IncludeBlocks: Regroup" >> ".clang-format"
echo "IncludeIsMainRegex: \"(_(android|apple|chromeos|freebsd|fuchsia|fuzzer|ios|linux|mac|nacl|openbsd|posix|stubs?|win))?(_(unit|browser|perf)?tests?)?$\"" >> ".clang-format"
git cl format
git restore ".clang-format"
```

# Skipping win-presubmit, due to a bug in depot_tools:
# See https://g-issues.chromium.org/issues/324293047
NOPRESUBMIT=true

CQ_INCLUDE_TRYBOTS=luci.chrome.try:chromeos-betty-pi-arc-chrome

AX-Relnotes: n/a.
Cleanup: This is a cleanup.
Bug: chromium:1500249
Change-Id: I134bbce97a0ae63ae432a5733e934828f8f49c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5279376
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1258447}
2024-02-09 12:20:43 +00:00

55 lines
1.9 KiB
C++

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GL_GL_DISPLAY_EGL_UTIL_H_
#define UI_GL_GL_DISPLAY_EGL_UTIL_H_
#include <optional>
#include <vector>
#include "base/scoped_environment_variable_override.h"
#include "third_party/khronos/EGL/egl.h"
#include "ui/gl/gl_export.h"
#include "ui/gl/gl_surface_egl.h"
namespace gl {
// Utility singleton class that helps to set additional egl properties. This
// class should be implemented by each platform except Ozone. In case of Ozone,
// there is a common implementation that forwards calls to a public interface of
// a platform.
// The reason why it is defined here in ui/gl is that ui/gl cannot depend on
// ozone and we have to provide an interface here. ui/gl/init will provide an
// implementation for this utility class upon initialization of gl.
class GL_EXPORT GLDisplayEglUtil {
public:
// Returns either set instance or stub instance.
static GLDisplayEglUtil* GetInstance();
static void SetInstance(GLDisplayEglUtil* gl_display_util);
// Returns display attributes for the given |platform_type|. Each platform can
// have different attributes.
virtual void GetPlatformExtraDisplayAttribs(
EGLenum platform_type,
std::vector<EGLAttrib>* attributes) = 0;
// Sets custom alpha and buffer size for a given platform. By default, the
// values are not modified.
virtual void ChoosePlatformCustomAlphaAndBufferSize(EGLint* alpha_size,
EGLint* buffer_size) = 0;
// X11 specific; returns scoped unset display env variable if vulkan surface
// is not supported.
virtual std::optional<base::ScopedEnvironmentVariableOverride>
MaybeGetScopedDisplayUnsetForVulkan() = 0;
protected:
virtual ~GLDisplayEglUtil() = default;
};
} // namespace gl
#endif // UI_GL_GL_DISPLAY_EGL_UTIL_H_