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

Side by Side Diff: webkit/port/bindings/v8/V8MessagePortCustom.cpp

Issue 11544: Remove use of wide characters in stats table identifiers. (Closed)
Patch Set: Created 12 years, 1 month 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 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, Google Inc.
2 // All rights reserved. 2 // 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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * 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 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 cache_array->Delete(i); 74 cache_array->Delete(i);
75 return; 75 return;
76 } 76 }
77 } 77 }
78 78
79 // We should only get here if we try to remove an event listener that was 79 // We should only get here if we try to remove an event listener that was
80 // never added. 80 // never added.
81 } 81 }
82 82
83 ACCESSOR_GETTER(MessagePortOnmessage) { 83 ACCESSOR_GETTER(MessagePortOnmessage) {
84 INC_STATS(L"DOM.MessagePort.onmessage._get"); 84 INC_STATS("DOM.MessagePort.onmessage._get");
85 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( 85 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>(
86 V8ClassIndex::MESSAGEPORT, info.Holder()); 86 V8ClassIndex::MESSAGEPORT, info.Holder());
87 if (imp->onmessage()) { 87 if (imp->onmessage()) {
88 V8ObjectEventListener* listener = 88 V8ObjectEventListener* listener =
89 static_cast<V8ObjectEventListener*>(imp->onmessage()); 89 static_cast<V8ObjectEventListener*>(imp->onmessage());
90 v8::Local<v8::Object> v8_listener = listener->GetListenerObject(); 90 v8::Local<v8::Object> v8_listener = listener->GetListenerObject();
91 return v8_listener; 91 return v8_listener;
92 } 92 }
93 return v8::Undefined(); 93 return v8::Undefined();
94 } 94 }
95 95
96 ACCESSOR_SETTER(MessagePortOnmessage) { 96 ACCESSOR_SETTER(MessagePortOnmessage) {
97 INC_STATS(L"DOM.MessagePort.onmessage._set"); 97 INC_STATS("DOM.MessagePort.onmessage._set");
98 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( 98 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>(
99 V8ClassIndex::MESSAGEPORT, info.Holder()); 99 V8ClassIndex::MESSAGEPORT, info.Holder());
100 if (value->IsNull()) { 100 if (value->IsNull()) {
101 if (imp->onmessage()) { 101 if (imp->onmessage()) {
102 V8ObjectEventListener* listener = 102 V8ObjectEventListener* listener =
103 static_cast<V8ObjectEventListener*>(imp->onmessage()); 103 static_cast<V8ObjectEventListener*>(imp->onmessage());
104 v8::Local<v8::Object> v8_listener = listener->GetListenerObject(); 104 v8::Local<v8::Object> v8_listener = listener->GetListenerObject();
105 RemoveHiddenDependency(info.Holder(), v8_listener); 105 RemoveHiddenDependency(info.Holder(), v8_listener);
106 } 106 }
107 107
108 // Clear the listener 108 // Clear the listener
109 imp->setOnmessage(0); 109 imp->setOnmessage(0);
110 110
111 } else { 111 } else {
112 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext()); 112 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext());
113 if (!proxy) 113 if (!proxy)
114 return; 114 return;
115 115
116 RefPtr<EventListener> listener = 116 RefPtr<EventListener> listener =
117 proxy->FindOrCreateObjectEventListener(value, false); 117 proxy->FindOrCreateObjectEventListener(value, false);
118 if (listener) { 118 if (listener) {
119 imp->setOnmessage(listener); 119 imp->setOnmessage(listener);
120 CreateHiddenDependency(info.Holder(), value); 120 CreateHiddenDependency(info.Holder(), value);
121 } 121 }
122 } 122 }
123 } 123 }
124 124
125 ACCESSOR_GETTER(MessagePortOnclose) { 125 ACCESSOR_GETTER(MessagePortOnclose) {
126 INC_STATS(L"DOM.MessagePort.onclose._get"); 126 INC_STATS("DOM.MessagePort.onclose._get");
127 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( 127 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>(
128 V8ClassIndex::MESSAGEPORT, info.Holder()); 128 V8ClassIndex::MESSAGEPORT, info.Holder());
129 if (imp->onclose()) { 129 if (imp->onclose()) {
130 V8ObjectEventListener* listener = 130 V8ObjectEventListener* listener =
131 static_cast<V8ObjectEventListener*>(imp->onclose()); 131 static_cast<V8ObjectEventListener*>(imp->onclose());
132 v8::Local<v8::Object> v8_listener = listener->GetListenerObject(); 132 v8::Local<v8::Object> v8_listener = listener->GetListenerObject();
133 return v8_listener; 133 return v8_listener;
134 } 134 }
135 return v8::Undefined(); 135 return v8::Undefined();
136 } 136 }
137 137
138 ACCESSOR_SETTER(MessagePortOnclose) { 138 ACCESSOR_SETTER(MessagePortOnclose) {
139 INC_STATS(L"DOM.MessagePort.onclose._set"); 139 INC_STATS("DOM.MessagePort.onclose._set");
140 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( 140 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>(
141 V8ClassIndex::MESSAGEPORT, info.Holder()); 141 V8ClassIndex::MESSAGEPORT, info.Holder());
142 if (value->IsNull()) { 142 if (value->IsNull()) {
143 if (imp->onclose()) { 143 if (imp->onclose()) {
144 V8ObjectEventListener* listener = 144 V8ObjectEventListener* listener =
145 static_cast<V8ObjectEventListener*>(imp->onclose()); 145 static_cast<V8ObjectEventListener*>(imp->onclose());
146 v8::Local<v8::Object> v8_listener = listener->GetListenerObject(); 146 v8::Local<v8::Object> v8_listener = listener->GetListenerObject();
147 RemoveHiddenDependency(info.Holder(), v8_listener); 147 RemoveHiddenDependency(info.Holder(), v8_listener);
148 } 148 }
149 149
150 // Clear the listener 150 // Clear the listener
151 imp->setOnclose(0); 151 imp->setOnclose(0);
152 } else { 152 } else {
153 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext()); 153 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext());
154 if (!proxy) 154 if (!proxy)
155 return; 155 return;
156 156
157 RefPtr<EventListener> listener = 157 RefPtr<EventListener> listener =
158 proxy->FindOrCreateObjectEventListener(value, false); 158 proxy->FindOrCreateObjectEventListener(value, false);
159 if (listener) { 159 if (listener) {
160 imp->setOnclose(listener); 160 imp->setOnclose(listener);
161 CreateHiddenDependency(info.Holder(), value); 161 CreateHiddenDependency(info.Holder(), value);
162 } 162 }
163 } 163 }
164 } 164 }
165 165
166 CALLBACK_FUNC_DECL(MessagePortStartConversation) { 166 CALLBACK_FUNC_DECL(MessagePortStartConversation) {
167 INC_STATS(L"DOM.MessagePort.StartConversation()"); 167 INC_STATS("DOM.MessagePort.StartConversation()");
168 if (args.Length() < 1) { 168 if (args.Length() < 1) {
169 V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Not enough arguments"); 169 V8Proxy::ThrowError(V8Proxy::SYNTAX_ERROR, "Not enough arguments");
170 return v8::Undefined(); 170 return v8::Undefined();
171 } 171 }
172 172
173 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( 173 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>(
174 V8ClassIndex::MESSAGEPORT, args.Holder()); 174 V8ClassIndex::MESSAGEPORT, args.Holder());
175 175
176 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext()); 176 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext());
177 if (!proxy) 177 if (!proxy)
178 return v8::Undefined(); 178 return v8::Undefined();
179 179
180 RefPtr<MessagePort> port = 180 RefPtr<MessagePort> port =
181 imp->startConversation(imp->scriptExecutionContext(), 181 imp->startConversation(imp->scriptExecutionContext(),
182 ToWebCoreString(args[0])); 182 ToWebCoreString(args[0]));
183 v8::Handle<v8::Value> wrapper = 183 v8::Handle<v8::Value> wrapper =
184 V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, port.get()); 184 V8Proxy::ToV8Object(V8ClassIndex::MESSAGEPORT, port.get());
185 return wrapper; 185 return wrapper;
186 } 186 }
187 187
188 CALLBACK_FUNC_DECL(MessagePortAddEventListener) { 188 CALLBACK_FUNC_DECL(MessagePortAddEventListener) {
189 INC_STATS(L"DOM.MessagePort.AddEventListener()"); 189 INC_STATS("DOM.MessagePort.AddEventListener()");
190 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( 190 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>(
191 V8ClassIndex::MESSAGEPORT, args.Holder()); 191 V8ClassIndex::MESSAGEPORT, args.Holder());
192 192
193 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext()); 193 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext());
194 if (!proxy) 194 if (!proxy)
195 return v8::Undefined(); 195 return v8::Undefined();
196 196
197 RefPtr<EventListener> listener = 197 RefPtr<EventListener> listener =
198 proxy->FindOrCreateObjectEventListener(args[1], false); 198 proxy->FindOrCreateObjectEventListener(args[1], false);
199 if (listener) { 199 if (listener) {
200 String type = ToWebCoreString(args[0]); 200 String type = ToWebCoreString(args[0]);
201 bool useCapture = args[2]->BooleanValue(); 201 bool useCapture = args[2]->BooleanValue();
202 imp->addEventListener(type, listener, useCapture); 202 imp->addEventListener(type, listener, useCapture);
203 203
204 CreateHiddenDependency(args.Holder(), args[1]); 204 CreateHiddenDependency(args.Holder(), args[1]);
205 } 205 }
206 return v8::Undefined(); 206 return v8::Undefined();
207 } 207 }
208 208
209 CALLBACK_FUNC_DECL(MessagePortRemoveEventListener) { 209 CALLBACK_FUNC_DECL(MessagePortRemoveEventListener) {
210 INC_STATS(L"DOM.MessagePort.RemoveEventListener()"); 210 INC_STATS("DOM.MessagePort.RemoveEventListener()");
211 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>( 211 MessagePort* imp = V8Proxy::ToNativeObject<MessagePort>(
212 V8ClassIndex::MESSAGEPORT, args.Holder()); 212 V8ClassIndex::MESSAGEPORT, args.Holder());
213 213
214 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext()); 214 V8Proxy* proxy = V8Proxy::retrieve(imp->scriptExecutionContext());
215 if (!proxy) 215 if (!proxy)
216 return v8::Undefined(); // probably leaked 216 return v8::Undefined(); // probably leaked
217 217
218 RefPtr<EventListener> listener = 218 RefPtr<EventListener> listener =
219 proxy->FindObjectEventListener(args[1], false); 219 proxy->FindObjectEventListener(args[1], false);
220 220
221 if (listener) { 221 if (listener) {
222 String type = ToWebCoreString(args[0]); 222 String type = ToWebCoreString(args[0]);
223 bool useCapture = args[2]->BooleanValue(); 223 bool useCapture = args[2]->BooleanValue();
224 imp->removeEventListener(type, listener.get(), useCapture); 224 imp->removeEventListener(type, listener.get(), useCapture);
225 225
226 RemoveHiddenDependency(args.Holder(), args[1]); 226 RemoveHiddenDependency(args.Holder(), args[1]);
227 } 227 }
228 228
229 return v8::Undefined(); 229 return v8::Undefined();
230 } 230 }
231 231
232 232
233 } // namespace WebCore 233 } // namespace WebCore
OLDNEW
« no previous file with comments | « webkit/port/bindings/scripts/CodeGeneratorV8.pm ('k') | webkit/port/bindings/v8/V8XMLHttpRequestCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698