OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009 Google 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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ASSERT(isMainThread()); | 82 ASSERT(isMainThread()); |
83 ASSERT(scriptExecutionContext()); // The context is protected by worker cont
ext proxy, so it cannot be destroyed while a Worker exists. | 83 ASSERT(scriptExecutionContext()); // The context is protected by worker cont
ext proxy, so it cannot be destroyed while a Worker exists. |
84 m_contextProxy->workerObjectDestroyed(); | 84 m_contextProxy->workerObjectDestroyed(); |
85 } | 85 } |
86 | 86 |
87 const AtomicString& Worker::interfaceName() const | 87 const AtomicString& Worker::interfaceName() const |
88 { | 88 { |
89 return eventNames().interfaceForWorker; | 89 return eventNames().interfaceForWorker; |
90 } | 90 } |
91 | 91 |
92 void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*
port, ExceptionCode& ec) | |
93 { | |
94 MessagePortArray ports; | |
95 if (port) | |
96 ports.append(port); | |
97 postMessage(message, &ports, ec); | |
98 } | |
99 | |
100 void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray* ports, ExceptionCode& ec) | 92 void Worker::postMessage(PassRefPtr<SerializedScriptValue> message, const Messag
ePortArray* ports, ExceptionCode& ec) |
101 { | 93 { |
102 // Disentangle the port in preparation for sending it to the remote context. | 94 // Disentangle the port in preparation for sending it to the remote context. |
103 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(por
ts, ec); | 95 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(por
ts, ec); |
104 if (ec) | 96 if (ec) |
105 return; | 97 return; |
106 m_contextProxy->postMessageToWorkerContext(message, channels.release()); | 98 m_contextProxy->postMessageToWorkerContext(message, channels.release()); |
107 } | 99 } |
108 | 100 |
109 void Worker::terminate() | 101 void Worker::terminate() |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 startMode = PauseWorkerContextOnStart; | 134 startMode = PauseWorkerContextOnStart; |
143 m_contextProxy->startWorkerContext(m_scriptLoader->url(), scriptExecutio
nContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMod
e); | 135 m_contextProxy->startWorkerContext(m_scriptLoader->url(), scriptExecutio
nContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), startMod
e); |
144 InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scr
iptLoader->identifier(), m_scriptLoader->script()); | 136 InspectorInstrumentation::scriptImported(scriptExecutionContext(), m_scr
iptLoader->identifier(), m_scriptLoader->script()); |
145 } | 137 } |
146 m_scriptLoader = nullptr; | 138 m_scriptLoader = nullptr; |
147 | 139 |
148 unsetPendingActivity(this); | 140 unsetPendingActivity(this); |
149 } | 141 } |
150 | 142 |
151 } // namespace WebCore | 143 } // namespace WebCore |
OLD | NEW |