This source file includes following definitions.
- create
- loadResourceSynchronously
#include "config.h"
#include "core/loader/ThreadableLoader.h"
#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
#include "core/loader/DocumentThreadableLoader.h"
#include "core/loader/ThreadableLoaderClientWrapper.h"
#include "core/loader/WorkerLoaderClientBridge.h"
#include "core/loader/WorkerThreadableLoader.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerRunLoop.h"
#include "core/workers/WorkerThread.h"
namespace WebCore {
PassRefPtr<ThreadableLoader> ThreadableLoader::create(ExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options)
{
ASSERT(client);
ASSERT(context);
if (context->isWorkerGlobalScope()) {
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
RefPtr<ThreadableLoaderClientWrapper> clientWrapper(ThreadableLoaderClientWrapper::create(client));
OwnPtr<ThreadableLoaderClient> clientBridge(WorkerLoaderClientBridge::create(clientWrapper, workerGlobalScope->thread()->workerLoaderProxy()));
return WorkerThreadableLoader::create(workerGlobalScope, clientWrapper, clientBridge.release(), request, options);
}
return DocumentThreadableLoader::create(toDocument(context), client, request, options);
}
void ThreadableLoader::loadResourceSynchronously(ExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options)
{
ASSERT(context);
if (context->isWorkerGlobalScope()) {
WorkerThreadableLoader::loadResourceSynchronously(toWorkerGlobalScope(context), request, client, options);
return;
}
DocumentThreadableLoader::loadResourceSynchronously(toDocument(context), request, client, options);
}
}