Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: Source/core/dom/MessagePort.cpp

Issue 17648006: Rename WorkerContext to WorkerGlobalScope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/EventTargetFactory.in ('k') | Source/core/dom/ScriptExecutionContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #include "config.h" 27 #include "config.h"
28 #include "core/dom/MessagePort.h" 28 #include "core/dom/MessagePort.h"
29 29
30 #include "core/dom/Document.h" 30 #include "core/dom/Document.h"
31 #include "core/dom/EventNames.h" 31 #include "core/dom/EventNames.h"
32 #include "core/dom/ExceptionCode.h" 32 #include "core/dom/ExceptionCode.h"
33 #include "core/dom/MessageEvent.h" 33 #include "core/dom/MessageEvent.h"
34 #include "core/page/DOMWindow.h" 34 #include "core/page/DOMWindow.h"
35 #include "core/workers/WorkerContext.h" 35 #include "core/workers/WorkerGlobalScope.h"
36 #include "wtf/text/AtomicString.h" 36 #include "wtf/text/AtomicString.h"
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext) 40 MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext)
41 : m_started(false) 41 : m_started(false)
42 , m_closed(false) 42 , m_closed(false)
43 , m_scriptExecutionContext(&scriptExecutionContext) 43 , m_scriptExecutionContext(&scriptExecutionContext)
44 { 44 {
45 ScriptWrappable::init(this); 45 ScriptWrappable::init(this);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 { 155 {
156 // Messages for contexts that are not fully active get dispatched too, but J SAbstractEventListener::handleEvent() doesn't call handlers for these. 156 // Messages for contexts that are not fully active get dispatched too, but J SAbstractEventListener::handleEvent() doesn't call handlers for these.
157 // The HTML5 spec specifies that any messages sent to a document that is not fully active should be dropped, so this behavior is OK. 157 // The HTML5 spec specifies that any messages sent to a document that is not fully active should be dropped, so this behavior is OK.
158 ASSERT(started()); 158 ASSERT(started());
159 159
160 RefPtr<SerializedScriptValue> message; 160 RefPtr<SerializedScriptValue> message;
161 OwnPtr<MessagePortChannelArray> channels; 161 OwnPtr<MessagePortChannelArray> channels;
162 while (m_entangledChannel && m_entangledChannel->tryGetMessageFromRemote(mes sage, channels)) { 162 while (m_entangledChannel && m_entangledChannel->tryGetMessageFromRemote(mes sage, channels)) {
163 163
164 // close() in Worker onmessage handler should prevent next message from dispatching. 164 // close() in Worker onmessage handler should prevent next message from dispatching.
165 if (m_scriptExecutionContext->isWorkerContext() && static_cast<WorkerCon text*>(m_scriptExecutionContext)->isClosing()) 165 if (m_scriptExecutionContext->isWorkerGlobalScope() && static_cast<Worke rGlobalScope*>(m_scriptExecutionContext)->isClosing())
166 return; 166 return;
167 167
168 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_scriptExe cutionContext, channels.release()); 168 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_scriptExe cutionContext, channels.release());
169 RefPtr<Event> evt = MessageEvent::create(ports.release(), message.releas e()); 169 RefPtr<Event> evt = MessageEvent::create(ports.release(), message.releas e());
170 170
171 dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION); 171 dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION);
172 } 172 }
173 } 173 }
174 174
175 bool MessagePort::hasPendingActivity() 175 bool MessagePort::hasPendingActivity()
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 { 233 {
234 return &m_eventTargetData; 234 return &m_eventTargetData;
235 } 235 }
236 236
237 EventTargetData* MessagePort::ensureEventTargetData() 237 EventTargetData* MessagePort::ensureEventTargetData()
238 { 238 {
239 return &m_eventTargetData; 239 return &m_eventTargetData;
240 } 240 }
241 241
242 } // namespace WebCore 242 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/EventTargetFactory.in ('k') | Source/core/dom/ScriptExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698