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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 : ActiveDOMObject(&executionContext) | 54 : ActiveDOMObject(&executionContext) |
55 , m_started(false) | 55 , m_started(false) |
56 , m_closed(false) | 56 , m_closed(false) |
57 , m_weakFactory(this) | 57 , m_weakFactory(this) |
58 { | 58 { |
59 } | 59 } |
60 | 60 |
61 MessagePort::~MessagePort() | 61 MessagePort::~MessagePort() |
62 { | 62 { |
63 close(); | 63 close(); |
| 64 if (m_scriptStateForConversion) |
| 65 m_scriptStateForConversion->disposePerContextData(); |
64 } | 66 } |
65 | 67 |
66 void MessagePort::postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValu
e> message, const MessagePortArray* ports, ExceptionState& exceptionState) | 68 void MessagePort::postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValu
e> message, const MessagePortArray* ports, ExceptionState& exceptionState) |
67 { | 69 { |
68 if (!isEntangled()) | 70 if (!isEntangled()) |
69 return; | 71 return; |
70 ASSERT(executionContext()); | 72 ASSERT(executionContext()); |
71 ASSERT(m_entangledChannel); | 73 ASSERT(m_entangledChannel); |
72 | 74 |
73 OwnPtr<MessagePortChannelArray> channels; | 75 OwnPtr<MessagePortChannelArray> channels; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 261 } |
260 return portArray.release(); | 262 return portArray.release(); |
261 } | 263 } |
262 | 264 |
263 DEFINE_TRACE(MessagePort) | 265 DEFINE_TRACE(MessagePort) |
264 { | 266 { |
265 ActiveDOMObject::trace(visitor); | 267 ActiveDOMObject::trace(visitor); |
266 EventTargetWithInlineData::trace(visitor); | 268 EventTargetWithInlineData::trace(visitor); |
267 } | 269 } |
268 | 270 |
| 271 v8::Isolate* MessagePort::scriptIsolate() |
| 272 { |
| 273 ASSERT(executionContext()); |
| 274 return toIsolate(executionContext()); |
| 275 } |
| 276 |
| 277 v8::Local<v8::Context> MessagePort::scriptContextForMessageConversion() |
| 278 { |
| 279 ASSERT(executionContext()); |
| 280 if (!m_scriptStateForConversion) { |
| 281 v8::Isolate* isolate = scriptIsolate(); |
| 282 m_scriptStateForConversion = ScriptState::create(v8::Context::New(isolat
e), DOMWrapperWorld::create(isolate)); |
| 283 } |
| 284 return m_scriptStateForConversion->context(); |
| 285 } |
| 286 |
269 } // namespace blink | 287 } // namespace blink |
OLD | NEW |