| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 // No nested workers (for now) - connect() should only be called from docume
nt context. | 229 // No nested workers (for now) - connect() should only be called from docume
nt context. |
| 230 ASSERT(worker->scriptExecutionContext()->isDocument()); | 230 ASSERT(worker->scriptExecutionContext()->isDocument()); |
| 231 Document* document = toDocument(worker->scriptExecutionContext()); | 231 Document* document = toDocument(worker->scriptExecutionContext()); |
| 232 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); | 232 WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); |
| 233 OwnPtr<WebSharedWorker> webWorker; | 233 OwnPtr<WebSharedWorker> webWorker; |
| 234 webWorker = adoptPtr(webFrame->client()->createSharedWorker(webFrame, url, n
ame, getId(document))); | 234 webWorker = adoptPtr(webFrame->client()->createSharedWorker(webFrame, url, n
ame, getId(document))); |
| 235 | 235 |
| 236 if (!webWorker) { | 236 if (!webWorker) { |
| 237 // Existing worker does not match this url, so return an error back to t
he caller. | 237 // Existing worker does not match this url, so return an error back to t
he caller. |
| 238 es.throwDOMException(URLMismatchError); | 238 es.throwUninformativeAndGenericDOMException(URLMismatchError); |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 | 241 |
| 242 repository->addSharedWorker(webWorker.get(), getId(document)); | 242 repository->addSharedWorker(webWorker.get(), getId(document)); |
| 243 | 243 |
| 244 // The loader object manages its own lifecycle (and the lifecycles of the tw
o worker objects). | 244 // The loader object manages its own lifecycle (and the lifecycles of the tw
o worker objects). |
| 245 // It will free itself once loading is completed. | 245 // It will free itself once loading is completed. |
| 246 SharedWorkerScriptLoader* loader = new SharedWorkerScriptLoader(worker, url,
name, port, webWorker.release()); | 246 SharedWorkerScriptLoader* loader = new SharedWorkerScriptLoader(worker, url,
name, port, webWorker.release()); |
| 247 loader->load(); | 247 loader->load(); |
| 248 } | 248 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 260 } | 260 } |
| 261 | 261 |
| 262 bool SharedWorkerRepository::hasSharedWorkers(Document* document) | 262 bool SharedWorkerRepository::hasSharedWorkers(Document* document) |
| 263 { | 263 { |
| 264 WebKit::WebSharedWorkerRepository* repository = WebKit::sharedWorkerReposito
ry(); | 264 WebKit::WebSharedWorkerRepository* repository = WebKit::sharedWorkerReposito
ry(); |
| 265 | 265 |
| 266 return repository && repository->hasSharedWorkers(getId(document)); | 266 return repository && repository->hasSharedWorkers(getId(document)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace WebCore | 269 } // namespace WebCore |
| OLD | NEW |