| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2010 Apple 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 are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 { | 58 { |
| 59 ASSERT(isMainThread()); | 59 ASSERT(isMainThread()); |
| 60 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); | 60 ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); |
| 61 | 61 |
| 62 UseCounter::count(context, UseCounter::SharedWorkerStart); | 62 UseCounter::count(context, UseCounter::SharedWorkerStart); |
| 63 | 63 |
| 64 RefPtrWillBeRawPtr<SharedWorker> worker = adoptRefWillBeNoop(new SharedWorke
r(context)); | 64 RefPtrWillBeRawPtr<SharedWorker> worker = adoptRefWillBeNoop(new SharedWorke
r(context)); |
| 65 | 65 |
| 66 MessageChannel* channel = MessageChannel::create(context); | 66 MessageChannel* channel = MessageChannel::create(context); |
| 67 worker->m_port = channel->port1(); | 67 worker->m_port = channel->port1(); |
| 68 OwnPtr<blink::WebMessagePortChannel> remotePort = channel->port2()->disentan
gle(); | 68 OwnPtr<WebMessagePortChannel> remotePort = channel->port2()->disentangle(); |
| 69 ASSERT(remotePort); | 69 ASSERT(remotePort); |
| 70 | 70 |
| 71 worker->suspendIfNeeded(); | 71 worker->suspendIfNeeded(); |
| 72 | 72 |
| 73 // We don't currently support nested workers, so workers can only be created
from documents. | 73 // We don't currently support nested workers, so workers can only be created
from documents. |
| 74 Document* document = toDocument(context); | 74 Document* document = toDocument(context); |
| 75 if (!document->securityOrigin()->canAccessSharedWorkers()) { | 75 if (!document->securityOrigin()->canAccessSharedWorkers()) { |
| 76 exceptionState.throwSecurityError("Access to shared workers is denied to
origin '" + document->securityOrigin()->toString() + "'."); | 76 exceptionState.throwSecurityError("Access to shared workers is denied to
origin '" + document->securityOrigin()->toString() + "'."); |
| 77 return nullptr; | 77 return nullptr; |
| 78 } | 78 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 DEFINE_TRACE(SharedWorker) | 104 DEFINE_TRACE(SharedWorker) |
| 105 { | 105 { |
| 106 #if ENABLE(OILPAN) | 106 #if ENABLE(OILPAN) |
| 107 visitor->trace(m_port); | 107 visitor->trace(m_port); |
| 108 HeapSupplementable<SharedWorker>::trace(visitor); | 108 HeapSupplementable<SharedWorker>::trace(visitor); |
| 109 #endif | 109 #endif |
| 110 AbstractWorker::trace(visitor); | 110 AbstractWorker::trace(visitor); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace blink | 113 } // namespace blink |
| OLD | NEW |