OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2009, Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
(...skipping 16 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "ThreadableLoader.h" | 32 #include "ThreadableLoader.h" |
33 | 33 |
34 #include "DocumentThreadableLoader.h" | 34 #include "DocumentThreadableLoader.h" |
35 #include "Document.h" | 35 #include "Document.h" |
36 #include "Frame.h" | 36 #include "Frame.h" |
37 #include "FrameLoader.h" | 37 #include "FrameLoader.h" |
38 #include "ScriptExecutionContext.h" | 38 #include "ScriptExecutionContext.h" |
| 39 #include "WorkerContext.h" |
| 40 #include "WorkerThreadableLoader.h" |
39 | 41 |
40 namespace WebCore { | 42 namespace WebCore { |
41 | 43 |
42 PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* co
ntext, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallb
acks callbacksSetting, ContentSniff contentSniff) | 44 PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* co
ntext, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallb
acks callbacksSetting, ContentSniff contentSniff) |
43 { | 45 { |
44 ASSERT(client); | 46 ASSERT(client); |
45 ASSERT(context); | 47 ASSERT(context); |
| 48 |
| 49 #if ENABLE(WORKERS) |
| 50 if (context->isWorkerContext()) |
| 51 return WorkerThreadableLoader::create(static_cast<WorkerContext*>(contex
t), client, request, callbacksSetting, contentSniff); |
| 52 #endif // ENABLE(WORKERS) |
| 53 |
46 ASSERT(context->isDocument()); | 54 ASSERT(context->isDocument()); |
47 | |
48 return DocumentThreadableLoader::create(static_cast<Document*>(context), cli
ent, request, callbacksSetting, contentSniff); | 55 return DocumentThreadableLoader::create(static_cast<Document*>(context), cli
ent, request, callbacksSetting, contentSniff); |
49 } | 56 } |
50 | 57 |
51 unsigned long ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext
* context, const ResourceRequest& request, ResourceError& error, ResourceRespons
e& response, Vector<char>& data) | 58 unsigned long ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext
* context, const ResourceRequest& request, ResourceError& error, ResourceRespons
e& response, Vector<char>& data) |
52 { | 59 { |
53 ASSERT(context); | 60 ASSERT(context); |
54 ASSERT(context->isDocument()); | 61 ASSERT(context->isDocument()); |
55 | 62 |
56 Document* document = static_cast<Document*>(context); | 63 Document* document = static_cast<Document*>(context); |
57 if (!document->frame()) | 64 if (!document->frame()) |
58 return std::numeric_limits<unsigned long>::max(); | 65 return std::numeric_limits<unsigned long>::max(); |
59 return document->frame()->loader()->loadResourceSynchronously(request, error
, response, data); | 66 return document->frame()->loader()->loadResourceSynchronously(request, error
, response, data); |
60 } | 67 } |
61 | 68 |
62 } // namespace WebCore | 69 } // namespace WebCore |
OLD | NEW |