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

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

Issue 3195: Use static type information from IDL to streamline the wrapping and unwrappin... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 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 // 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 return v8::Local<v8::Object>::New(m_listener); 208 return v8::Local<v8::Object>::New(m_listener);
209 } 209 }
210 210
211 if (isWindowEvent) { 211 if (isWindowEvent) {
212 return v8::Context::GetCurrent()->Global(); 212 return v8::Context::GetCurrent()->Global();
213 } 213 }
214 214
215 EventTarget* target = event->currentTarget(); 215 EventTarget* target = event->currentTarget();
216 if (target->toNode()) { 216 if (target->toNode()) {
217 v8::Handle<v8::Value> value = 217 v8::Handle<v8::Value> value =
218 V8Proxy::ToV8Object(V8ClassIndex::NODE, target->toNode()); 218 V8Proxy::NodeToV8Object(target->toNode());
219 return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value)); 219 return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
220 220
221 } else if (target->toXMLHttpRequest()) { 221 } else if (target->toXMLHttpRequest()) {
222 v8::Handle<v8::Value> value = V8Proxy::ToV8Object( 222 v8::Handle<v8::Value> value = V8Proxy::ToV8Object(
223 V8ClassIndex::XMLHTTPREQUEST, target->toXMLHttpRequest()); 223 V8ClassIndex::XMLHTTPREQUEST, target->toXMLHttpRequest());
224 return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value)); 224 return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
225 225
226 } else { 226 } else {
227 ASSERT(false); 227 ASSERT(false);
228 return v8::Local<v8::Object>(); 228 return v8::Local<v8::Object>();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 } 299 }
300 300
301 301
302 v8::Local<v8::Object> V8LazyEventListener::GetThisObject(Event* event, 302 v8::Local<v8::Object> V8LazyEventListener::GetThisObject(Event* event,
303 bool isWindowEvent) { 303 bool isWindowEvent) {
304 if (isWindowEvent) { 304 if (isWindowEvent) {
305 return v8::Context::GetCurrent()->Global(); 305 return v8::Context::GetCurrent()->Global();
306 } 306 }
307 307
308 v8::Handle<v8::Value> value = 308 v8::Handle<v8::Value> value =
309 V8Proxy::ToV8Object(V8ClassIndex::NODE, event->currentTarget()->toNode()); 309 V8Proxy::NodeToV8Object(event->currentTarget()->toNode());
310 ASSERT(!value.IsEmpty()); 310 ASSERT(!value.IsEmpty());
311 311
312 return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value)); 312 return v8::Local<v8::Object>::New(v8::Handle<v8::Object>::Cast(value));
313 } 313 }
314 314
315 315
316 v8::Local<v8::Function> V8LazyEventListener::GetListenerFunction() { 316 v8::Local<v8::Function> V8LazyEventListener::GetListenerFunction() {
317 if (m_compiled) { 317 if (m_compiled) {
318 ASSERT(m_listener.IsEmpty() || m_listener->IsFunction()); 318 ASSERT(m_listener.IsEmpty() || m_listener->IsFunction());
319 return m_listener.IsEmpty() ? 319 return m_listener.IsEmpty() ?
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 m_wrapped_function->SetName(v8::String::New( 463 m_wrapped_function->SetName(v8::String::New(
464 FromWebCoreString(m_func_name), m_func_name.length())); 464 FromWebCoreString(m_func_name), m_func_name.length()));
465 } 465 }
466 } 466 }
467 } // end of local scope 467 } // end of local scope
468 468
469 return v8::Local<v8::Function>::New(m_wrapped_function); 469 return v8::Local<v8::Function>::New(m_wrapped_function);
470 } 470 }
471 471
472 } // namespace WebCore 472 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698