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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 PassRefPtrWillBeRawPtr<SharedWorker> SharedWorker::create(ExecutionContext* cont
ext, const String& url, const String& name, ExceptionState& exceptionState) | 57 PassRefPtrWillBeRawPtr<SharedWorker> SharedWorker::create(ExecutionContext* cont
ext, const String& url, const String& name, ExceptionState& exceptionState) |
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 = adoptRefWillBeRefCountedGarbageCol
lected(new SharedWorker(context)); | 64 RefPtrWillBeRawPtr<SharedWorker> worker = adoptRefWillBeRefCountedGarbageCol
lected(new SharedWorker(context)); |
65 | 65 |
66 RefPtr<MessageChannel> channel = MessageChannel::create(context); | 66 RefPtrWillBeRawPtr<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<blink::WebMessagePortChannel> remotePort = channel->port2()->disentan
gle(); |
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() + "'."); |
(...skipping 29 matching lines...) Expand all Loading... |
106 unsetPendingActivity(this); | 106 unsetPendingActivity(this); |
107 } | 107 } |
108 | 108 |
109 void SharedWorker::trace(Visitor* visitor) | 109 void SharedWorker::trace(Visitor* visitor) |
110 { | 110 { |
111 AbstractWorker::trace(visitor); | 111 AbstractWorker::trace(visitor); |
112 WillBeHeapSupplementable<SharedWorker>::trace(visitor); | 112 WillBeHeapSupplementable<SharedWorker>::trace(visitor); |
113 } | 113 } |
114 | 114 |
115 } // namespace WebCore | 115 } // namespace WebCore |
OLD | NEW |