Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: Source/core/dom/MessagePort.cpp

Issue 1150183007: Re-land: bindings: Use MessageEventInit for MessageEvent constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/events/MessageEvent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 // Passed-in ports passed validity checks, so we can disentangle them. 253 // Passed-in ports passed validity checks, so we can disentangle them.
254 OwnPtr<MessagePortChannelArray> portArray = adoptPtr(new MessagePortChannelA rray(ports->size())); 254 OwnPtr<MessagePortChannelArray> portArray = adoptPtr(new MessagePortChannelA rray(ports->size()));
255 for (unsigned i = 0; i < ports->size(); ++i) 255 for (unsigned i = 0; i < ports->size(); ++i)
256 (*portArray)[i] = (*ports)[i]->disentangle(); 256 (*portArray)[i] = (*ports)[i]->disentangle();
257 return portArray.release(); 257 return portArray.release();
258 } 258 }
259 259
260 PassOwnPtrWillBeRawPtr<MessagePortArray> MessagePort::entanglePorts(ExecutionCon text& context, PassOwnPtr<MessagePortChannelArray> channels) 260 PassOwnPtrWillBeRawPtr<MessagePortArray> MessagePort::entanglePorts(ExecutionCon text& context, PassOwnPtr<MessagePortChannelArray> channels)
261 { 261 {
262 // https://html.spec.whatwg.org/multipage/comms.html#message-ports
263 // |ports| should be an empty array, not null even when there is no ports.
262 if (!channels || !channels->size()) 264 if (!channels || !channels->size())
263 return nullptr; 265 return adoptPtrWillBeNoop(new MessagePortArray());
264 266
265 OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new Mess agePortArray(channels->size())); 267 OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new Mess agePortArray(channels->size()));
266 for (unsigned i = 0; i < channels->size(); ++i) { 268 for (unsigned i = 0; i < channels->size(); ++i) {
267 RefPtrWillBeRawPtr<MessagePort> port = MessagePort::create(context); 269 RefPtrWillBeRawPtr<MessagePort> port = MessagePort::create(context);
268 port->entangle((*channels)[i].release()); 270 port->entangle((*channels)[i].release());
269 (*portArray)[i] = port.release(); 271 (*portArray)[i] = port.release();
270 } 272 }
271 return portArray.release(); 273 return portArray.release();
272 } 274 }
273 275
(...skipping 13 matching lines...) Expand all
287 { 289 {
288 ASSERT(executionContext()); 290 ASSERT(executionContext());
289 if (!m_scriptStateForConversion) { 291 if (!m_scriptStateForConversion) {
290 v8::Isolate* isolate = scriptIsolate(); 292 v8::Isolate* isolate = scriptIsolate();
291 m_scriptStateForConversion = ScriptState::create(v8::Context::New(isolat e), DOMWrapperWorld::create(isolate)); 293 m_scriptStateForConversion = ScriptState::create(v8::Context::New(isolat e), DOMWrapperWorld::create(isolate));
292 } 294 }
293 return m_scriptStateForConversion->context(); 295 return m_scriptStateForConversion->context();
294 } 296 }
295 297
296 } // namespace blink 298 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/events/MessageEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698