| OLD | NEW |
| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 MessagePort* MessagePort::create(ExecutionContext& executionContext) { | 47 MessagePort* MessagePort::create(ExecutionContext& executionContext) { |
| 48 MessagePort* port = new MessagePort(executionContext); | 48 MessagePort* port = new MessagePort(executionContext); |
| 49 port->suspendIfNeeded(); | 49 port->suspendIfNeeded(); |
| 50 return port; | 50 return port; |
| 51 } | 51 } |
| 52 | 52 |
| 53 MessagePort::MessagePort(ExecutionContext& executionContext) | 53 MessagePort::MessagePort(ExecutionContext& executionContext) |
| 54 : ActiveScriptWrappable(this), | 54 : ActiveScriptWrappable(this), |
| 55 ActiveDOMObject(&executionContext), | 55 SuspendableObject(&executionContext), |
| 56 m_started(false), | 56 m_started(false), |
| 57 m_closed(false) {} | 57 m_closed(false) {} |
| 58 | 58 |
| 59 MessagePort::~MessagePort() { | 59 MessagePort::~MessagePort() { |
| 60 DCHECK(!m_started || !isEntangled()); | 60 DCHECK(!m_started || !isEntangled()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void MessagePort::postMessage(ExecutionContext* context, | 63 void MessagePort::postMessage(ExecutionContext* context, |
| 64 PassRefPtr<SerializedScriptValue> message, | 64 PassRefPtr<SerializedScriptValue> message, |
| 65 const MessagePortArray& ports, | 65 const MessagePortArray& ports, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 MessagePortArray* portArray = new MessagePortArray(channels->size()); | 284 MessagePortArray* portArray = new MessagePortArray(channels->size()); |
| 285 for (unsigned i = 0; i < channels->size(); ++i) { | 285 for (unsigned i = 0; i < channels->size(); ++i) { |
| 286 MessagePort* port = MessagePort::create(context); | 286 MessagePort* port = MessagePort::create(context); |
| 287 port->entangle(std::move((*channels)[i])); | 287 port->entangle(std::move((*channels)[i])); |
| 288 (*portArray)[i] = port; | 288 (*portArray)[i] = port; |
| 289 } | 289 } |
| 290 return portArray; | 290 return portArray; |
| 291 } | 291 } |
| 292 | 292 |
| 293 DEFINE_TRACE(MessagePort) { | 293 DEFINE_TRACE(MessagePort) { |
| 294 ActiveDOMObject::trace(visitor); | 294 SuspendableObject::trace(visitor); |
| 295 EventTargetWithInlineData::trace(visitor); | 295 EventTargetWithInlineData::trace(visitor); |
| 296 } | 296 } |
| 297 | 297 |
| 298 } // namespace blink | 298 } // namespace blink |
| OLD | NEW |