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

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

Issue 540283003: bindings: Retires ScriptWrappable::init, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed a review comment. 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
« no previous file with comments | « Source/core/events/KeyboardEvent.cpp ('k') | Source/core/events/MouseEvent.cpp » ('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 28 matching lines...) Expand all
39 return !source || source->toDOMWindow() || source->toMessagePort(); 39 return !source || source->toDOMWindow() || source->toMessagePort();
40 } 40 }
41 41
42 MessageEventInit::MessageEventInit() 42 MessageEventInit::MessageEventInit()
43 { 43 {
44 } 44 }
45 45
46 MessageEvent::MessageEvent() 46 MessageEvent::MessageEvent()
47 : m_dataType(DataTypeScriptValue) 47 : m_dataType(DataTypeScriptValue)
48 { 48 {
49 ScriptWrappable::init(this);
50 } 49 }
51 50
52 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini tializer) 51 MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& ini tializer)
53 : Event(type, initializer) 52 : Event(type, initializer)
54 , m_dataType(DataTypeScriptValue) 53 , m_dataType(DataTypeScriptValue)
55 , m_origin(initializer.origin) 54 , m_origin(initializer.origin)
56 , m_lastEventId(initializer.lastEventId) 55 , m_lastEventId(initializer.lastEventId)
57 , m_source(isValidSource(initializer.source.get()) ? initializer.source : nu llptr) 56 , m_source(isValidSource(initializer.source.get()) ? initializer.source : nu llptr)
58 , m_ports(adoptPtrWillBeNoop(new MessagePortArray(initializer.ports))) 57 , m_ports(adoptPtrWillBeNoop(new MessagePortArray(initializer.ports)))
59 { 58 {
60 ScriptWrappable::init(this);
61 ASSERT(isValidSource(m_source.get())); 59 ASSERT(isValidSource(m_source.get()));
62 } 60 }
63 61
64 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Pass RefPtrWillBeRawPtr<EventTarget> source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports) 62 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Pass RefPtrWillBeRawPtr<EventTarget> source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports)
65 : Event(EventTypeNames::message, false, false) 63 : Event(EventTypeNames::message, false, false)
66 , m_dataType(DataTypeScriptValue) 64 , m_dataType(DataTypeScriptValue)
67 , m_origin(origin) 65 , m_origin(origin)
68 , m_lastEventId(lastEventId) 66 , m_lastEventId(lastEventId)
69 , m_source(source) 67 , m_source(source)
70 , m_ports(ports) 68 , m_ports(ports)
71 { 69 {
72 ScriptWrappable::init(this);
73 ASSERT(isValidSource(m_source.get())); 70 ASSERT(isValidSource(m_source.get()));
74 } 71 }
75 72
76 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports) 73 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports)
77 : Event(EventTypeNames::message, false, false) 74 : Event(EventTypeNames::message, false, false)
78 , m_dataType(DataTypeSerializedScriptValue) 75 , m_dataType(DataTypeSerializedScriptValue)
79 , m_dataAsSerializedScriptValue(data) 76 , m_dataAsSerializedScriptValue(data)
80 , m_origin(origin) 77 , m_origin(origin)
81 , m_lastEventId(lastEventId) 78 , m_lastEventId(lastEventId)
82 , m_source(source) 79 , m_source(source)
83 , m_ports(ports) 80 , m_ports(ports)
84 { 81 {
85 ScriptWrappable::init(this);
86 if (m_dataAsSerializedScriptValue) 82 if (m_dataAsSerializedScriptValue)
87 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC ontext(); 83 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC ontext();
88 ASSERT(isValidSource(m_source.get())); 84 ASSERT(isValidSource(m_source.get()));
89 } 85 }
90 86
91 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortChannelArray> channels) 87 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr<MessagePortChannelArray> channels)
92 : Event(EventTypeNames::message, false, false) 88 : Event(EventTypeNames::message, false, false)
93 , m_dataType(DataTypeSerializedScriptValue) 89 , m_dataType(DataTypeSerializedScriptValue)
94 , m_dataAsSerializedScriptValue(data) 90 , m_dataAsSerializedScriptValue(data)
95 , m_origin(origin) 91 , m_origin(origin)
96 , m_lastEventId(lastEventId) 92 , m_lastEventId(lastEventId)
97 , m_source(source) 93 , m_source(source)
98 , m_channels(channels) 94 , m_channels(channels)
99 { 95 {
100 ScriptWrappable::init(this);
101 if (m_dataAsSerializedScriptValue) 96 if (m_dataAsSerializedScriptValue)
102 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC ontext(); 97 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC ontext();
103 ASSERT(isValidSource(m_source.get())); 98 ASSERT(isValidSource(m_source.get()));
104 } 99 }
105 100
106 MessageEvent::MessageEvent(const String& data, const String& origin) 101 MessageEvent::MessageEvent(const String& data, const String& origin)
107 : Event(EventTypeNames::message, false, false) 102 : Event(EventTypeNames::message, false, false)
108 , m_dataType(DataTypeString) 103 , m_dataType(DataTypeString)
109 , m_dataAsString(data) 104 , m_dataAsString(data)
110 , m_origin(origin) 105 , m_origin(origin)
111 { 106 {
112 ScriptWrappable::init(this);
113 } 107 }
114 108
115 MessageEvent::MessageEvent(PassRefPtrWillBeRawPtr<Blob> data, const String& orig in) 109 MessageEvent::MessageEvent(PassRefPtrWillBeRawPtr<Blob> data, const String& orig in)
116 : Event(EventTypeNames::message, false, false) 110 : Event(EventTypeNames::message, false, false)
117 , m_dataType(DataTypeBlob) 111 , m_dataType(DataTypeBlob)
118 , m_dataAsBlob(data) 112 , m_dataAsBlob(data)
119 , m_origin(origin) 113 , m_origin(origin)
120 { 114 {
121 ScriptWrappable::init(this);
122 } 115 }
123 116
124 MessageEvent::MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin) 117 MessageEvent::MessageEvent(PassRefPtr<ArrayBuffer> data, const String& origin)
125 : Event(EventTypeNames::message, false, false) 118 : Event(EventTypeNames::message, false, false)
126 , m_dataType(DataTypeArrayBuffer) 119 , m_dataType(DataTypeArrayBuffer)
127 , m_dataAsArrayBuffer(data) 120 , m_dataAsArrayBuffer(data)
128 , m_origin(origin) 121 , m_origin(origin)
129 { 122 {
130 ScriptWrappable::init(this);
131 } 123 }
132 124
133 MessageEvent::~MessageEvent() 125 MessageEvent::~MessageEvent()
134 { 126 {
135 } 127 }
136 128
137 PassRefPtrWillBeRawPtr<MessageEvent> MessageEvent::create(const AtomicString& ty pe, const MessageEventInit& initializer, ExceptionState& exceptionState) 129 PassRefPtrWillBeRawPtr<MessageEvent> MessageEvent::create(const AtomicString& ty pe, const MessageEventInit& initializer, ExceptionState& exceptionState)
138 { 130 {
139 if (initializer.source.get() && !isValidSource(initializer.source.get())) { 131 if (initializer.source.get() && !isValidSource(initializer.source.get())) {
140 exceptionState.throwTypeError("The optional 'source' property is neither a Window nor MessagePort."); 132 exceptionState.throwTypeError("The optional 'source' property is neither a Window nor MessagePort.");
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 break; 205 break;
214 case MessageEvent::DataTypeArrayBuffer: 206 case MessageEvent::DataTypeArrayBuffer:
215 V8HiddenValue::setHiddenValue(isolate, wrapper, V8HiddenValue::arrayBuff erData(isolate), toV8(dataAsArrayBuffer(), wrapper, isolate)); 207 V8HiddenValue::setHiddenValue(isolate, wrapper, V8HiddenValue::arrayBuff erData(isolate), toV8(dataAsArrayBuffer(), wrapper, isolate));
216 break; 208 break;
217 } 209 }
218 210
219 return wrapper; 211 return wrapper;
220 } 212 }
221 213
222 } // namespace blink 214 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/events/KeyboardEvent.cpp ('k') | Source/core/events/MouseEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698