本文整理汇总了C++中setPendingActivity函数的典型用法代码示例。如果您正苦于以下问题:C++ setPendingActivity函数的具体用法?C++ setPendingActivity怎么用?C++ setPendingActivity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setPendingActivity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: setPendingActivity
void AudioContext::constructCommon()
{
// According to spec AudioContext must die only after page navigate.
// Lets mark it as ActiveDOMObject with pending activity and unmark it in clear method.
setPendingActivity(this);
#if USE(GSTREAMER)
initializeGStreamer();
#endif
FFTFrame::initialize();
m_listener = AudioListener::create();
#if PLATFORM(IOS)
if (!document()->settings() || document()->settings()->mediaPlaybackRequiresUserGesture())
addBehaviorRestriction(RequireUserGestureForAudioStartRestriction);
else
m_restrictions = NoRestrictions;
#endif
#if PLATFORM(MAC)
addBehaviorRestriction(RequirePageConsentForAudioStartRestriction);
#endif
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:25,代码来源:AudioContext.cpp
示例2: ActiveDOMObject
EventSource::EventSource(const String& url, ScriptExecutionContext* context, ExceptionCode& ec)
: ActiveDOMObject(context, this)
, m_state(CONNECTING)
, m_reconnectTimer(this, &EventSource::reconnectTimerFired)
, m_discardTrailingNewline(false)
, m_failSilently(false)
, m_requestInFlight(false)
, m_reconnectDelay(defaultReconnectDelay)
{
if (url.isEmpty() || !(m_url = context->completeURL(url)).isValid()) {
ec = SYNTAX_ERR;
return;
}
// FIXME: should support cross-origin requests
if (!scriptExecutionContext()->securityOrigin()->canRequest(m_url)) {
ec = SECURITY_ERR;
return;
}
m_origin = scriptExecutionContext()->securityOrigin()->toString();
m_decoder = TextResourceDecoder::create("text/plain", "UTF-8");
setPendingActivity(this);
connect();
}
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:25,代码来源:EventSource.cpp
示例3: ASSERT
bool XMLHttpRequest::initSend(ExceptionCode& ec)
{
if (!scriptExecutionContext())
return false;
if (m_state != OPENED || m_sendFlag) {
ec = INVALID_STATE_ERR;
return false;
}
ASSERT(!m_loader);
// FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
if (!scriptExecutionContext()->contentSecurityPolicy()->allowConnectToSource(m_url, scriptExecutionContext()->shouldBypassMainWorldContentSecurityPolicy())) {
if (m_async) {
setPendingActivity(this);
m_timeoutTimer.stop();
m_networkErrorTimer.startOneShot(0);
} else
ec = NETWORK_ERR;
return false;
}
m_error = false;
return true;
}
开发者ID:caiolima,项目名称:webkit,代码行数:25,代码来源:XMLHttpRequest.cpp
示例4: ASSERT
Optional<ExceptionOr<void>> XMLHttpRequest::prepareToSend()
{
// A return value other than Nullopt means we should not try to send, and we should return that value to the caller.
// Nullopt means we are ready to send and should continue with the send algorithm.
if (!scriptExecutionContext())
return ExceptionOr<void> { };
auto& context = *scriptExecutionContext();
if (m_state != OPENED || m_sendFlag)
return ExceptionOr<void> { Exception { INVALID_STATE_ERR } };
ASSERT(!m_loader);
// FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
if (!context.shouldBypassMainWorldContentSecurityPolicy() && !context.contentSecurityPolicy()->allowConnectToSource(m_url)) {
if (!m_async)
return ExceptionOr<void> { Exception { NETWORK_ERR } };
setPendingActivity(this);
m_timeoutTimer.stop();
m_networkErrorTimer.startOneShot(0);
return ExceptionOr<void> { };
}
m_error = false;
return Nullopt;
}
开发者ID:ollie314,项目名称:webkit,代码行数:27,代码来源:XMLHttpRequest.cpp
示例5: ASSERT
ExceptionOr<Ref<Worker>> Worker::create(ScriptExecutionContext& context, const String& url, JSC::RuntimeFlags runtimeFlags)
{
ASSERT(isMainThread());
// We don't currently support nested workers, so workers can only be created from documents.
ASSERT_WITH_SECURITY_IMPLICATION(context.isDocument());
auto worker = adoptRef(*new Worker(context, runtimeFlags));
worker->suspendIfNeeded();
bool shouldBypassMainWorldContentSecurityPolicy = context.shouldBypassMainWorldContentSecurityPolicy();
auto scriptURL = worker->resolveURL(url, shouldBypassMainWorldContentSecurityPolicy);
if (scriptURL.hasException())
return scriptURL.releaseException();
worker->m_shouldBypassMainWorldContentSecurityPolicy = shouldBypassMainWorldContentSecurityPolicy;
// The worker context does not exist while loading, so we must ensure that the worker object is not collected, nor are its event listeners.
worker->setPendingActivity(worker.ptr());
worker->m_scriptLoader = WorkerScriptLoader::create();
auto contentSecurityPolicyEnforcement = shouldBypassMainWorldContentSecurityPolicy ? ContentSecurityPolicyEnforcement::DoNotEnforce : ContentSecurityPolicyEnforcement::EnforceChildSrcDirective;
worker->m_scriptLoader->loadAsynchronously(&context, scriptURL.releaseReturnValue(), FetchOptions::Mode::SameOrigin, contentSecurityPolicyEnforcement, worker->m_identifier, worker.ptr());
return WTFMove(worker);
}
开发者ID:ollie314,项目名称:webkit,代码行数:26,代码来源:Worker.cpp
示例6: setPendingActivity
void Notification::show()
{
// prevent double-showing
if (m_state == Idle && m_notificationCenter->client() && m_notificationCenter->client()->show(this)) {
m_state = Showing;
setPendingActivity(this);
}
}
开发者ID:Moondee,项目名称:Artemis,代码行数:8,代码来源:Notification.cpp
示例7: ASSERT
void SharedWorkerScriptLoader::load(const KURL& url)
{
// Mark this object as active for the duration of the load.
ASSERT(!hasPendingActivity());
m_scriptLoader = new WorkerScriptLoader();
m_scriptLoader->loadAsynchronously(scriptExecutionContext(), url, DenyCrossOriginRedirect, this);
// Stay alive until the load finishes.
setPendingActivity(this);
}
开发者ID:halfkiss,项目名称:ComponentSuperAccessor,代码行数:10,代码来源:DefaultSharedWorkerRepository.cpp
示例8: setPendingActivity
void AudioContext::constructCommon()
{
ScriptWrappable::init(this);
// According to spec AudioContext must die only after page navigate.
// Lets mark it as ActiveDOMObject with pending activity and unmark it in clear method.
setPendingActivity(this);
FFTFrame::initialize();
m_listener = AudioListener::create();
}
开发者ID:huningxin,项目名称:blink-crosswalk,代码行数:11,代码来源:AudioContext.cpp
示例9: adoptRef
void FetchResponse::startFetching(ScriptExecutionContext& context, const FetchRequest& request, FetchPromise&& promise)
{
auto response = adoptRef(*new FetchResponse(context, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
// Setting pending activity until BodyLoader didFail or didSucceed callback is called.
response->setPendingActivity(response.ptr());
response->m_bodyLoader = BodyLoader(response.get(), WTFMove(promise));
if (!response->m_bodyLoader->start(context, request))
response->m_bodyLoader = Nullopt;
}
开发者ID:josecu,项目名称:webkit,代码行数:11,代码来源:FetchResponse.cpp
示例10: setPendingActivity
void Notification::startLoading()
{
if (m_state != Idle)
return;
setPendingActivity(this);
m_state = Loading;
ThreadableLoaderOptions options;
options.sendLoadCallbacks = false;
options.sniffContent = false;
options.forcePreflight = false;
options.allowCredentials = AllowStoredCredentials;
options.crossOriginRequestPolicy = AllowCrossOriginRequests;
m_loader = ThreadableLoader::create(scriptExecutionContext(), this, ResourceRequest(iconURL()), options);
}
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:14,代码来源:Notification.cpp
示例11: setPendingActivity
void AudioContext::constructCommon()
{
// According to spec AudioContext must die only after page navigate.
// Lets mark it as ActiveDOMObject with pending activity and unmark it in clear method.
setPendingActivity(this);
#if USE(GSTREAMER)
initializeGStreamer();
#endif
FFTFrame::initialize();
m_listener = AudioListener::create();
}
开发者ID:ZECTBynmo,项目名称:LabSound,代码行数:14,代码来源:AudioContext.cpp
示例12: dispatchErrorEvent
void Notification::show()
{
// prevent double-showing
if (m_state == Idle) {
if (!toDocument(scriptExecutionContext())->page())
return;
if (NotificationController::from(toDocument(scriptExecutionContext())->page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
dispatchErrorEvent();
return;
}
if (m_notificationClient->show(this)) {
m_state = Showing;
setPendingActivity(this);
}
}
}
开发者ID:huningxin,项目名称:blink-crosswalk,代码行数:16,代码来源:Notification.cpp
示例13: ENABLE
void Notification::show()
{
// prevent double-showing
if (m_state == Idle && m_notificationCenter->client()) {
#if ENABLE(NOTIFICATIONS)
if (!downcast<Document>(*scriptExecutionContext()).page())
return;
if (NotificationController::from(downcast<Document>(*scriptExecutionContext()).page())->client()->checkPermission(scriptExecutionContext()) != NotificationClient::PermissionAllowed) {
dispatchErrorEvent();
return;
}
#endif
if (m_notificationCenter->client()->show(this)) {
m_state = Showing;
setPendingActivity(this);
}
}
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:18,代码来源:Notification.cpp
示例14: ASSERT
void XMLHttpRequest::loadRequestAsynchronously(ResourceRequest& request)
{
ASSERT(m_async);
m_exceptionCode = 0;
// SubresourceLoader::create can return null here, for example if we're no longer attached to a page.
// This is true while running onunload handlers.
// FIXME: We need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>.
// FIXME: Maybe create can return null for other reasons too?
LoadCallbacks callbacks = m_inPreflight ? DoNotSendLoadCallbacks : SendLoadCallbacks;
StoredCredentials storedCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
if (m_upload)
request.setReportUploadProgress(true);
m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, callbacks, DoNotSniffContent, storedCredentials);
if (m_loader) {
// Neither this object nor the JavaScript wrapper should be deleted while
// a request is in progress because we need to keep the listeners alive,
// and they are referenced by the JavaScript wrapper.
setPendingActivity(this);
}
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:23,代码来源:XMLHttpRequest.cpp
示例15: ActiveDOMObject
Worker::Worker(const String& url, Document* doc, ExceptionCode& ec)
: ActiveDOMObject(doc, this)
, m_messagingProxy(new WorkerMessagingProxy(doc, this))
{
m_scriptURL = doc->completeURL(url);
if (url.isEmpty() || !m_scriptURL.isValid()) {
ec = SYNTAX_ERR;
return;
}
if (!doc->securityOrigin()->canAccess(SecurityOrigin::create(m_scriptURL).get())) {
ec = SECURITY_ERR;
return;
}
m_cachedScript = doc->docLoader()->requestScript(m_scriptURL, document()->charset());
if (!m_cachedScript) {
dispatchErrorEvent();
return;
}
setPendingActivity(this); // The worker context does not exist while loading, so we much ensure that the worker object is not collected, as well as its event listeners.
m_cachedScript->addClient(this);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:24,代码来源:Worker.cpp
示例16: setPendingActivity
void DOMFileSystem::addPendingCallbacks()
{
setPendingActivity(this);
}
开发者ID:huningxin,项目名称:blink-crosswalk,代码行数:4,代码来源:DOMFileSystem.cpp
示例17: setPendingActivity
void SharedWorker::setPreventGC()
{
setPendingActivity(this);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:4,代码来源:SharedWorker.cpp
示例18: securityOrigin
void XMLHttpRequest::createRequest(ExceptionCode& ec)
{
// Only GET request is supported for blob URL.
if (!m_async && m_url.protocolIsBlob() && m_method != "GET") {
ec = NETWORK_ERR;
return;
}
m_sendFlag = true;
// The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not
// permit cross origin requests should look exactly like POSTing to an URL that does not respond at all.
// Also, only async requests support upload progress events.
bool uploadEvents = false;
if (m_async) {
m_progressEventThrottle.dispatchProgressEvent(eventNames().loadstartEvent);
if (m_requestEntityBody && m_upload) {
uploadEvents = m_upload->hasEventListeners();
m_upload->dispatchProgressEvent(eventNames().loadstartEvent);
}
}
m_sameOriginRequest = securityOrigin()->canRequest(m_url);
// We also remember whether upload events should be allowed for this request in case the upload listeners are
// added after the request is started.
m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders);
ResourceRequest request(m_url);
request.setRequester(ResourceRequest::Requester::XHR);
request.setHTTPMethod(m_method);
if (m_requestEntityBody) {
ASSERT(m_method != "GET");
ASSERT(m_method != "HEAD");
request.setHTTPBody(WTFMove(m_requestEntityBody));
}
if (!m_requestHeaders.isEmpty())
request.setHTTPHeaderFields(m_requestHeaders);
ThreadableLoaderOptions options;
options.setSendLoadCallbacks(SendCallbacks);
options.setSniffContent(DoNotSniffContent);
options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight;
options.setAllowCredentials((m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials);
options.setCredentialRequest(m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials);
options.crossOriginRequestPolicy = UseAccessControl;
options.securityOrigin = securityOrigin();
options.contentSecurityPolicyEnforcement = scriptExecutionContext()->shouldBypassMainWorldContentSecurityPolicy() ? ContentSecurityPolicyEnforcement::DoNotEnforce : ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective;
options.initiator = cachedResourceRequestInitiators().xmlhttprequest;
if (m_timeoutMilliseconds) {
if (!m_async)
request.setTimeoutInterval(m_timeoutMilliseconds / 1000.0);
else {
m_sendingTime = std::chrono::steady_clock::now();
m_timeoutTimer.startOneShot(std::chrono::milliseconds { m_timeoutMilliseconds });
}
}
m_exceptionCode = 0;
m_error = false;
if (m_async) {
if (m_upload)
request.setReportUploadProgress(true);
// ThreadableLoader::create can return null here, for example if we're no longer attached to a page or if a content blocker blocks the load.
// This is true while running onunload handlers.
// FIXME: Maybe we need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>.
m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options);
// Neither this object nor the JavaScript wrapper should be deleted while
// a request is in progress because we need to keep the listeners alive,
// and they are referenced by the JavaScript wrapper.
setPendingActivity(this);
if (!m_loader) {
m_sendFlag = false;
m_timeoutTimer.stop();
m_networkErrorTimer.startOneShot(0);
}
} else {
InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options);
InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext());
}
if (!m_exceptionCode && m_error)
m_exceptionCode = NETWORK_ERR;
ec = m_exceptionCode;
}
开发者ID:caiolima,项目名称:webkit,代码行数:92,代码来源:XMLHttpRequest.cpp
示例19: ENABLE
void XMLHttpRequest::createRequest(ExceptionCode& ec)
{
#if ENABLE(BLOB)
// Only GET request is supported for blob URL.
if (m_url.protocolIs("blob") && m_method != "GET") {
ec = XMLHttpRequestException::NETWORK_ERR;
return;
}
#endif
// The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not
// permit cross origin requests should look exactly like POSTing to an URL that does not respond at all.
// Also, only async requests support upload progress events.
bool uploadEvents = false;
if (m_async) {
m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
if (m_requestEntityBody && m_upload) {
uploadEvents = m_upload->hasEventListeners();
m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent));
}
}
m_sameOriginRequest = securityOrigin()->canRequest(m_url);
// We also remember whether upload events should be allowed for this request in case the upload listeners are
// added after the request is started.
m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders);
ResourceRequest request(m_url);
request.setHTTPMethod(m_method);
#if PLATFORM(CHROMIUM)
request.setTargetType(ResourceRequest::TargetIsXHR);
#endif
if (m_requestEntityBody) {
ASSERT(m_method != "GET");
ASSERT(m_method != "HEAD");
request.setHTTPBody(m_requestEntityBody.release());
}
if (m_requestHeaders.size() > 0)
request.addHTTPHeaderFields(m_requestHeaders);
ThreadableLoaderOptions options;
options.sendLoadCallbacks = SendCallbacks;
options.sniffContent = DoNotSniffContent;
options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight;
options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
options.crossOriginRequestPolicy = UseAccessControl;
options.securityOrigin = securityOrigin();
m_exceptionCode = 0;
m_error = false;
if (m_async) {
if (m_upload)
request.setReportUploadProgress(true);
// ThreadableLoader::create can return null here, for example if we're no longer attached to a page.
// This is true while running onunload handlers.
// FIXME: Maybe we need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>.
// FIXME: Maybe create() can return null for other reasons too?
m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options);
if (m_loader) {
// Neither this object nor the JavaScript wrapper should be deleted while
// a request is in progress because we need to keep the listeners alive,
// and they are referenced by the JavaScript wrapper.
setPendingActivity(this);
}
} else {
InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options);
InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext());
}
if (!m_exceptionCode && m_error)
m_exceptionCode = XMLHttpRequestException::NETWORK_ERR;
ec = m_exceptionCode;
}
开发者ID:jparound30,项目名称:webkit,代码行数:79,代码来源:XMLHttpRequest.cpp
示例20: setPendingActivity
void MediaSource::addedToRegistry()
{
setPendingActivity(this);
}
开发者ID:edcwconan,项目名称:webkit,代码行数:4,代码来源:MediaSource.cpp
注:本文中的setPendingActivity函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论