Commit 56e74941 authored by jschuh's avatar jschuh Committed by Commit bot

Remove remaining base dependencies from base/numerics

All that was left was base/logging.h. And since this gets pulled in for
a lot of other projects, it's best to make it dependency clean.
It also necessitated several IWYU fixes for the missing header.

TBR=jam@chromium.org,
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2523663002
Cr-Commit-Position: refs/heads/master@{#434057}
parent 8652b0d3
......@@ -7,10 +7,10 @@
#include <stddef.h>
#include <cassert>
#include <limits>
#include <type_traits>
#include "base/logging.h"
#include "base/numerics/safe_conversions_impl.h"
namespace base {
......@@ -41,11 +41,15 @@ constexpr typename std::enable_if<!std::numeric_limits<T>::is_signed,
return false;
}
// Just fires a CHECK(false). Used for numeric boundary errors.
// Forces a crash, like a CHECK(false). Used for numeric boundary errors.
struct CheckOnFailure {
template <typename T>
static T HandleFailure() {
CHECK(false);
#if defined(__GNUC__) || defined(__clang__)
__builtin_trap();
#else
((void)(*(volatile char*)0 = 0));
#endif
return T();
}
};
......@@ -75,6 +79,7 @@ struct SaturatedCastNaNBehaviorReturnZero {
namespace internal {
// This wrapper is used for C++11 constexpr support by avoiding the declaration
// of local variables in the saturated_cast template function.
// TODO(jschuh): convert this back to a switch once we support C++14.
template <typename Dst, class NaNHandler, typename Src>
constexpr Dst saturated_cast_impl(const Src value,
const RangeConstraint constraint) {
......@@ -84,9 +89,7 @@ constexpr Dst saturated_cast_impl(const Src value,
? std::numeric_limits<Dst>::min()
: (constraint == RANGE_OVERFLOW
? std::numeric_limits<Dst>::max()
: (constraint == RANGE_INVALID
? NaNHandler::template HandleFailure<Dst>()
: (NOTREACHED(), static_cast<Dst>(value)))));
: NaNHandler::template HandleFailure<Dst>()));
}
} // namespace internal
......
......@@ -10,7 +10,6 @@
#include <limits>
#include <type_traits>
#include "base/logging.h"
#include "base/numerics/safe_math_impl.h"
namespace base {
......
......@@ -59,6 +59,7 @@
#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/numerics/safe_math.h"
#include "build/build_config.h"
......
......@@ -4,6 +4,7 @@
#include "chromecast/media/base/media_caps.h"
#include "base/logging.h"
#include "chromecast/public/avsettings.h"
namespace chromecast {
......
......@@ -4,6 +4,7 @@
#include "components/subresource_filter/core/common/unindexed_ruleset.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
namespace subresource_filter {
......
......@@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include "base/logging.h"
#include "base/macros.h"
#include "base/numerics/safe_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -15,6 +15,7 @@
#include <string>
#include <vector>
#include "base/logging.h"
#include "base/macros.h"
#include "base/numerics/safe_math.h"
#include "gpu/command_buffer/common/gles2_utils_export.h"
......
......@@ -11,6 +11,7 @@
#include <memory>
#include <string>
#include "base/logging.h"
#include "base/strings/stringize_macros.h"
#include "base/strings/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
......
......@@ -7,6 +7,7 @@
#include <vector>
#include "base/logging.h"
#include "ui/display/util/edid_parser.h"
#include "ui/gfx/geometry/size.h"
......
......@@ -16,6 +16,7 @@
#include <iosfwd>
#include <string>
#include "base/logging.h"
#include "build/build_config.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/safe_integer_conversions.h"
......
......@@ -5,6 +5,7 @@
#ifndef UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_
#define UI_VIEWS_TEST_TEST_LAYOUT_MANAGER_H_
#include "base/macros.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/layout/layout_manager.h"
......
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