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 13 matching lines...) Expand all Loading... | |
24 * | 24 * |
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 "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
32 #include "bindings/core/v8/SerializedScriptValue.h" | 32 #include "bindings/core/v8/SerializedScriptValue.h" |
33 #include "bindings/core/v8/SerializedScriptValueFactory.h" | 33 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
34 #include "bindings/core/v8/V8AbstractEventListener.h" | |
34 #include "core/dom/CrossThreadTask.h" | 35 #include "core/dom/CrossThreadTask.h" |
35 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
36 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
37 #include "core/events/MessageEvent.h" | 38 #include "core/events/MessageEvent.h" |
38 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
39 #include "core/workers/WorkerGlobalScope.h" | 40 #include "core/workers/WorkerGlobalScope.h" |
40 #include "public/platform/WebString.h" | 41 #include "public/platform/WebString.h" |
41 #include "wtf/Functional.h" | 42 #include "wtf/Functional.h" |
42 #include "wtf/text/AtomicString.h" | 43 #include "wtf/text/AtomicString.h" |
43 | 44 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 } | 260 } |
260 return portArray.release(); | 261 return portArray.release(); |
261 } | 262 } |
262 | 263 |
263 void MessagePort::trace(Visitor* visitor) | 264 void MessagePort::trace(Visitor* visitor) |
264 { | 265 { |
265 ActiveDOMObject::trace(visitor); | 266 ActiveDOMObject::trace(visitor); |
266 EventTargetWithInlineData::trace(visitor); | 267 EventTargetWithInlineData::trace(visitor); |
267 } | 268 } |
268 | 269 |
270 v8::Isolate* MessagePort::scriptIsolate() | |
271 { | |
272 ASSERT(executionContext()); | |
273 return toIsolate(executionContext()); | |
274 } | |
275 | |
276 v8::Handle<v8::Context> MessagePort::scriptContext() | |
277 { | |
278 ASSERT(executionContext()); | |
279 // Since a MessagePort doesn't live in any particular world, return the | |
280 // context for some arbitrary event listener that is registered with this | |
281 // port. | |
haraken
2015/02/25 07:44:34
I don't understand why this is right. Not all even
Marijn Kruisselbrink
2015/02/25 17:35:17
The context returned by this is used by WebMessage
| |
282 const EventListenerVector& listeners = getEventListeners(EventTypeNames::mes sage); | |
283 for (const RegisteredEventListener& listener: listeners) { | |
284 const V8AbstractEventListener* v8listener = V8AbstractEventListener::cas t(listener.listener.get()); | |
285 if (v8listener) | |
286 return toV8Context(executionContext(), v8listener->world()); | |
287 } | |
288 return v8::Handle<v8::Context>(); | |
289 } | |
290 | |
269 } // namespace blink | 291 } // namespace blink |
OLD | NEW |