| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 void SharedWorkerConnector::scriptLoadFailed() | 98 void SharedWorkerConnector::scriptLoadFailed() |
| 99 { | 99 { |
| 100 m_worker->dispatchEvent(Event::createCancelable(EventTypeNames::error)); | 100 m_worker->dispatchEvent(Event::createCancelable(EventTypeNames::error)); |
| 101 // Free ourselves (this releases the SharedWorker so it can be freed as well
if unreferenced). | 101 // Free ourselves (this releases the SharedWorker so it can be freed as well
if unreferenced). |
| 102 delete this; | 102 delete this; |
| 103 } | 103 } |
| 104 | 104 |
| 105 static WebSharedWorkerRepositoryClient::DocumentID getId(void* document) | 105 static WebSharedWorkerRepositoryClient::DocumentID getId(void* document) |
| 106 { | 106 { |
| 107 ASSERT(document); | 107 DCHECK(document); |
| 108 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>(documen
t); | 108 return reinterpret_cast<WebSharedWorkerRepositoryClient::DocumentID>(documen
t); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void SharedWorkerRepositoryClientImpl::connect(SharedWorker* worker, PassOwnPtr<
WebMessagePortChannel> port, const KURL& url, const String& name, ExceptionState
& exceptionState) | 111 void SharedWorkerRepositoryClientImpl::connect(SharedWorker* worker, PassOwnPtr<
WebMessagePortChannel> port, const KURL& url, const String& name, ExceptionState
& exceptionState) |
| 112 { | 112 { |
| 113 ASSERT(m_client); | 113 DCHECK(m_client); |
| 114 | 114 |
| 115 // No nested workers (for now) - connect() should only be called from docume
nt context. | 115 // No nested workers (for now) - connect() should only be called from docume
nt context. |
| 116 ASSERT(worker->getExecutionContext()->isDocument()); | 116 DCHECK(worker->getExecutionContext()->isDocument()); |
| 117 Document* document = toDocument(worker->getExecutionContext()); | 117 Document* document = toDocument(worker->getExecutionContext()); |
| 118 | 118 |
| 119 // TODO(estark): this is broken, as it only uses the first header | 119 // TODO(estark): this is broken, as it only uses the first header |
| 120 // when multiple might have been sent. Fix by making the | 120 // when multiple might have been sent. Fix by making the |
| 121 // SharedWorkerConnector interface take a map that can contain | 121 // SharedWorkerConnector interface take a map that can contain |
| 122 // multiple headers. | 122 // multiple headers. |
| 123 OwnPtr<Vector<CSPHeaderAndType>> headers = worker->getExecutionContext()->co
ntentSecurityPolicy()->headers(); | 123 OwnPtr<Vector<CSPHeaderAndType>> headers = worker->getExecutionContext()->co
ntentSecurityPolicy()->headers(); |
| 124 WebString header; | 124 WebString header; |
| 125 WebContentSecurityPolicyType headerType = WebContentSecurityPolicyTypeReport
; | 125 WebContentSecurityPolicyType headerType = WebContentSecurityPolicyTypeReport
; |
| 126 | 126 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 148 } | 148 } |
| 149 | 149 |
| 150 // The connector object manages its own lifecycle (and the lifecycles of the
two worker objects). | 150 // The connector object manages its own lifecycle (and the lifecycles of the
two worker objects). |
| 151 // It will free itself once connecting is completed. | 151 // It will free itself once connecting is completed. |
| 152 SharedWorkerConnector* connector = new SharedWorkerConnector(worker, url, na
me, port, webWorkerConnector.release()); | 152 SharedWorkerConnector* connector = new SharedWorkerConnector(worker, url, na
me, port, webWorkerConnector.release()); |
| 153 connector->connect(); | 153 connector->connect(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) | 156 void SharedWorkerRepositoryClientImpl::documentDetached(Document* document) |
| 157 { | 157 { |
| 158 ASSERT(m_client); | 158 DCHECK(m_client); |
| 159 m_client->documentDetached(getId(document)); | 159 m_client->documentDetached(getId(document)); |
| 160 } | 160 } |
| 161 | 161 |
| 162 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl(WebSharedWork
erRepositoryClient* client) | 162 SharedWorkerRepositoryClientImpl::SharedWorkerRepositoryClientImpl(WebSharedWork
erRepositoryClient* client) |
| 163 : m_client(client) | 163 : m_client(client) |
| 164 { | 164 { |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |