Update to Chromium version 93.0.4577.0 (#902210)

This commit is contained in:
Marshall Greenblatt
2021-07-23 12:40:13 -04:00
parent 1ffa5528b3
commit b4ea0496e7
141 changed files with 1188 additions and 1061 deletions

View File

@@ -8,7 +8,7 @@
#include "libcef/common/net/scheme_info.h"
#include "libcef/features/runtime.h"
#include "base/stl_util.h"
#include "base/containers/contains.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "net/net_buildflags.h"

View File

@@ -102,9 +102,9 @@ int GetCacheControlHeaderPolicy(CefRequest::HeaderMap headerMap) {
// Convert cef_urlrequest_flags_t to blink::WebCachePolicy.
blink::mojom::FetchCacheMode GetFetchCacheMode(int ur_flags) {
const bool skip_cache{ur_flags & UR_FLAG_SKIP_CACHE};
const bool only_from_cache{ur_flags & UR_FLAG_ONLY_FROM_CACHE};
const bool disable_cache{ur_flags & UR_FLAG_DISABLE_CACHE};
const bool skip_cache{!!(ur_flags & UR_FLAG_SKIP_CACHE)};
const bool only_from_cache{!!(ur_flags & UR_FLAG_ONLY_FROM_CACHE)};
const bool disable_cache{!!(ur_flags & UR_FLAG_DISABLE_CACHE)};
if (only_from_cache && (skip_cache || disable_cache)) {
// The request will always fail because only_from_cache and
// skip_cache/disable_cache are mutually exclusive.

View File

@@ -105,7 +105,7 @@ bool CefThreadImpl::Create(const CefString& display_name,
}
#endif
if (!thread_->StartWithOptions(options)) {
if (!thread_->StartWithOptions(std::move(options))) {
thread_.reset();
return false;
}

View File

@@ -243,8 +243,8 @@ bool CefValueImpl::GetBool() {
base::AutoLock lock_scope(lock_);
bool ret_value = false;
if (value_)
value_->GetAsBoolean(&ret_value);
if (value_ && value_->is_bool())
ret_value = value_->GetBool();
return ret_value;
}
@@ -252,8 +252,8 @@ int CefValueImpl::GetInt() {
base::AutoLock lock_scope(lock_);
int ret_value = 0;
if (value_)
value_->GetAsInteger(&ret_value);
if (value_ && value_->is_int())
ret_value = value_->GetInt();
return ret_value;
}
@@ -261,8 +261,8 @@ double CefValueImpl::GetDouble() {
base::AutoLock lock_scope(lock_);
double ret_value = 0;
if (value_)
value_->GetAsDouble(&ret_value);
if (value_ && value_->is_double())
ret_value = value_->GetDouble();
return ret_value;
}
@@ -270,8 +270,8 @@ CefString CefValueImpl::GetString() {
base::AutoLock lock_scope(lock_);
std::string ret_value;
if (value_)
value_->GetAsString(&ret_value);
if (value_ && value_->is_string())
ret_value = value_->GetString();
return ret_value;
}
@@ -691,7 +691,7 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::Copy(
size_t CefDictionaryValueImpl::GetSize() {
CEF_VALUE_VERIFY_RETURN(false, 0);
return const_value().size();
return const_value().DictSize();
}
bool CefDictionaryValueImpl::Clear() {
@@ -700,7 +700,7 @@ bool CefDictionaryValueImpl::Clear() {
// Detach any dependent values.
controller()->RemoveDependencies(mutable_value());
mutable_value()->Clear();
mutable_value()->DictClear();
return true;
}
@@ -728,10 +728,9 @@ bool CefDictionaryValueImpl::Remove(const CefString& key) {
CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, VTYPE_INVALID);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value)) {
switch (out_value->type()) {
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value) {
switch (value->type()) {
case base::Value::Type::NONE:
return VTYPE_NULL;
case base::Value::Type::BOOLEAN:
@@ -757,11 +756,10 @@ CefValueType CefDictionaryValueImpl::GetType(const CefString& key) {
CefRefPtr<CefValue> CefDictionaryValueImpl::GetValue(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value)) {
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value) {
return CefValueImpl::GetOrCreateRefOrCopy(
const_cast<base::Value*>(out_value),
const_cast<base::Value*>(value),
const_cast<base::DictionaryValue*>(&const_value()), read_only(),
controller());
}
@@ -772,11 +770,12 @@ CefRefPtr<CefValue> CefDictionaryValueImpl::GetValue(const CefString& key) {
bool CefDictionaryValueImpl::GetBool(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, false);
const base::Value* out_value = nullptr;
bool ret_value = false;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsBoolean(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_bool()) {
ret_value = value->GetBool();
}
return ret_value;
}
@@ -784,11 +783,12 @@ bool CefDictionaryValueImpl::GetBool(const CefString& key) {
int CefDictionaryValueImpl::GetInt(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, 0);
const base::Value* out_value = nullptr;
int ret_value = 0;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsInteger(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_int()) {
ret_value = value->GetInt();
}
return ret_value;
}
@@ -796,11 +796,12 @@ int CefDictionaryValueImpl::GetInt(const CefString& key) {
double CefDictionaryValueImpl::GetDouble(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, 0);
const base::Value* out_value = nullptr;
double ret_value = 0;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsDouble(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_double()) {
ret_value = value->GetDouble();
}
return ret_value;
}
@@ -808,11 +809,12 @@ double CefDictionaryValueImpl::GetDouble(const CefString& key) {
CefString CefDictionaryValueImpl::GetString(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, CefString());
const base::Value* out_value = nullptr;
std::string ret_value;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value))
out_value->GetAsString(&ret_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_string()) {
ret_value = value->GetString();
}
return ret_value;
}
@@ -821,12 +823,9 @@ CefRefPtr<CefBinaryValue> CefDictionaryValueImpl::GetBinary(
const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value) &&
out_value->is_blob()) {
base::Value* binary_value = const_cast<base::Value*>(out_value);
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_blob()) {
base::Value* binary_value = const_cast<base::Value*>(value);
return CefBinaryValueImpl::GetOrCreateRef(
binary_value, const_cast<base::DictionaryValue*>(&const_value()),
controller());
@@ -839,13 +838,10 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value) &&
out_value->is_dict()) {
base::DictionaryValue* dict_value = static_cast<base::DictionaryValue*>(
const_cast<base::Value*>(out_value));
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_dict()) {
base::DictionaryValue* dict_value =
static_cast<base::DictionaryValue*>(const_cast<base::Value*>(value));
return CefDictionaryValueImpl::GetOrCreateRef(
dict_value, const_cast<base::DictionaryValue*>(&const_value()),
read_only(), controller());
@@ -857,13 +853,10 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::GetDictionary(
CefRefPtr<CefListValue> CefDictionaryValueImpl::GetList(const CefString& key) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
const base::Value* out_value = nullptr;
if (const_value().GetWithoutPathExpansion(base::StringPiece(key),
&out_value) &&
out_value->is_list()) {
const base::Value* value = const_value().FindKey(base::StringPiece(key));
if (value && value->is_list()) {
base::ListValue* list_value =
static_cast<base::ListValue*>(const_cast<base::Value*>(out_value));
static_cast<base::ListValue*>(const_cast<base::Value*>(value));
return CefListValueImpl::GetOrCreateRef(
list_value, const_cast<base::DictionaryValue*>(&const_value()),
read_only(), controller());
@@ -952,18 +945,29 @@ bool CefDictionaryValueImpl::SetList(const CefString& key,
}
bool CefDictionaryValueImpl::RemoveInternal(const CefString& key) {
std::unique_ptr<base::Value> out_value;
if (!mutable_value()->RemoveWithoutPathExpansion(base::StringPiece(key),
&out_value)) {
// The ExtractKey() call below which removes the Value from the dictionary
// will return a new Value object with the moved contents of the Value that
// exists in the implementation std::map. Consequently we use FindKey() to
// retrieve the actual Value pointer as it current exists first, for later
// comparison purposes.
const base::Value* actual_value =
const_value().FindKey(base::StringPiece(key));
if (!actual_value)
return false;
// |actual_value| is no longer valid after this call.
absl::optional<base::Value> out_value =
mutable_value()->ExtractKey(base::StringPiece(key));
if (!out_value.has_value()) {
return false;
}
// Remove the value.
controller()->Remove(out_value.get(), true);
controller()->Remove(const_cast<base::Value*>(actual_value), true);
// Only list and dictionary types may have dependencies.
if (out_value->is_list() || out_value->is_dict()) {
controller()->RemoveDependencies(out_value.get());
controller()->RemoveDependencies(const_cast<base::Value*>(actual_value));
}
return true;
@@ -1126,7 +1130,7 @@ bool CefListValueImpl::Clear() {
// Detach any dependent values.
controller()->RemoveDependencies(mutable_value());
mutable_value()->Clear();
mutable_value()->ClearList();
return true;
}
@@ -1183,8 +1187,9 @@ bool CefListValueImpl::GetBool(size_t index) {
const base::Value* out_value = nullptr;
bool ret_value = false;
if (const_value().Get(index, &out_value))
out_value->GetAsBoolean(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_bool()) {
ret_value = out_value->GetBool();
}
return ret_value;
}
@@ -1195,8 +1200,9 @@ int CefListValueImpl::GetInt(size_t index) {
const base::Value* out_value = nullptr;
int ret_value = 0;
if (const_value().Get(index, &out_value))
out_value->GetAsInteger(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_int()) {
ret_value = out_value->GetInt();
}
return ret_value;
}
@@ -1207,8 +1213,9 @@ double CefListValueImpl::GetDouble(size_t index) {
const base::Value* out_value = nullptr;
double ret_value = 0;
if (const_value().Get(index, &out_value))
out_value->GetAsDouble(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_double()) {
ret_value = out_value->GetDouble();
}
return ret_value;
}
@@ -1219,8 +1226,9 @@ CefString CefListValueImpl::GetString(size_t index) {
const base::Value* out_value = nullptr;
std::string ret_value;
if (const_value().Get(index, &out_value))
out_value->GetAsString(&ret_value);
if (const_value().Get(index, &out_value) && out_value->is_string()) {
ret_value = out_value->GetString();
}
return ret_value;
}
@@ -1348,24 +1356,28 @@ bool CefListValueImpl::SetList(size_t index, CefRefPtr<CefListValue> value) {
}
bool CefListValueImpl::RemoveInternal(size_t index) {
// base::Value now uses move semantics which means that Remove() will return
// a new base::Value object with the moved contents of the base::Value that
// exists in the implementation std::vector. Consequently we use Get() to
// retrieve the actual base::Value pointer as it exists in the std::vector.
const base::Value* actual_value = nullptr;
if (!const_value().Get(index, &actual_value))
auto list = mutable_value()->GetList();
if (index >= list.size())
return false;
DCHECK(actual_value);
std::unique_ptr<base::Value> out_value;
if (!mutable_value()->Remove(index, &out_value))
// The std::move() call below which removes the Value from the list will
// return a new Value object with the moved contents of the Value that exists
// in the implementation std::vector. Consequently we use Get() to retrieve
// the actual Value pointer as it current exists first, for later comparison
// purposes.
const base::Value* actual_value = nullptr;
if (!const_value().Get(index, &actual_value) || !actual_value)
return false;
// |actual_value| is no longer valid after this call.
auto out_value = std::move(list[index]);
mutable_value()->EraseListIter(list.begin() + index);
// Remove the value.
controller()->Remove(const_cast<base::Value*>(actual_value), true);
// Only list and dictionary types may have dependencies.
if (out_value->is_list() || out_value->is_dict()) {
if (out_value.is_list() || out_value.is_dict()) {
controller()->RemoveDependencies(const_cast<base::Value*>(actual_value));
}
@@ -1375,10 +1387,13 @@ bool CefListValueImpl::RemoveInternal(size_t index) {
base::Value* CefListValueImpl::SetInternal(size_t index, base::Value* value) {
DCHECK(value);
if (RemoveInternal(index))
mutable_value()->Insert(index, base::WrapUnique(value));
else
if (RemoveInternal(index)) {
auto list = mutable_value()->GetList();
CHECK_LE(index, list.size());
mutable_value()->Insert(list.begin() + index, std::move(*value));
} else {
mutable_value()->Set(index, base::WrapUnique(value));
}
// base::Value now uses move semantics which means that Insert()/Set() will
// move the contents of the passed-in base::Value instead of keeping the same

View File

@@ -53,7 +53,7 @@ const char kWidevineCdmArch[] =
"x64";
#elif defined(ARCH_CPU_ARM64)
"arm64";
#else
#else
"???";
#endif
@@ -93,6 +93,7 @@ const char kCdmSupportedEncryptionSchemesName[] =
// parameter |kCdmCodecsListName|.
const char kCdmSupportedCodecVp8[] = "vp8";
const char kCdmSupportedCodecVp9[] = "vp09";
const char kCdmSupportedCodecAv1[] = "av01";
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
const char kCdmSupportedCodecAvc1[] = "avc1";
#endif
@@ -197,7 +198,7 @@ bool IsCompatibleWithChrome(const base::DictionaryValue& manifest,
// valid. Returns false and does not modify |video_codecs| if the manifest entry
// is incorrectly formatted.
bool GetCodecs(const base::DictionaryValue& manifest,
std::vector<media::VideoCodec>* video_codecs,
media::CdmCapability::VideoCodecMap* video_codecs,
std::string* error_message) {
DCHECK(video_codecs);
@@ -224,19 +225,22 @@ bool GetCodecs(const base::DictionaryValue& manifest,
return true;
}
std::vector<media::VideoCodec> result;
media::CdmCapability::VideoCodecMap result;
const std::vector<media::VideoCodecProfile> kAllProfiles = {};
const std::vector<base::StringPiece> supported_codecs =
base::SplitStringPiece(codecs, kCdmValueDelimiter, base::TRIM_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
for (const auto& codec : supported_codecs) {
if (codec == kCdmSupportedCodecVp8)
result.push_back(media::VideoCodec::kCodecVP8);
result.emplace(media::VideoCodec::kCodecVP8, kAllProfiles);
else if (codec == kCdmSupportedCodecVp9)
result.push_back(media::VideoCodec::kCodecVP9);
result.emplace(media::VideoCodec::kCodecVP9, kAllProfiles);
else if (codec == kCdmSupportedCodecAv1)
result.emplace(media::VideoCodec::kCodecAV1, kAllProfiles);
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
else if (codec == kCdmSupportedCodecAvc1)
result.push_back(media::VideoCodec::kCodecH264);
result.emplace(media::VideoCodec::kCodecH264, kAllProfiles);
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
}