本文整理汇总了C++中ExceptionState类的典型用法代码示例。如果您正苦于以下问题:C++ ExceptionState类的具体用法?C++ ExceptionState怎么用?C++ ExceptionState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ExceptionState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cancelScheduledValues
void AudioParamTimeline::cancelScheduledValues(double startTime, ExceptionState& exceptionState)
{
ASSERT(isMainThread());
if (!std::isfinite(startTime)) {
exceptionState.throwDOMException(
InvalidStateError,
"Time must be a finite number: " + String::number(startTime));
}
MutexLocker locker(m_eventsLock);
// Remove all events starting at startTime.
for (unsigned i = 0; i < m_events.size(); ++i) {
if (m_events[i].time() >= startTime) {
m_events.remove(i, m_events.size() - i);
break;
}
}
}
示例2: deleteForBinding
bool FontFaceSet::deleteForBinding(ScriptState*, FontFace* fontFace, ExceptionState& exceptionState)
{
if (!inActiveDocumentContext())
return false;
if (!fontFace) {
exceptionState.throwTypeError("The argument is not a FontFace.");
return false;
}
WillBeHeapListHashSet<RefPtrWillBeMember<FontFace>>::iterator it = m_nonCSSConnectedFaces.find(fontFace);
if (it != m_nonCSSConnectedFaces.end()) {
m_nonCSSConnectedFaces.remove(it);
CSSFontSelector* fontSelector = document()->styleEngine().fontSelector();
fontSelector->fontFaceCache()->removeFontFace(fontFace, false);
if (fontFace->loadStatus() == FontFace::Loading)
removeFromLoadingFonts(fontFace);
fontSelector->fontFaceInvalidated();
return true;
}
return false;
}
示例3: write
void FileWriterSync::write(Blob* data, ExceptionState& exceptionState)
{
ASSERT(writer());
ASSERT(m_complete);
if (!data) {
exceptionState.throwDOMException(TypeMismatchError, FileError::typeMismatchErrorMessage);
return;
}
prepareForWrite();
writer()->write(position(), data->uuid());
ASSERT(m_complete);
if (m_error) {
FileError::throwDOMException(exceptionState, m_error);
return;
}
setPosition(position() + data->size());
if (position() > length())
setLength(position());
}
示例4: abort
void IDBTransaction::abort(ExceptionState& es)
{
if (m_state == Finishing || m_state == Finished) {
es.throwDOMException(InvalidStateError, IDBDatabase::transactionFinishedErrorMessage);
return;
}
m_state = Finishing;
if (!m_contextStopped) {
while (!m_requestList.isEmpty()) {
RefPtr<IDBRequest> request = *m_requestList.begin();
m_requestList.remove(request);
request->abort();
}
}
RefPtr<IDBTransaction> selfRef = this;
backendDB()->abort(m_id);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:20,代码来源:IDBTransaction.cpp
示例5: continueFunction
void IDBCursor::continueFunction(IDBKey* key, IDBKey* primaryKey, ExceptionState& exceptionState)
{
ASSERT(!primaryKey || (key && primaryKey));
if (m_transaction->isFinished() || m_transaction->isFinishing()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
return;
}
if (!m_transaction->isActive()) {
exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
return;
}
if (!m_gotValue) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::noValueErrorMessage);
return;
}
if (isDeleted()) {
exceptionState.throwDOMException(InvalidStateError, IDBDatabase::sourceDeletedErrorMessage);
return;
}
if (key) {
ASSERT(m_key);
if (m_direction == WebIDBCursorDirectionNext || m_direction == WebIDBCursorDirectionNextNoDuplicate) {
const bool ok = m_key->isLessThan(key)
|| (primaryKey && m_key->isEqual(key) && m_primaryKey->isLessThan(primaryKey));
if (!ok) {
exceptionState.throwDOMException(DataError, "The parameter is less than or equal to this cursor's position.");
return;
}
} else {
const bool ok = key->isLessThan(m_key.get())
|| (primaryKey && key->isEqual(m_key.get()) && primaryKey->isLessThan(m_primaryKey.get()));
if (!ok) {
exceptionState.throwDOMException(DataError, "The parameter is greater than or equal to this cursor's position.");
return;
}
}
}
// FIXME: We're not using the context from when continue was called, which means the callback
// will be on the original context openCursor was called on. Is this right?
m_request->setPendingCursor(this);
m_gotValue = false;
m_backend->continueFunction(key, primaryKey, WebIDBCallbacksImpl::create(m_request).leakPtr());
}
示例6: document
PassRefPtrWillBeRawPtr<FontFaceSet> FontFaceSet::addForBinding(ScriptState*, FontFace* fontFace, ExceptionState& exceptionState)
{
if (!inActiveDocumentContext())
return this;
if (!fontFace) {
exceptionState.throwTypeError("The argument is not a FontFace.");
return this;
}
if (m_nonCSSConnectedFaces.contains(fontFace))
return this;
if (isCSSConnectedFontFace(fontFace))
return this;
CSSFontSelector* fontSelector = document()->styleEngine().fontSelector();
m_nonCSSConnectedFaces.add(fontFace);
fontSelector->fontFaceCache()->addFontFace(fontSelector, fontFace, false);
if (fontFace->loadStatus() == FontFace::Loading)
addToLoadingFonts(fontFace);
fontSelector->fontFaceInvalidated();
return this;
}
示例7: ASSERT
PassRefPtr<Database> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassOwnPtr<DatabaseCallback> creationCallback, ExceptionState& exceptionState)
{
if (!window.isCurrentlyDisplayedInFrame())
return nullptr;
RefPtr<Database> database = nullptr;
DatabaseManager& dbManager = DatabaseManager::manager();
DatabaseError error = DatabaseError::None;
if (RuntimeEnabledFeatures::databaseEnabled() && window.document()->securityOrigin()->canAccessDatabase()) {
String errorMessage;
database = dbManager.openDatabase(window.document(), name, version, displayName, estimatedSize, creationCallback, error, errorMessage);
ASSERT(database || error != DatabaseError::None);
if (error != DatabaseError::None)
DatabaseManager::throwExceptionForDatabaseError(error, errorMessage, exceptionState);
} else {
exceptionState.throwSecurityError("Access to the WebDatabase API is denied in this context.");
}
return database;
}
示例8: setChannelCount
void StereoPannerHandler::setChannelCount(unsigned long channelCount,
ExceptionState& exceptionState) {
DCHECK(isMainThread());
BaseAudioContext::AutoLocker locker(context());
// A PannerNode only supports 1 or 2 channels
if (channelCount > 0 && channelCount <= 2) {
if (m_channelCount != channelCount) {
m_channelCount = channelCount;
if (internalChannelCountMode() != Max)
updateChannelsForInputs();
}
} else {
exceptionState.throwDOMException(
NotSupportedError,
ExceptionMessages::indexOutsideRange<unsigned long>(
"channelCount", channelCount, 1, ExceptionMessages::InclusiveBound,
2, ExceptionMessages::InclusiveBound));
}
}
示例9: removeStream
void RTCPeerConnection::removeStream(PassRefPtr<MediaStream> prpStream, ExceptionState& exceptionState)
{
if (throwExceptionIfSignalingStateClosed(m_signalingState, exceptionState))
return;
if (!prpStream) {
exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::argumentNullOrIncorrectType(1, "MediaStream"));
return;
}
RefPtr<MediaStream> stream = prpStream;
size_t pos = m_localStreams.find(stream);
if (pos == kNotFound)
return;
m_localStreams.remove(pos);
m_peerHandler->removeStream(stream->descriptor());
}
示例10: convertValueFromPercentageToUserUnits
float SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLengthMode mode, ExceptionState& exceptionState) const
{
FloatSize viewportSize;
if (!determineViewport(viewportSize)) {
exceptionState.throwDOMException(NotSupportedError, "The viewport could not be determined.");
return 0;
}
switch (mode) {
case LengthModeWidth:
return value * viewportSize.width();
case LengthModeHeight:
return value * viewportSize.height();
case LengthModeOther:
return value * sqrtf(viewportSize.diagonalLengthSquared() / 2);
};
ASSERT_NOT_REACHED();
return 0;
}
示例11: validateAndFixup
bool DOMMatrixReadOnly::validateAndFixup(DOMMatrixInit& other,
ExceptionState& exceptionState) {
if (other.hasA() && other.hasM11() && other.a() != other.m11()) {
exceptionState.throwTypeError(getErrorMessage("a", "m11"));
return false;
}
if (other.hasB() && other.hasM12() && other.b() != other.m12()) {
exceptionState.throwTypeError(getErrorMessage("b", "m12"));
return false;
}
if (other.hasC() && other.hasM21() && other.c() != other.m21()) {
exceptionState.throwTypeError(getErrorMessage("c", "m21"));
return false;
}
if (other.hasD() && other.hasM22() && other.d() != other.m22()) {
exceptionState.throwTypeError(getErrorMessage("d", "m22"));
return false;
}
if (other.hasE() && other.hasM41() && other.e() != other.m41()) {
exceptionState.throwTypeError(getErrorMessage("e", "m41"));
return false;
}
if (other.hasF() && other.hasM42() && other.f() != other.m42()) {
exceptionState.throwTypeError(getErrorMessage("f", "m42"));
return false;
}
if (other.hasIs2D() && other.is2D() &&
(other.m31() || other.m32() || other.m13() || other.m23() ||
other.m43() || other.m14() || other.m24() || other.m34() ||
other.m33() != 1 || other.m44() != 1)) {
exceptionState.throwTypeError(
"The is2D member is set to true but the input matrix is 3d matrix.");
return false;
}
setDictionaryMembers(other);
if (!other.hasIs2D()) {
bool is2D = !(other.m31() || other.m32() || other.m13() || other.m23() ||
other.m43() || other.m14() || other.m24() || other.m34() ||
other.m33() != 1 || other.m44() != 1);
other.setIs2D(is2D);
}
return true;
}
示例12: setDisplayModeOverride
void InternalSettings::setDisplayModeOverride(const String& displayMode,
ExceptionState& exceptionState) {
InternalSettingsGuardForSettings();
String token = displayMode.stripWhiteSpace();
WebDisplayMode mode = WebDisplayModeBrowser;
if (token == "browser")
mode = WebDisplayModeBrowser;
else if (token == "minimal-ui")
mode = WebDisplayModeMinimalUi;
else if (token == "standalone")
mode = WebDisplayModeStandalone;
else if (token == "fullscreen")
mode = WebDisplayModeFullscreen;
else
exceptionState.throwDOMException(
SyntaxError, "The display-mode token ('" + token + ")' is invalid.");
settings()->setDisplayModeOverride(mode);
}
示例13: setTextTrackKindUserPreference
void InternalSettings::setTextTrackKindUserPreference(
const String& preference,
ExceptionState& exceptionState) {
InternalSettingsGuardForSettings();
String token = preference.stripWhiteSpace();
TextTrackKindUserPreference userPreference =
TextTrackKindUserPreference::Default;
if (token == "default")
userPreference = TextTrackKindUserPreference::Default;
else if (token == "captions")
userPreference = TextTrackKindUserPreference::Captions;
else if (token == "subtitles")
userPreference = TextTrackKindUserPreference::Subtitles;
else
exceptionState.throwDOMException(
SyntaxError, "The user preference for text track kind " + preference +
")' is invalid.");
settings()->setTextTrackKindUserPreference(userPreference);
}
示例14: release
void WebCLProgram::release(ExceptionState& es) {
cl_int err = 0;
if (m_cl_program == NULL) {
printf("Error: Invalid program object\n");
es.throwWebCLException(
WebCLException::INVALID_DEVICE,
WebCLException::invalidDeviceMessage);
return;
}
err = clReleaseProgram(m_cl_program);
if (err != CL_SUCCESS) {
WebCLException::throwException(err, es);
} else {
m_cl_program = NULL;
isReleased = true;
return;
}
return;
}
示例15: parseInternal
void SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end, ExceptionState& exceptionState)
{
clear();
while (ptr < end) {
const CharType* start = ptr;
while (ptr < end && *ptr != ',' && !isHTMLSpace<CharType>(*ptr))
ptr++;
if (ptr == start)
break;
RefPtr<SVGLength> length = SVGLength::create(m_mode);
String valueString(start, ptr - start);
if (valueString.isEmpty())
return;
length->setValueAsString(valueString, exceptionState);
if (exceptionState.hadException())
return;
append(length);
skipOptionalSVGSpacesOrDelimiter(ptr, end);
}
}