| 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 18 matching lines...) Expand all Loading... |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "config.h" | 32 #include "config.h" |
| 33 | 33 |
| 34 #if ENABLE(SHARED_WORKERS) | 34 #if ENABLE(SHARED_WORKERS) |
| 35 | 35 |
| 36 #include "SharedWorker.h" | 36 #include "SharedWorker.h" |
| 37 | 37 |
| 38 #include "ExceptionCode.h" | 38 #include "ExceptionCode.h" |
| 39 #include "FeatureObserver.h" | 39 #include "UseCounter.h" |
| 40 #include "InspectorInstrumentation.h" | 40 #include "InspectorInstrumentation.h" |
| 41 #include "KURL.h" | 41 #include "KURL.h" |
| 42 #include "MessageChannel.h" | 42 #include "MessageChannel.h" |
| 43 #include "MessagePort.h" | 43 #include "MessagePort.h" |
| 44 #include "ScriptExecutionContext.h" | 44 #include "ScriptExecutionContext.h" |
| 45 #include "SecurityOrigin.h" | 45 #include "SecurityOrigin.h" |
| 46 #include "SharedWorkerRepository.h" | 46 #include "SharedWorkerRepository.h" |
| 47 | 47 |
| 48 namespace WebCore { | 48 namespace WebCore { |
| 49 | 49 |
| 50 inline SharedWorker::SharedWorker(ScriptExecutionContext* context) | 50 inline SharedWorker::SharedWorker(ScriptExecutionContext* context) |
| 51 : AbstractWorker(context) | 51 : AbstractWorker(context) |
| 52 { | 52 { |
| 53 } | 53 } |
| 54 | 54 |
| 55 PassRefPtr<SharedWorker> SharedWorker::create(ScriptExecutionContext* context, c
onst String& url, const String& name, ExceptionCode& ec) | 55 PassRefPtr<SharedWorker> SharedWorker::create(ScriptExecutionContext* context, c
onst String& url, const String& name, ExceptionCode& ec) |
| 56 { | 56 { |
| 57 ASSERT(isMainThread()); | 57 ASSERT(isMainThread()); |
| 58 FeatureObserver::observe(static_cast<Document*>(context)->domWindow(), Featu
reObserver::SharedWorkerStart); | 58 UseCounter::observe(static_cast<Document*>(context)->domWindow(), UseCounter
::SharedWorkerStart); |
| 59 | 59 |
| 60 RefPtr<SharedWorker> worker = adoptRef(new SharedWorker(context)); | 60 RefPtr<SharedWorker> worker = adoptRef(new SharedWorker(context)); |
| 61 | 61 |
| 62 RefPtr<MessageChannel> channel = MessageChannel::create(context); | 62 RefPtr<MessageChannel> channel = MessageChannel::create(context); |
| 63 worker->m_port = channel->port1(); | 63 worker->m_port = channel->port1(); |
| 64 OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle(); | 64 OwnPtr<MessagePortChannel> remotePort = channel->port2()->disentangle(); |
| 65 ASSERT(remotePort); | 65 ASSERT(remotePort); |
| 66 | 66 |
| 67 worker->suspendIfNeeded(); | 67 worker->suspendIfNeeded(); |
| 68 | 68 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 const AtomicString& SharedWorker::interfaceName() const | 90 const AtomicString& SharedWorker::interfaceName() const |
| 91 { | 91 { |
| 92 return eventNames().interfaceForSharedWorker; | 92 return eventNames().interfaceForSharedWorker; |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace WebCore | 95 } // namespace WebCore |
| 96 | 96 |
| 97 #endif // ENABLE(SHARED_WORKERS) | 97 #endif // ENABLE(SHARED_WORKERS) |
| OLD | NEW |