diff --git a/cef_paths2.gypi b/cef_paths2.gypi index 5aedd532d..ee147c26c 100644 --- a/cef_paths2.gypi +++ b/cef_paths2.gypi @@ -17,7 +17,6 @@ 'include/base/cef_callback_list.h', 'include/base/cef_cancelable_callback.h', 'include/base/cef_compiler_specific.h', - 'include/base/cef_cxx17_backports.h', 'include/base/cef_lock.h', 'include/base/cef_logging.h', 'include/base/cef_macros.h', diff --git a/include/base/cef_cxx17_backports.h b/include/base/cef_cxx17_backports.h deleted file mode 100644 index 9b66beb96..000000000 --- a/include/base/cef_cxx17_backports.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2021 Marshall A. Greenblatt. Portions copyright (c) 2021 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -#ifndef CEF_INCLUDE_BASE_CEF_CXX17_BACKPORTS_H_ -#define CEF_INCLUDE_BASE_CEF_CXX17_BACKPORTS_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/cxx17_backports.h" -#else // !USING_CHROMIUM_INCLUDES -// The following was removed from Chromium in https://crrev.com/78734f77be. - -namespace base { - -// C++14 implementation of C++17's std::size(): -// http://en.cppreference.com/w/cpp/iterator/size -template -constexpr auto size(const Container& c) -> decltype(c.size()) { - return c.size(); -} - -template -constexpr size_t size(const T (&array)[N]) noexcept { - return N; -} - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_CXX17_BACKPORTS_H_ diff --git a/libcef_dll/base/cef_logging.cc b/libcef_dll/base/cef_logging.cc index 808ccd9f4..0d935507a 100644 --- a/libcef_dll/base/cef_logging.cc +++ b/libcef_dll/base/cef_logging.cc @@ -15,7 +15,6 @@ #include #endif -#include "include/base/cef_cxx17_backports.h" #include "include/internal/cef_string_types.h" namespace cef { @@ -210,7 +209,7 @@ std::string SystemErrorCodeToString(SystemErrorCode error_code) { char msgbuf[error_message_buffer_size]; DWORD flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS; DWORD len = FormatMessageA(flags, NULL, error_code, 0, msgbuf, - static_cast(base::size(msgbuf)), NULL); + static_cast(std::size(msgbuf)), NULL); std::stringstream ss; if (len) { std::string s(msgbuf); diff --git a/tests/cefclient/browser/browser_window_osr_gtk.cc b/tests/cefclient/browser/browser_window_osr_gtk.cc index a646fdf44..8878a6d9d 100644 --- a/tests/cefclient/browser/browser_window_osr_gtk.cc +++ b/tests/cefclient/browser/browser_window_osr_gtk.cc @@ -18,7 +18,6 @@ #include -#include "include/base/cef_cxx17_backports.h" #include "include/base/cef_logging.h" #include "include/base/cef_macros.h" #include "include/wrapper/cef_closure_task.h" @@ -791,7 +790,7 @@ KeyboardCode GdkEventToWindowsKeyCode(const GdkEventKey* event) { if (windows_key_code) return windows_key_code; - if (event->hardware_keycode < base::size(kHardwareCodeToGDKKeyval)) { + if (event->hardware_keycode < std::size(kHardwareCodeToGDKKeyval)) { int keyval = kHardwareCodeToGDKKeyval[event->hardware_keycode]; if (keyval) return KeyboardCodeFromXKeysym(keyval); diff --git a/tests/cefclient/browser/client_handler.cc b/tests/cefclient/browser/client_handler.cc index fe4d0ecdc..a02f4c872 100644 --- a/tests/cefclient/browser/client_handler.cc +++ b/tests/cefclient/browser/client_handler.cc @@ -11,7 +11,6 @@ #include #include "include/base/cef_callback.h" -#include "include/base/cef_cxx17_backports.h" #include "include/cef_browser.h" #include "include/cef_command_ids.h" #include "include/cef_frame.h" @@ -1469,7 +1468,7 @@ bool ClientHandler::IsAllowedCommandId(int command_id) { IDC_CONTENT_CONTEXT_UNDO, IDC_CONTENT_CONTEXT_REDO, }; - for (size_t i = 0; i < base::size(kAllowedCommandIds); ++i) { + for (size_t i = 0; i < std::size(kAllowedCommandIds); ++i) { if (command_id == kAllowedCommandIds[i]) return true; } diff --git a/tests/cefclient/browser/root_window_views.cc b/tests/cefclient/browser/root_window_views.cc index 563633fda..0625814cd 100644 --- a/tests/cefclient/browser/root_window_views.cc +++ b/tests/cefclient/browser/root_window_views.cc @@ -8,7 +8,6 @@ #include "include/base/cef_build.h" #include "include/base/cef_callback.h" -#include "include/base/cef_cxx17_backports.h" #include "include/cef_app.h" #include "include/wrapper/cef_helpers.h" #include "tests/cefclient/browser/client_handler_std.h" @@ -486,7 +485,7 @@ void RootWindowViews::InitOnUIThread( // Populate the default image cache. ImageCache::ImageInfoSet image_set; - for (size_t i = 0U; i < base::size(kDefaultImageCache); ++i) + for (size_t i = 0U; i < std::size(kDefaultImageCache); ++i) image_set.push_back(ImageCache::ImageInfo::Create2x(kDefaultImageCache[i])); image_cache_->LoadImages( @@ -504,8 +503,8 @@ void RootWindowViews::CreateViewsWindow( #ifndef NDEBUG // Make sure the default images loaded successfully. - DCHECK_EQ(images.size(), base::size(kDefaultImageCache)); - for (size_t i = 0U; i < base::size(kDefaultImageCache); ++i) { + DCHECK_EQ(images.size(), std::size(kDefaultImageCache)); + for (size_t i = 0U; i < std::size(kDefaultImageCache); ++i) { DCHECK(images[i]) << "Default image " << i << " failed to load"; } #endif diff --git a/tests/ceftests/test_server_observer_unittest.cc b/tests/ceftests/test_server_observer_unittest.cc index 23db079b3..315844b07 100644 --- a/tests/ceftests/test_server_observer_unittest.cc +++ b/tests/ceftests/test_server_observer_unittest.cc @@ -4,7 +4,6 @@ #include -#include "include/base/cef_cxx17_backports.h" #include "include/cef_command_line.h" #include "include/cef_task.h" #include "include/cef_waitable_event.h" @@ -193,7 +192,7 @@ void RunHelperMultiple(bool https_server) { TestState states[3]; size_t count = 0; - const size_t size = base::size(states); + const size_t size = std::size(states); for (size_t i = 0; i < size; ++i) { std::stringstream ss; diff --git a/tests/shared/browser/extension_util.cc b/tests/shared/browser/extension_util.cc index e6e6eae89..18bf23d0d 100644 --- a/tests/shared/browser/extension_util.cc +++ b/tests/shared/browser/extension_util.cc @@ -8,7 +8,6 @@ #include #include "include/base/cef_callback.h" -#include "include/base/cef_cxx17_backports.h" #include "include/cef_parser.h" #include "include/cef_path_util.h" #include "include/wrapper/cef_closure_task.h" @@ -124,7 +123,7 @@ bool IsInternalExtension(const std::string& extension_path) { static const char* extensions[] = {"set_page_color"}; const std::string& internal_path = GetInternalPath(extension_path); - for (size_t i = 0; i < base::size(extensions); ++i) { + for (size_t i = 0; i < std::size(extensions); ++i) { // Exact match or first directory component. const std::string& extension = extensions[i]; if (internal_path == extension ||