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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
31 #include "bindings/core/v8/SerializedScriptValue.h" | 31 #include "bindings/core/v8/SerializedScriptValue.h" |
32 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 32 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
33 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
35 #include "core/dom/ExecutionContextTask.h" | 35 #include "core/dom/ExecutionContextTask.h" |
36 #include "core/events/MessageEvent.h" | 36 #include "core/events/MessageEvent.h" |
37 #include "core/frame/LocalDOMWindow.h" | 37 #include "core/frame/LocalDOMWindow.h" |
38 #include "core/inspector/ConsoleMessage.h" | |
39 #include "core/workers/WorkerGlobalScope.h" | 38 #include "core/workers/WorkerGlobalScope.h" |
40 #include "public/platform/WebString.h" | 39 #include "public/platform/WebString.h" |
41 #include "wtf/Functional.h" | 40 #include "wtf/Functional.h" |
42 #include "wtf/PtrUtil.h" | 41 #include "wtf/PtrUtil.h" |
43 #include "wtf/text/AtomicString.h" | 42 #include "wtf/text/AtomicString.h" |
44 #include <memory> | 43 #include <memory> |
45 | 44 |
46 namespace blink { | 45 namespace blink { |
47 | 46 |
48 MessagePort* MessagePort::create(ExecutionContext& executionContext) { | 47 MessagePort* MessagePort::create(ExecutionContext& executionContext) { |
(...skipping 30 matching lines...) Expand all Loading... |
79 DataCloneError, | 78 DataCloneError, |
80 "Port at index " + String::number(i) + " contains the source port."); | 79 "Port at index " + String::number(i) + " contains the source port."); |
81 return; | 80 return; |
82 } | 81 } |
83 } | 82 } |
84 std::unique_ptr<MessagePortChannelArray> channels = | 83 std::unique_ptr<MessagePortChannelArray> channels = |
85 MessagePort::disentanglePorts(context, ports, exceptionState); | 84 MessagePort::disentanglePorts(context, ports, exceptionState); |
86 if (exceptionState.hadException()) | 85 if (exceptionState.hadException()) |
87 return; | 86 return; |
88 | 87 |
89 if (message->containsTransferableArrayBuffer()) | |
90 getExecutionContext()->addConsoleMessage(ConsoleMessage::create( | |
91 JSMessageSource, WarningMessageLevel, | |
92 "MessagePort cannot send an ArrayBuffer as a transferable object yet. " | |
93 "See http://crbug.com/334408")); | |
94 | |
95 WebString messageString = message->toWireString(); | 88 WebString messageString = message->toWireString(); |
96 std::unique_ptr<WebMessagePortChannelArray> webChannels = | 89 std::unique_ptr<WebMessagePortChannelArray> webChannels = |
97 toWebMessagePortChannelArray(std::move(channels)); | 90 toWebMessagePortChannelArray(std::move(channels)); |
98 m_entangledChannel->postMessage(messageString, webChannels.release()); | 91 m_entangledChannel->postMessage(messageString, webChannels.release()); |
99 } | 92 } |
100 | 93 |
101 // static | 94 // static |
102 std::unique_ptr<WebMessagePortChannelArray> | 95 std::unique_ptr<WebMessagePortChannelArray> |
103 MessagePort::toWebMessagePortChannelArray( | 96 MessagePort::toWebMessagePortChannelArray( |
104 std::unique_ptr<MessagePortChannelArray> channels) { | 97 std::unique_ptr<MessagePortChannelArray> channels) { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 285 } |
293 return portArray; | 286 return portArray; |
294 } | 287 } |
295 | 288 |
296 DEFINE_TRACE(MessagePort) { | 289 DEFINE_TRACE(MessagePort) { |
297 ActiveDOMObject::trace(visitor); | 290 ActiveDOMObject::trace(visitor); |
298 EventTargetWithInlineData::trace(visitor); | 291 EventTargetWithInlineData::trace(visitor); |
299 } | 292 } |
300 | 293 |
301 } // namespace blink | 294 } // namespace blink |
OLD | NEW |