Update to Chromium version 125.0.6422.0 (#1287751)

This commit is contained in:
Marshall Greenblatt
2024-04-23 16:06:00 -04:00
parent 4fe529e2dc
commit b67cbc47e3
145 changed files with 1047 additions and 920 deletions

View File

@@ -7,6 +7,8 @@
#include <stdint.h>
#include <string_view>
#include "include/cef_stream.h"
#include "include/cef_version.h"
#include "libcef/common/app_manager.h"
@@ -18,7 +20,6 @@
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"

View File

@@ -299,7 +299,7 @@ std::optional<int> AlloyMainDelegate::BasicStartupComplete() {
if (settings_->log_items == LOG_ITEMS_NONE) {
log_items_str = std::string(switches::kLogItems_None);
} else {
std::vector<base::StringPiece> added_items;
std::vector<std::string_view> added_items;
if (settings_->log_items & LOG_ITEMS_FLAG_PROCESS_ID) {
added_items.emplace_back(switches::kLogItems_PId);
}
@@ -472,9 +472,7 @@ std::optional<int> AlloyMainDelegate::BasicStartupComplete() {
#endif // BUILDFLAG(IS_WIN)
if (dest == LoggingDest::kFile) {
log_settings.log_file_path = log_file.value().c_str();
} else {
log_settings.log_file_path = nullptr;
log_settings.log_file_path = log_file.value();
}
log_settings.lock_log = logging::DONT_LOCK_LOG_FILE;

View File

@@ -4,6 +4,7 @@
#include "libcef/common/crash_reporter_client.h"
#include <string_view>
#include <utility>
#if BUILDFLAG(IS_WIN)
@@ -14,7 +15,6 @@
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -250,7 +250,7 @@ CefCrashReporterClient* g_crash_reporter_client = nullptr;
const char kKeyMapDelim = ',';
std::string NormalizeCrashKey(const base::StringPiece& key) {
std::string NormalizeCrashKey(const std::string_view& key) {
std::string str(key);
std::replace(str.begin(), str.end(), kKeyMapDelim, '-');
if (str.length() > crashpad::Annotation::kNameMaxLength) {
@@ -297,7 +297,7 @@ int __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const char* key,
size_t value_size) {
if (g_crash_reporter_client) {
return g_crash_reporter_client->SetCrashKeyValue(
base::StringPiece(key, key_size), base::StringPiece(value, value_size));
std::string_view(key, key_size), std::string_view(value, value_size));
}
return 0;
}
@@ -537,7 +537,7 @@ bool CefCrashReporterClient::ReadCrashConfigFile() {
for (auto& id : ids) {
size_t length = std::min(map_keys.size() - offset,
crashpad::Annotation::kValueMaxSize);
id.Set(base::StringPiece(map_keys.data() + offset, length));
id.Set(std::string_view(map_keys.data() + offset, length));
offset += length;
if (offset >= map_keys.size()) {
break;
@@ -751,21 +751,21 @@ bool CefCrashReporterClient::EnableBrowserCrashForwarding() {
IDKEY(n "-V"), IDKEY(n "-W"), IDKEY(n "-X"), IDKEY(n "-Y"), \
IDKEY(n "-Z")
#define IDKEY_FUNCTION(name, size_) \
static_assert(size_ <= crashpad::Annotation::kValueMaxSize, \
"Annotation size is too large."); \
bool Set##name##Annotation(size_t index, const base::StringPiece& value) { \
using IDKey = crash_reporter::CrashKeyString<size_>; \
static IDKey ids[] = {IDKEY_ENTRIES(#name)}; \
if (index < std::size(ids)) { \
if (value.empty()) { \
ids[index].Clear(); \
} else { \
ids[index].Set(value); \
} \
return true; \
} \
return false; \
#define IDKEY_FUNCTION(name, size_) \
static_assert(size_ <= crashpad::Annotation::kValueMaxSize, \
"Annotation size is too large."); \
bool Set##name##Annotation(size_t index, const std::string_view& value) { \
using IDKey = crash_reporter::CrashKeyString<size_>; \
static IDKey ids[] = {IDKEY_ENTRIES(#name)}; \
if (index < std::size(ids)) { \
if (value.empty()) { \
ids[index].Clear(); \
} else { \
ids[index].Set(value); \
} \
return true; \
} \
return false; \
}
// The first argument must be kept synchronized with the logic in
@@ -775,8 +775,8 @@ IDKEY_FUNCTION(S, 64)
IDKEY_FUNCTION(M, 256)
IDKEY_FUNCTION(L, 1024)
bool CefCrashReporterClient::SetCrashKeyValue(const base::StringPiece& key,
const base::StringPiece& value) {
bool CefCrashReporterClient::SetCrashKeyValue(const std::string_view& key,
const std::string_view& value) {
if (key.empty() || crash_keys_.empty()) {
return false;
}

View File

@@ -6,11 +6,11 @@
#define CEF_LIBCEF_COMMON_CRASH_REPORTER_CLIENT_H_
#include <string>
#include <string_view>
#include <vector>
#include "include/cef_version.h"
#include "base/strings/string_piece.h"
#include "base/synchronization/lock.h"
#include "build/build_config.h"
#include "components/crash/core/app/crash_reporter_client.h"
@@ -78,8 +78,8 @@ class CefCrashReporterClient : public crash_reporter::CrashReporterClient {
#endif
// Set or clear a crash key value.
bool SetCrashKeyValue(const base::StringPiece& key,
const base::StringPiece& value);
bool SetCrashKeyValue(const std::string_view& key,
const std::string_view& value);
private:
bool has_crash_config_file_ = false;

View File

@@ -4,6 +4,8 @@
#include "libcef/common/crash_reporting.h"
#include <string_view>
#include "include/cef_crash_util.h"
#include "libcef/common/cef_switches.h"
#include "libcef/features/runtime.h"
@@ -13,7 +15,6 @@
#include "base/debug/crash_logging.h"
#include "base/logging.h"
#include "base/stl_util.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_util.h"
#include "chrome/common/crash_keys.h"
#include "components/crash/core/common/crash_key.h"
@@ -51,8 +52,8 @@ typedef int(__cdecl* SetCrashKeyValue)(const char*,
// int __declspec(dllexport) __cdecl IsCrashReportingEnabledImpl.
typedef int(__cdecl* IsCrashReportingEnabled)();
bool SetCrashKeyValueTrampoline(const base::StringPiece& key,
const base::StringPiece& value) {
bool SetCrashKeyValueTrampoline(const std::string_view& key,
const std::string_view& value) {
static SetCrashKeyValue set_crash_key = []() {
HMODULE elf_module = GetModuleHandle(kChromeElfDllName);
return reinterpret_cast<SetCrashKeyValue>(
@@ -176,8 +177,8 @@ bool Enabled() {
return g_crash_reporting_enabled;
}
bool SetCrashKeyValue(const base::StringPiece& key,
const base::StringPiece& value) {
bool SetCrashKeyValue(const std::string_view& key,
const std::string_view& value) {
if (!g_crash_reporting_enabled) {
return false;
}

View File

@@ -3,8 +3,8 @@
// governed by a BSD-style license that can be found in the LICENSE file.
#include <string>
#include <string_view>
#include "base/strings/string_piece.h"
#include "build/build_config.h"
namespace base {
@@ -17,8 +17,8 @@ namespace crash_reporting {
bool Enabled();
// Set or clear a crash key value.
bool SetCrashKeyValue(const base::StringPiece& key,
const base::StringPiece& value);
bool SetCrashKeyValue(const std::string_view& key,
const std::string_view& value);
// Functions are called from similarly named methods in AlloyMainDelegate.

View File

@@ -14,7 +14,7 @@
// Required by the PDF extension which is hosted in a guest view.
"contentSettings": {
"dependencies": ["permission:contentSettings"],
"contexts": ["blessed_extension"]
"contexts": ["privileged_extension"]
},
"mimeHandlerViewGuestInternal": {
"internal": true,
@@ -24,12 +24,12 @@
},
"pdfViewerPrivate": {
"dependencies": ["permission:pdfViewerPrivate"],
"contexts": ["blessed_extension"]
"contexts": ["privileged_extension"]
},
"resourcesPrivate": [
{
"dependencies": ["permission:resourcesPrivate"],
"contexts": ["blessed_extension"]
"contexts": ["privileged_extension"]
},
{
"channel": "stable",
@@ -40,7 +40,7 @@
"tabs": {
"channel": "stable",
"extension_types": ["extension", "legacy_packaged_app"],
"contexts": ["blessed_extension"],
"contexts": ["privileged_extension"],
"disallow_for_service_workers": false
}
}

View File

@@ -11,9 +11,9 @@
namespace extensions::api::cef {
// static
base::StringPiece ChromeGeneratedSchemas::Get(const std::string& name) {
std::string_view ChromeGeneratedSchemas::Get(const std::string& name) {
if (!ChromeFunctionRegistry::IsSupported(name)) {
return base::StringPiece();
return std::string_view();
}
return extensions::api::ChromeGeneratedSchemas::Get(name);
}

View File

@@ -11,8 +11,7 @@
#include <map>
#include <string>
#include "base/strings/string_piece.h"
#include <string_view>
namespace extensions::api::cef {
@@ -22,7 +21,7 @@ class ChromeGeneratedSchemas {
static bool IsGenerated(std::string name);
// Gets the API schema named |name|.
static base::StringPiece Get(const std::string& name);
static std::string_view Get(const std::string& name);
};
} // namespace extensions::api::cef

View File

@@ -48,7 +48,7 @@ CefRefPtr<CefValue> CefParseJSON(const void* json,
return nullptr;
}
std::optional<base::Value> parse_result = base::JSONReader::Read(
base::StringPiece(static_cast<const char*>(json), json_size),
std::string_view(static_cast<const char*>(json), json_size),
GetJSONReaderOptions(options));
if (parse_result) {
return new CefValueImpl(std::move(parse_result.value()));

View File

@@ -132,7 +132,7 @@ CefString CefBase64Encode(const void* data, size_t data_size) {
return CefString();
}
base::StringPiece input(static_cast<const char*>(data), data_size);
std::string_view input(static_cast<const char*>(data), data_size);
return base::Base64Encode(input);
}

View File

@@ -80,7 +80,7 @@ int GetCacheControlHeaderPolicy(CefRequest::HeaderMap headerMap) {
if (!line.empty()) {
HttpHeaderUtils::MakeASCIILower(&line);
std::vector<base::StringPiece> pieces = base::SplitStringPiece(
std::vector<std::string_view> pieces = base::SplitStringPiece(
line, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (const auto& piece : pieces) {
if (base::EqualsCaseInsensitiveASCII(piece,

View File

@@ -43,7 +43,7 @@ std::optional<std::string> CefResourceBundleDelegate::LoadDataResourceString(
bool CefResourceBundleDelegate::GetRawDataResource(
int resource_id,
ui::ResourceScaleFactor scale_factor,
base::StringPiece* value) const {
std::string_view* value) const {
auto application = CefAppManager::Get()->GetApplication();
if (application) {
CefRefPtr<CefResourceBundleHandler> handler =
@@ -55,10 +55,10 @@ bool CefResourceBundleDelegate::GetRawDataResource(
if (handler->GetDataResourceForScale(
resource_id, static_cast<cef_scale_factor_t>(scale_factor),
data, data_size)) {
*value = base::StringPiece(static_cast<char*>(data), data_size);
*value = std::string_view(static_cast<char*>(data), data_size);
}
} else if (handler->GetDataResource(resource_id, data, data_size)) {
*value = base::StringPiece(static_cast<char*>(data), data_size);
*value = std::string_view(static_cast<char*>(data), data_size);
}
}
}

View File

@@ -35,7 +35,7 @@ class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate {
std::optional<std::string> LoadDataResourceString(int resource_id) override;
bool GetRawDataResource(int resource_id,
ui::ResourceScaleFactor scale_factor,
base::StringPiece* value) const override;
std::string_view* value) const override;
bool GetLocalizedString(int message_id, std::u16string* value) const override;
private:

View File

@@ -26,7 +26,7 @@ void string_utf16_dtor(char16_t* str) {
}
// Originally from base/strings/utf_string_conversions.cc
std::wstring ASCIIToWide(const base::StringPiece& ascii) {
std::wstring ASCIIToWide(const std::string_view& ascii) {
DCHECK(base::IsStringASCII(ascii)) << ascii;
return std::wstring(ascii.begin(), ascii.end());
}

View File

@@ -795,7 +795,7 @@ bool CefDictionaryValueImpl::Clear() {
bool CefDictionaryValueImpl::HasKey(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, 0);
return const_value().GetDict().contains(base::StringPiece(key.ToString()));
return const_value().GetDict().contains(std::string_view(key.ToString()));
}
bool CefDictionaryValueImpl::GetKeys(KeyList& keys) {
@@ -817,7 +817,7 @@ CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID);
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value) {
switch (value->type()) {
case base::Value::Type::NONE:
@@ -846,7 +846,7 @@ CefRefPtr<CefValue> CefDictionaryValueImpl::GetValue(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value) {
return CefValueImpl::GetOrCreateRefOrCopy(const_cast<base::Value*>(value),
mutable_value_unchecked(),
@@ -862,7 +862,7 @@ bool CefDictionaryValueImpl::GetBool(const CefString& key) {
bool ret_value = false;
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value && value->is_bool()) {
ret_value = value->GetBool();
}
@@ -876,7 +876,7 @@ int CefDictionaryValueImpl::GetInt(const CefString& key) {
int ret_value = 0;
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value && value->is_int()) {
ret_value = value->GetInt();
}
@@ -890,7 +890,7 @@ double CefDictionaryValueImpl::GetDouble(const CefString& key) {
double ret_value = 0;
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value && value->is_double()) {
ret_value = value->GetDouble();
}
@@ -904,7 +904,7 @@ CefString CefDictionaryValueImpl::GetString(const CefString& key) {
std::string ret_value;
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value && value->is_string()) {
ret_value = value->GetString();
}
@@ -917,7 +917,7 @@ CefRefPtr<CefBinaryValue> CefDictionaryValueImpl::GetBinary(
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value && value->is_blob()) {
base::Value* binary_value = const_cast<base::Value*>(value);
return CefBinaryValueImpl::GetOrCreateRef(
@@ -932,7 +932,7 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value && value->is_dict()) {
base::Value* dict_value = const_cast<base::Value*>(value);
return CefDictionaryValueImpl::GetOrCreateRef(
@@ -946,7 +946,7 @@ CefRefPtr<CefListValue> CefDictionaryValueImpl::GetList(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (value && value->is_list()) {
base::Value* list_value = const_cast<base::Value*>(value);
return CefListValueImpl::GetOrCreateRef(
@@ -1042,14 +1042,14 @@ bool CefDictionaryValueImpl::RemoveInternal(const CefString& key) {
// retrieve the actual Value pointer as it current exists first, for later
// comparison purposes.
const base::Value* actual_value =
const_value().GetDict().Find(base::StringPiece(key.ToString()));
const_value().GetDict().Find(std::string_view(key.ToString()));
if (!actual_value) {
return false;
}
// |actual_value| is no longer valid after this call.
std::optional<base::Value> out_value =
mutable_value()->GetDict().Extract(base::StringPiece(key.ToString()));
mutable_value()->GetDict().Extract(std::string_view(key.ToString()));
if (!out_value.has_value()) {
return false;
}
@@ -1076,7 +1076,7 @@ base::Value* CefDictionaryValueImpl::SetInternal(
// contents of the passed-in base::Value instead of keeping the same object.
// Set() then returns the actual Value pointer as it currently exists.
base::Value* actual_value = mutable_value()->GetDict().Set(
base::StringPiece(key.ToString()), std::move(*value));
std::string_view(key.ToString()), std::move(*value));
CHECK(actual_value);
// |value| will be deleted when this method returns. Update the controller to