当前位置: 首页>>代码示例>>C++>>正文


C++ EventSource::scheduleInitialConnect方法代码示例

本文整理汇总了C++中EventSource::scheduleInitialConnect方法的典型用法代码示例。如果您正苦于以下问题:C++ EventSource::scheduleInitialConnect方法的具体用法?C++ EventSource::scheduleInitialConnect怎么用?C++ EventSource::scheduleInitialConnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventSource的用法示例。


在下文中一共展示了EventSource::scheduleInitialConnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: create

EventSource* EventSource::create(ExecutionContext* context, const String& url, const EventSourceInit& eventSourceInit, ExceptionState& exceptionState)
{
    if (url.isEmpty()) {
        exceptionState.throwDOMException(SyntaxError, "Cannot open an EventSource to an empty URL.");
        return nullptr;
    }

    KURL fullURL = context->completeURL(url);
    if (!fullURL.isValid()) {
        exceptionState.throwDOMException(SyntaxError, "Cannot open an EventSource to '" + url + "'. The URL is invalid.");
        return nullptr;
    }

    // FIXME: Convert this to check the isolated world's Content Security Policy once webkit.org/b/104520 is solved.
    if (!ContentSecurityPolicy::shouldBypassMainWorld(context) && !context->contentSecurityPolicy()->allowConnectToSource(fullURL)) {
        // We can safely expose the URL to JavaScript, as this exception is generate synchronously before any redirects take place.
        exceptionState.throwSecurityError("Refused to connect to '" + fullURL.elidedString() + "' because it violates the document's Content Security Policy.");
        return nullptr;
    }

    EventSource* source = new EventSource(context, fullURL, eventSourceInit);

    source->scheduleInitialConnect();
    source->suspendIfNeeded();
    return source;
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:26,代码来源:EventSource.cpp

示例2: create

EventSource* EventSource::create(const String& url, IEventSourceReceiver* receiver, const Hashtable<String,String>& eventSourceInit )
{

    LOG(TRACE) + "Creating EventSource with URL: " + url;

    if (url.empty()) {
        return 0;
    }

    String fullUrl(
      (url.find("://")==String::npos)?
        (RHODESAPP().getCurrentUrl(-1) + url):
        (url)
    );

    LOG(TRACE) + "Full URL for EventSource: " + fullUrl;

    EventSource* source = new EventSource(fullUrl, receiver, eventSourceInit);

    source->scheduleInitialConnect();

    return source;
}
开发者ID:Gaurav2728,项目名称:rhodes,代码行数:23,代码来源:EventSource.cpp


注:本文中的EventSource::scheduleInitialConnect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。