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

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

Issue 17063016: Remove leak of objects between isolated worlds on custom events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added GC test Created 7 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
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 28 matching lines...) Expand all
39 39
40 MessageEvent::MessageEvent() 40 MessageEvent::MessageEvent()
41 : m_dataType(DataTypeScriptValue) 41 : m_dataType(DataTypeScriptValue)
42 { 42 {
43 ScriptWrappable::init(this); 43 ScriptWrappable::init(this);
44 } 44 }
45 45
46 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini tializer) 46 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini tializer)
47 : Event(type, initializer) 47 : Event(type, initializer)
48 , m_dataType(DataTypeScriptValue) 48 , m_dataType(DataTypeScriptValue)
49 , m_dataAsScriptValue(initializer.data)
50 , m_origin(initializer.origin) 49 , m_origin(initializer.origin)
51 , m_lastEventId(initializer.lastEventId) 50 , m_lastEventId(initializer.lastEventId)
52 , m_source(initializer.source) 51 , m_source(initializer.source)
53 , m_ports(adoptPtr(new MessagePortArray(initializer.ports))) 52 , m_ports(adoptPtr(new MessagePortArray(initializer.ports)))
53 , m_dataIsSet(initializer.dataIsSet)
54 { 54 {
55 ScriptWrappable::init(this); 55 ScriptWrappable::init(this);
56 } 56 }
57 57
58 MessageEvent::MessageEvent(const ScriptValue& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports) 58 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Pass RefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports)
59 : Event(eventNames().messageEvent, false, false) 59 : Event(eventNames().messageEvent, false, false)
60 , m_dataType(DataTypeScriptValue) 60 , m_dataType(DataTypeScriptValue)
61 , m_dataAsScriptValue(data)
62 , m_origin(origin) 61 , m_origin(origin)
63 , m_lastEventId(lastEventId) 62 , m_lastEventId(lastEventId)
64 , m_source(source) 63 , m_source(source)
65 , m_ports(ports) 64 , m_ports(ports)
adamk 2013/06/27 00:15:04 again, need m_dataIsSet to be initialized to somet
jww 2013/06/27 04:35:35 Getting rid of m_dataIsSet.
66 { 65 {
67 ScriptWrappable::init(this); 66 ScriptWrappable::init(this);
68 } 67 }
69 68
70 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<Mes sagePortArray> ports) 69 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<Mes sagePortArray> ports)
adamk 2013/06/27 00:15:04 And in this one too, and all the constructors belo
jww 2013/06/27 04:35:35 Looks like that's what we're doing.
71 : Event(eventNames().messageEvent, false, false) 70 : Event(eventNames().messageEvent, false, false)
72 , m_dataType(DataTypeSerializedScriptValue) 71 , m_dataType(DataTypeSerializedScriptValue)
73 , m_dataAsSerializedScriptValue(data) 72 , m_dataAsSerializedScriptValue(data)
74 , m_origin(origin) 73 , m_origin(origin)
75 , m_lastEventId(lastEventId) 74 , m_lastEventId(lastEventId)
76 , m_source(source) 75 , m_source(source)
77 , m_ports(ports) 76 , m_ports(ports)
78 { 77 {
79 ScriptWrappable::init(this); 78 ScriptWrappable::init(this);
80 if (m_dataAsSerializedScriptValue) 79 if (m_dataAsSerializedScriptValue)
(...skipping 27 matching lines...) Expand all
108 , m_origin(origin) 107 , m_origin(origin)
109 , m_lastEventId("") 108 , m_lastEventId("")
110 { 109 {
111 ScriptWrappable::init(this); 110 ScriptWrappable::init(this);
112 } 111 }
113 112
114 MessageEvent::~MessageEvent() 113 MessageEvent::~MessageEvent()
115 { 114 {
116 } 115 }
117 116
118 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, const ScriptValue& data, const String& origin, const String& last EventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports) 117 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, const String& origin, const String& lastEventId, DOMWindow* sourc e, PassOwnPtr<MessagePortArray> ports)
119 { 118 {
120 if (dispatched()) 119 if (dispatched())
121 return; 120 return;
122 121
123 initEvent(type, canBubble, cancelable); 122 initEvent(type, canBubble, cancelable);
124 123
125 m_dataType = DataTypeScriptValue; 124 m_dataType = DataTypeScriptValue;
126 m_dataAsScriptValue = data;
127 m_origin = origin; 125 m_origin = origin;
128 m_lastEventId = lastEventId; 126 m_lastEventId = lastEventId;
129 m_source = source; 127 m_source = source;
130 m_ports = ports; 128 m_ports = ports;
131 } 129 }
132 130
133 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, con st String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports) 131 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo ol cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, con st String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports)
134 { 132 {
135 if (dispatched()) 133 if (dispatched())
136 return; 134 return;
(...skipping 10 matching lines...) Expand all
147 if (m_dataAsSerializedScriptValue) 145 if (m_dataAsSerializedScriptValue)
148 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC ontext(); 146 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC ontext();
149 } 147 }
150 148
151 const AtomicString& MessageEvent::interfaceName() const 149 const AtomicString& MessageEvent::interfaceName() const
152 { 150 {
153 return eventNames().interfaceForMessageEvent; 151 return eventNames().interfaceForMessageEvent;
154 } 152 }
155 153
156 } // namespace WebCore 154 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698