本文整理汇总了C++中AtomicString::utf8方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomicString::utf8方法的具体用法?C++ AtomicString::utf8怎么用?C++ AtomicString::utf8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomicString
的用法示例。
在下文中一共展示了AtomicString::utf8方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMode
void SourceBuffer::setMode(const AtomicString& newMode, ExceptionState& exceptionState)
{
WTF_LOG(Media, "SourceBuffer::setMode %p newMode=%s", this, newMode.utf8().data());
// Section 3.1 On setting mode attribute steps.
// 1. Let new mode equal the new value being assigned to this attribute.
// 2. If this object has been removed from the sourceBuffers attribute of the parent media source, then throw
// an INVALID_STATE_ERR exception and abort these steps.
// 3. If the updating attribute equals true, then throw an INVALID_STATE_ERR exception and abort these steps.
if (throwExceptionIfRemovedOrUpdating(isRemoved(), m_updating, exceptionState))
return;
// 4. If the readyState attribute of the parent media source is in the "ended" state then run the following steps:
// 4.1 Set the readyState attribute of the parent media source to "open"
// 4.2 Queue a task to fire a simple event named sourceopen at the parent media source.
m_source->openIfInEndedState();
// 5. If the append state equals PARSING_MEDIA_SEGMENT, then throw an INVALID_STATE_ERR and abort these steps.
// 6. If the new mode equals "sequence", then set the group start timestamp to the highest presentation end timestamp.
WebSourceBuffer::AppendMode appendMode = WebSourceBuffer::AppendModeSegments;
if (newMode == sequenceKeyword())
appendMode = WebSourceBuffer::AppendModeSequence;
if (!m_webSourceBuffer->setMode(appendMode)) {
MediaSource::logAndThrowDOMException(exceptionState, InvalidStateError, "The mode may not be set while the SourceBuffer's append state is 'PARSING_MEDIA_SEGMENT'.");
return;
}
// 7. Update the attribute to new mode.
m_mode = newMode;
}
示例2: namedPropertyGetter
static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info) {
const CString& nameInUtf8 = name.utf8();
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "TestInterface2", nameInUtf8.data());
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
TestInterfaceEmpty* result = impl->namedItem(name, exceptionState);
if (!result)
return;
v8SetReturnValueFast(info, result, impl);
}
示例3: namedPropertyQuery
static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
const CString& nameInUtf8 = name.utf8();
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "TestSpecialOperations", nameInUtf8.data());
TestSpecialOperations* impl = V8TestSpecialOperations::toImpl(info.Holder());
bool result = impl->namedPropertyQuery(name, exceptionState);
if (!result)
return;
v8SetReturnValueInt(info, v8::None);
}
示例4: namedPropertyDeleter
static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
const CString& nameInUtf8 = name.utf8();
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::DeletionContext, "TestInterface2", nameInUtf8.data());
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
DeleteResult result = impl->deleteNamedItem(name, exceptionState);
if (exceptionState.hadException())
return;
if (result == DeleteUnknownProperty)
return;
v8SetReturnValue(info, result == DeleteSuccess);
}
示例5: namedPropertySetter
static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
const CString& nameInUtf8 = name.utf8();
ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "TestInterface2", nameInUtf8.data());
TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeCheck(info.GetIsolate(), v8Value);
if (!propertyValue && !isUndefinedOrNull(v8Value)) {
exceptionState.throwTypeError("The provided value is not of type 'TestInterfaceEmpty'.");
return;
}
bool result = impl->setNamedItem(name, propertyValue, exceptionState);
if (exceptionState.hadException())
return;
if (!result)
return;
v8SetReturnValue(info, v8Value);
}
示例6: RefDefault
sk_sp<SkTypeface> FontCache::createTypeface(
const FontDescription& fontDescription,
const FontFaceCreationParams& creationParams,
CString& name) {
AtomicString family = creationParams.family();
if (family.isEmpty()) {
name = getFallbackFontFamily(fontDescription).string().utf8();
} else {
name = family.utf8();
}
fonts::FontRequest request;
request.family = name.data();
request.weight = ToIntegerWeight(fontDescription.weight());
request.width = static_cast<uint32_t>(fontDescription.stretch());
request.slant = ToFontSlant(fontDescription.style());
fonts::FontResponsePtr response;
auto& font_provider = GetFontProvider();
font_provider->GetFont(
std::move(request),
[&response](fonts::FontResponsePtr r) { response = std::move(r); });
font_provider.WaitForResponse();
FXL_DCHECK(response)
<< "Unable to contact the font provider. Did you run "
"Flutter in an environment that has a font manager?\n"
"See <https://fuchsia.googlesource.com/modular/+/master/README.md>.";
if (!response)
return nullptr;
sk_sp<SkData> data = MakeSkDataFromBuffer(response->data.buffer);
if (!data)
return nullptr;
return SkFontMgr::RefDefault()->makeFromData(std::move(data));
}