Revert "Remove skstd::optional entirely."

This reverts commit 0596094b81.

Reason for revert: Flutter somehow still references skstd::optional

flutter_engine in google3 still has old code:
http://screen/BHDrjqwzchdFVfQ

Original change's description:
> Remove skstd::optional entirely.
>
> Change-Id: Id9862712ea3e769797abd654922879ce6bc4487c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504976
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

Change-Id: Idea391399c2e11b83d5a130023adb340d40cadcb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505396
Auto-Submit: John Stiles <johnstiles@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Heather Miller <hcm@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
This commit is contained in:
John Stiles 2022-02-08 01:57:06 +00:00 committed by SkCQ
parent 4eb6e56b19
commit 156e7d15a4
7 changed files with 27 additions and 7 deletions

View File

@ -502,6 +502,7 @@ skia_core_sources = [
"$_include/private/SkTFitsIn.h",
"$_include/private/SkTHash.h",
"$_include/private/SkTLogic.h",
"$_include/private/SkTOptional.h",
"$_include/private/SkTemplates.h",
"$_include/private/SkThreadAnnotations.h",
"$_include/private/SkThreadID.h",

View File

@ -28,10 +28,10 @@
#include "include/core/SkTypes.h"
#include "include/private/SkDeque.h"
#include "include/private/SkMacros.h"
#include "include/private/SkTOptional.h"
#include <cstring>
#include <memory>
#include <optional>
#include <vector>
#ifndef SK_SUPPORT_LEGACY_GETTOTALMATRIX

View File

@ -15,11 +15,11 @@
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkTileMode.h"
#include "include/private/SkTOptional.h"
#if SK_SUPPORT_GPU
#include "include/gpu/GrTypes.h"
#endif
#include <functional> // std::function
#include <optional>
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
#include <android/hardware_buffer.h>

View File

@ -13,8 +13,7 @@
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkYUVAPixmaps.h"
#include <optional>
#include "include/private/SkTOptional.h"
class GrRecordingContext;
class GrSurfaceProxyView;

View File

@ -11,10 +11,9 @@
#include "include/core/SkBlendMode.h"
#include "include/core/SkColor.h"
#include "include/core/SkRefCnt.h"
#include "include/private/SkTOptional.h"
#include "include/private/SkTo.h"
#include <optional>
class SkBlender;
class SkColorFilter;
class SkColorSpace;

View File

@ -18,9 +18,9 @@
#include "include/core/SkString.h"
#include "include/private/SkOnce.h"
#include "include/private/SkSLSampleUsage.h"
#include "include/private/SkTOptional.h"
#include <string>
#include <optional>
#include <vector>
#ifdef SK_ENABLE_SKSL

View File

@ -0,0 +1,21 @@
/*
* Copyright 2021 Google LLC.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkTOptional_DEFINED
#define SkTOptional_DEFINED
#include <optional>
namespace skstd {
template <typename T> using optional = std::optional<T>;
using nullopt_t = std::nullopt_t;
inline constexpr nullopt_t nullopt = std::nullopt;
} // namespace skstd
#endif