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

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

Issue 542113003: bindings: Introduces ScriptWrappable::associateWithWrapper in addition to wrap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 visitor->trace(m_source); 183 visitor->trace(m_source);
184 #if ENABLE(OILPAN) 184 #if ENABLE(OILPAN)
185 visitor->trace(m_ports); 185 visitor->trace(m_ports);
186 #endif 186 #endif
187 Event::trace(visitor); 187 Event::trace(visitor);
188 } 188 }
189 189
190 v8::Handle<v8::Object> MessageEvent::wrap(v8::Handle<v8::Object> creationContext , v8::Isolate* isolate) 190 v8::Handle<v8::Object> MessageEvent::wrap(v8::Handle<v8::Object> creationContext , v8::Isolate* isolate)
191 { 191 {
192 v8::Handle<v8::Object> wrapper = Event::wrap(creationContext, isolate); 192 v8::Handle<v8::Object> wrapper = Event::wrap(creationContext, isolate);
193 return associateWithWrapperInternal(wrapper, isolate);
194 }
193 195
196 v8::Handle<v8::Object> MessageEvent::associateWithWrapper(const WrapperTypeInfo* wrapperType, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate)
197 {
198 Event::associateWithWrapper(wrapperType, wrapper, isolate);
199 return associateWithWrapperInternal(wrapper, isolate);
200 }
201
202 v8::Handle<v8::Object> MessageEvent::associateWithWrapperInternal(v8::Handle<v8: :Object> wrapper, v8::Isolate* isolate)
203 {
194 // Ensures a wrapper is created for the data to return now so that V8 knows how 204 // Ensures a wrapper is created for the data to return now so that V8 knows how
195 // much memory is used via the wrapper. To keep the wrapper alive, it's set to 205 // much memory is used via the wrapper. To keep the wrapper alive, it's set to
196 // the wrapper of the MessageEvent as a hidden value. 206 // the wrapper of the MessageEvent as a hidden value.
197 switch (dataType()) { 207 switch (dataType()) {
198 case MessageEvent::DataTypeScriptValue: 208 case MessageEvent::DataTypeScriptValue:
199 case MessageEvent::DataTypeSerializedScriptValue: 209 case MessageEvent::DataTypeSerializedScriptValue:
200 break; 210 break;
201 case MessageEvent::DataTypeString: 211 case MessageEvent::DataTypeString:
202 V8HiddenValue::setHiddenValue(isolate, wrapper, V8HiddenValue::stringDat a(isolate), v8String(isolate, dataAsString())); 212 V8HiddenValue::setHiddenValue(isolate, wrapper, V8HiddenValue::stringDat a(isolate), v8String(isolate, dataAsString()));
203 break; 213 break;
204 case MessageEvent::DataTypeBlob: 214 case MessageEvent::DataTypeBlob:
205 break; 215 break;
206 case MessageEvent::DataTypeArrayBuffer: 216 case MessageEvent::DataTypeArrayBuffer:
207 V8HiddenValue::setHiddenValue(isolate, wrapper, V8HiddenValue::arrayBuff erData(isolate), toV8(dataAsArrayBuffer(), wrapper, isolate)); 217 V8HiddenValue::setHiddenValue(isolate, wrapper, V8HiddenValue::arrayBuff erData(isolate), toV8(dataAsArrayBuffer(), wrapper, isolate));
208 break; 218 break;
209 } 219 }
210 220
211 return wrapper; 221 return wrapper;
212 } 222 }
213 223
214 } // namespace blink 224 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698