| 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 14 matching lines...) Expand all Loading... |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "core/dom/MessageChannel.h" | 27 #include "core/dom/MessageChannel.h" |
| 28 | 28 |
| 29 #include "core/dom/MessagePort.h" | 29 #include "core/dom/MessagePort.h" |
| 30 #include "public/platform/Platform.h" | 30 #include "public/platform/Platform.h" |
| 31 #include "public/platform/WebMessagePortChannel.h" | 31 #include "public/platform/WebMessagePortChannel.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(MessageChannel); | |
| 36 | |
| 37 static void createChannel(MessagePort* port1, MessagePort* port2) | 35 static void createChannel(MessagePort* port1, MessagePort* port2) |
| 38 { | 36 { |
| 39 WebMessagePortChannel* channel1; | 37 WebMessagePortChannel* channel1; |
| 40 WebMessagePortChannel* channel2; | 38 WebMessagePortChannel* channel2; |
| 41 Platform::current()->createMessageChannel(&channel1, &channel2); | 39 Platform::current()->createMessageChannel(&channel1, &channel2); |
| 42 ASSERT(channel1 && channel2); | 40 ASSERT(channel1 && channel2); |
| 43 | 41 |
| 44 // Now entangle the proxies with the appropriate local ports. | 42 // Now entangle the proxies with the appropriate local ports. |
| 45 port1->entangle(adoptPtr(channel2)); | 43 port1->entangle(adoptPtr(channel2)); |
| 46 port2->entangle(adoptPtr(channel1)); | 44 port2->entangle(adoptPtr(channel1)); |
| 47 } | 45 } |
| 48 | 46 |
| 49 MessageChannel::MessageChannel(ExecutionContext* context) | 47 MessageChannel::MessageChannel(ExecutionContext* context) |
| 50 : m_port1(MessagePort::create(*context)) | 48 : m_port1(MessagePort::create(*context)) |
| 51 , m_port2(MessagePort::create(*context)) | 49 , m_port2(MessagePort::create(*context)) |
| 52 { | 50 { |
| 53 createChannel(m_port1.get(), m_port2.get()); | 51 createChannel(m_port1.get(), m_port2.get()); |
| 54 } | 52 } |
| 55 | 53 |
| 56 DEFINE_TRACE(MessageChannel) | 54 DEFINE_TRACE(MessageChannel) |
| 57 { | 55 { |
| 58 visitor->trace(m_port1); | 56 visitor->trace(m_port1); |
| 59 visitor->trace(m_port2); | 57 visitor->trace(m_port2); |
| 60 } | 58 } |
| 61 | 59 |
| 62 } // namespace blink | 60 } // namespace blink |
| OLD | NEW |