| 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 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>(documen
t); | 152 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>(documen
t); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void SharedWorkerRepositoryClientImpl::connect(PassRefPtr<SharedWorker> worker,
PassOwnPtr<WebMessagePortChannel> port, const KURL& url, const String& name, Exc
eptionState& exceptionState) | 155 void SharedWorkerRepositoryClientImpl::connect(PassRefPtr<SharedWorker> worker,
PassOwnPtr<WebMessagePortChannel> port, const KURL& url, const String& name, Exc
eptionState& exceptionState) |
| 156 { | 156 { |
| 157 ASSERT(m_client); | 157 ASSERT(m_client); |
| 158 | 158 |
| 159 // No nested workers (for now) - connect() should only be called from docume
nt context. | 159 // No nested workers (for now) - connect() should only be called from docume
nt context. |
| 160 ASSERT(worker->executionContext()->isDocument()); | 160 ASSERT(worker->executionContext()->isDocument()); |
| 161 Document* document = toDocument(worker->executionContext()); | 161 Document* document = toDocument(worker->executionContext()); |
| 162 OwnPtr<WebSharedWorkerConnector> webWorkerConnector = adoptPtr(m_client->cre
ateSharedWorkerConnector(url, name, getId(document))); | 162 OwnPtr<WebSharedWorkerConnector> webWorkerConnector = adoptPtr(m_client->cre
ateSharedWorkerConnector(url, name, getId(document), worker->executionContext()-
>contentSecurityPolicy()->deprecatedHeader(), static_cast<blink::WebContentSecur
ityPolicyType>(worker->executionContext()->contentSecurityPolicy()->deprecatedHe
aderType()))); |
| 163 if (!webWorkerConnector) { | 163 if (!webWorkerConnector) { |
| 164 // Existing worker does not match this url, so return an error back to t
he caller. | 164 // Existing worker does not match this url, so return an error back to t
he caller. |
| 165 exceptionState.throwDOMException(URLMismatchError, "The location of the
SharedWorker named '" + name + "' does not exactly match the provided URL ('" +
url.elidedString() + "')."); | 165 exceptionState.throwDOMException(URLMismatchError, "The location of the
SharedWorker named '" + name + "' does not exactly match the provided URL ('" +
url.elidedString() + "')."); |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 | 168 |
| 169 // The loader object manages its own lifecycle (and the lifecycles of the tw
o worker objects). | 169 // The loader object manages its own lifecycle (and the lifecycles of the tw
o worker objects). |
| 170 // It will free itself once loading is completed. | 170 // It will free itself once loading is completed. |
| 171 SharedWorkerScriptLoader* loader = new SharedWorkerScriptLoader(worker, url,
name, port, webWorkerConnector.release()); | 171 SharedWorkerScriptLoader* loader = new SharedWorkerScriptLoader(worker, url,
name, port, webWorkerConnector.release()); |
| 172 loader->load(); | 172 loader->load(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) | 175 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) |
| 176 { | 176 { |
| 177 ASSERT(m_client); | 177 ASSERT(m_client); |
| 178 m_client->documentDetached(getId(document)); | 178 m_client->documentDetached(getId(document)); |
| 179 } | 179 } |
| 180 | 180 |
| 181 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl(WebSharedWork
erRepositoryClient* client) | 181 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl(WebSharedWork
erRepositoryClient* client) |
| 182 : m_client(client) | 182 : m_client(client) |
| 183 { | 183 { |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace blink | 186 } // namespace blink |
| OLD | NEW |