| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
| 39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 WorkerScriptLoader::WorkerScriptLoader() | 43 WorkerScriptLoader::WorkerScriptLoader() |
| 44 : m_client(0) | 44 : m_client(0) |
| 45 , m_failed(false) | 45 , m_failed(false) |
| 46 , m_identifier(0) | 46 , m_identifier(0) |
| 47 , m_finishing(false) | 47 , m_finishing(false) |
| 48 , m_targetType(ResourceRequest::TargetIsWorker) | 48 , m_requestContext(ResourceRequest::WorkerContext) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 WorkerScriptLoader::~WorkerScriptLoader() | 52 WorkerScriptLoader::~WorkerScriptLoader() |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 void WorkerScriptLoader::loadSynchronously(ExecutionContext& executionContext, c
onst KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy) | 56 void WorkerScriptLoader::loadSynchronously(ExecutionContext& executionContext, c
onst KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy) |
| 57 { | 57 { |
| 58 m_url = url; | 58 m_url = url; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const KURL& WorkerScriptLoader::responseURL() const | 98 const KURL& WorkerScriptLoader::responseURL() const |
| 99 { | 99 { |
| 100 ASSERT(!failed()); | 100 ASSERT(!failed()); |
| 101 return m_responseURL; | 101 return m_responseURL; |
| 102 } | 102 } |
| 103 | 103 |
| 104 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() | 104 PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() |
| 105 { | 105 { |
| 106 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest(m_url)); | 106 OwnPtr<ResourceRequest> request = adoptPtr(new ResourceRequest(m_url)); |
| 107 request->setHTTPMethod("GET"); | 107 request->setHTTPMethod("GET"); |
| 108 request->setTargetType(m_targetType); | 108 request->setRequestContext(m_requestContext); |
| 109 return request.release(); | 109 return request.release(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const Reso
urceResponse& response) | 112 void WorkerScriptLoader::didReceiveResponse(unsigned long identifier, const Reso
urceResponse& response) |
| 113 { | 113 { |
| 114 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { | 114 if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) { |
| 115 m_failed = true; | 115 m_failed = true; |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 m_responseURL = response.url(); | 118 m_responseURL = response.url(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void WorkerScriptLoader::notifyFinished() | 186 void WorkerScriptLoader::notifyFinished() |
| 187 { | 187 { |
| 188 if (!m_client || m_finishing) | 188 if (!m_client || m_finishing) |
| 189 return; | 189 return; |
| 190 | 190 |
| 191 m_finishing = true; | 191 m_finishing = true; |
| 192 m_client->notifyFinished(); | 192 m_client->notifyFinished(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace WebCore | 195 } // namespace WebCore |
| OLD | NEW |