diff options
Diffstat (limited to 'WebCore/loader/ThreadableLoader.cpp')
-rw-r--r-- | WebCore/loader/ThreadableLoader.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/WebCore/loader/ThreadableLoader.cpp b/WebCore/loader/ThreadableLoader.cpp index 0f22fbe..1b2cc88 100644 --- a/WebCore/loader/ThreadableLoader.cpp +++ b/WebCore/loader/ThreadableLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Google Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -31,11 +31,12 @@ #include "config.h" #include "ThreadableLoader.h" -#include "DocumentThreadableLoader.h" -#include "Document.h" -#include "Frame.h" -#include "FrameLoader.h" #include "ScriptExecutionContext.h" +#include "Document.h" +#include "DocumentThreadableLoader.h" +#include "WorkerContext.h" +#include "WorkerRunLoop.h" +#include "WorkerThreadableLoader.h" namespace WebCore { @@ -43,20 +44,29 @@ PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* co { ASSERT(client); ASSERT(context); - ASSERT(context->isDocument()); +#if ENABLE(WORKERS) + if (context->isWorkerContext()) + return WorkerThreadableLoader::create(static_cast<WorkerContext*>(context), client, WorkerRunLoop::defaultMode(), request, callbacksSetting, contentSniff); +#endif // ENABLE(WORKERS) + + ASSERT(context->isDocument()); return DocumentThreadableLoader::create(static_cast<Document*>(context), client, request, callbacksSetting, contentSniff); } -unsigned long ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ResourceError& error, ResourceResponse& response, Vector<char>& data) +void ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client) { ASSERT(context); - ASSERT(context->isDocument()); - Document* document = static_cast<Document*>(context); - if (!document->frame()) - return std::numeric_limits<unsigned long>::max(); - return document->frame()->loader()->loadResourceSynchronously(request, error, response, data); +#if ENABLE(WORKERS) + if (context->isWorkerContext()) { + WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(context), request, client); + return; + } +#endif // ENABLE(WORKERS) + + ASSERT(context->isDocument()); + DocumentThreadableLoader::loadResourceSynchronously(static_cast<Document*>(context), request, client); } } // namespace WebCore |