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

Side by Side Diff: Source/core/events/MessageEvent.cpp

Issue 344833002: Oilpan: move MessagePortArray to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 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
« no previous file with comments | « Source/core/events/MessageEvent.h ('k') | Source/core/frame/LocalDOMWindow.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) 2007 Henry Mason (hmason@mac.com) 2 * Copyright (C) 2007 Henry Mason (hmason@mac.com)
3 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 { 47 {
48 ScriptWrappable::init(this); 48 ScriptWrappable::init(this);
49 } 49 }
50 50
51 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini tializer) 51 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini tializer)
52 : Event(type, initializer) 52 : Event(type, initializer)
53 , m_dataType(DataTypeScriptValue) 53 , m_dataType(DataTypeScriptValue)
54 , m_origin(initializer.origin) 54 , m_origin(initializer.origin)
55 , m_lastEventId(initializer.lastEventId) 55 , m_lastEventId(initializer.lastEventId)
56 , m_source(isValidSource(initializer.source.get()) ? initializer.source : nu llptr) 56 , m_source(isValidSource(initializer.source.get()) ? initializer.source : nu llptr)
57 , m_ports(adoptPtr(new MessagePortArray(initializer.ports))) 57 , m_ports(adoptPtrWillBeNoop(new MessagePortArray(initializer.ports)))
58 { 58 {
59 ScriptWrappable::init(this); 59 ScriptWrappable::init(this);
60 ASSERT(isValidSource(m_source.get())); 60 ASSERT(isValidSource(m_source.get()));
61 } 61 }
62 62
63 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Pass RefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports) 63 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Pass RefPtrWillBeRawPtr<EventTarget> source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports)
64 : Event(EventTypeNames::message, false, false) 64 : Event(EventTypeNames::message, false, false)
65 , m_dataType(DataTypeScriptValue) 65 , m_dataType(DataTypeScriptValue)
66 , m_origin(origin) 66 , m_origin(origin)
67 , m_lastEventId(lastEventId) 67 , m_lastEventId(lastEventId)
68 , m_source(source) 68 , m_source(source)
69 , m_ports(ports) 69 , m_ports(ports)
70 { 70 {
71 ScriptWrappable::init(this); 71 ScriptWrappable::init(this);
72 ASSERT(isValidSource(m_source.get())); 72 ASSERT(isValidSource(m_source.get()));
73 } 73 }
74 74
75 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortArray> ports) 75 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports)
76 : Event(EventTypeNames::message, false, false) 76 : Event(EventTypeNames::message, false, false)
77 , m_dataType(DataTypeSerializedScriptValue) 77 , m_dataType(DataTypeSerializedScriptValue)
78 , m_dataAsSerializedScriptValue(data) 78 , m_dataAsSerializedScriptValue(data)
79 , m_origin(origin) 79 , m_origin(origin)
80 , m_lastEventId(lastEventId) 80 , m_lastEventId(lastEventId)
81 , m_source(source) 81 , m_source(source)
82 , m_ports(ports) 82 , m_ports(ports)
83 { 83 {
84 ScriptWrappable::init(this); 84 ScriptWrappable::init(this);
85 if (m_dataAsSerializedScriptValue) 85 if (m_dataAsSerializedScriptValue)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 PassRefPtrWillBeRawPtr<MessageEvent> MessageEvent::create(const AtomicString& ty pe, const MessageEventInit& initializer, ExceptionState& exceptionState) 136 PassRefPtrWillBeRawPtr<MessageEvent> MessageEvent::create(const AtomicString& ty pe, const MessageEventInit& initializer, ExceptionState& exceptionState)
137 { 137 {
138 if (initializer.source.get() && !isValidSource(initializer.source.get())) { 138 if (initializer.source.get() && !isValidSource(initializer.source.get())) {
139 exceptionState.throwTypeError("The optional 'source' property is neither a Window nor MessagePort."); 139 exceptionState.throwTypeError("The optional 'source' property is neither a Window nor MessagePort.");
140 return nullptr; 140 return nullptr;
141 } 141 }
142 return adoptRefWillBeNoop(new MessageEvent(type, initializer)); 142 return adoptRefWillBeNoop(new MessageEvent(type, initializer));
143 } 143 }
144 144
145 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray> ports) 145 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports)
146 { 146 {
147 if (dispatched()) 147 if (dispatched())
148 return; 148 return;
149 149
150 initEvent(type, canBubble, cancelable); 150 initEvent(type, canBubble, cancelable);
151 151
152 m_dataType = DataTypeScriptValue; 152 m_dataType = DataTypeScriptValue;
153 m_origin = origin; 153 m_origin = origin;
154 m_lastEventId = lastEventId; 154 m_lastEventId = lastEventId;
155 m_source = source; 155 m_source = source;
156 m_ports = ports; 156 m_ports = ports;
157 } 157 }
158 158
159 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, con st String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray> por ts) 159 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, con st String& lastEventId, LocalDOMWindow* source, PassOwnPtrWillBeRawPtr<MessagePo rtArray> ports)
160 { 160 {
161 if (dispatched()) 161 if (dispatched())
162 return; 162 return;
163 163
164 initEvent(type, canBubble, cancelable); 164 initEvent(type, canBubble, cancelable);
165 165
166 m_dataType = DataTypeSerializedScriptValue; 166 m_dataType = DataTypeSerializedScriptValue;
167 m_dataAsSerializedScriptValue = data; 167 m_dataAsSerializedScriptValue = data;
168 m_origin = origin; 168 m_origin = origin;
169 m_lastEventId = lastEventId; 169 m_lastEventId = lastEventId;
(...skipping 11 matching lines...) Expand all
181 181
182 void MessageEvent::entangleMessagePorts(ExecutionContext* context) 182 void MessageEvent::entangleMessagePorts(ExecutionContext* context)
183 { 183 {
184 m_ports = MessagePort::entanglePorts(*context, m_channels.release()); 184 m_ports = MessagePort::entanglePorts(*context, m_channels.release());
185 } 185 }
186 186
187 void MessageEvent::trace(Visitor* visitor) 187 void MessageEvent::trace(Visitor* visitor)
188 { 188 {
189 visitor->trace(m_dataAsBlob); 189 visitor->trace(m_dataAsBlob);
190 visitor->trace(m_source); 190 visitor->trace(m_source);
191 #if ENABLE(OILPAN)
192 visitor->trace(m_ports);
193 #endif
191 Event::trace(visitor); 194 Event::trace(visitor);
192 } 195 }
193 196
194 } // namespace WebCore 197 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/events/MessageEvent.h ('k') | Source/core/frame/LocalDOMWindow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698