| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 v8::Handle<v8::String> wrapperProperty = getHiddenProperty(isAttribute); | 67 v8::Handle<v8::String> wrapperProperty = getHiddenProperty(isAttribute); |
| 68 listenerObject->DeleteHiddenValue(wrapperProperty); | 68 listenerObject->DeleteHiddenValue(wrapperProperty); |
| 69 } | 69 } |
| 70 | 70 |
| 71 static PassRefPtr<EventListener> getEventListener(v8::Local<v8::Value>, bool
isAttribute, ListenerLookupType); | 71 static PassRefPtr<EventListener> getEventListener(v8::Local<v8::Value>, bool
isAttribute, ListenerLookupType); |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 static V8EventListener* doFindWrapper(v8::Local<v8::Object> object, v8::Hand
le<v8::String> wrapperProperty) | 74 static V8EventListener* doFindWrapper(v8::Local<v8::Object> object, v8::Hand
le<v8::String> wrapperProperty) |
| 75 { | 75 { |
| 76 ASSERT(v8::Context::InContext()); | 76 ASSERT(v8::Context::InContext()); |
| 77 v8::HandleScope scope; | 77 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 78 v8::Local<v8::Value> listener = object->GetHiddenValue(wrapperProperty); | 78 v8::Local<v8::Value> listener = object->GetHiddenValue(wrapperProperty); |
| 79 if (listener.IsEmpty()) | 79 if (listener.IsEmpty()) |
| 80 return 0; | 80 return 0; |
| 81 return static_cast<V8EventListener*>(v8::External::Cast(*listener)->Valu
e()); | 81 return static_cast<V8EventListener*>(v8::External::Cast(*listener)->Valu
e()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 static inline v8::Handle<v8::String> getHiddenProperty(bool isAttribute) | 84 static inline v8::Handle<v8::String> getHiddenProperty(bool isAttribute) |
| 85 { | 85 { |
| 86 return isAttribute ? V8HiddenPropertyName::attributeListener() : V8Hidde
nPropertyName::listener(); | 86 return isAttribute ? V8HiddenPropertyName::attributeListener() : V8Hidde
nPropertyName::listener(); |
| 87 } | 87 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 104 RefPtr<V8EventListener> wrapperPtr = WrapperType::create(object, isAttribute
); | 104 RefPtr<V8EventListener> wrapperPtr = WrapperType::create(object, isAttribute
); |
| 105 if (wrapperPtr) | 105 if (wrapperPtr) |
| 106 object->SetHiddenValue(wrapperProperty, v8::External::New(wrapperPtr.get
())); | 106 object->SetHiddenValue(wrapperProperty, v8::External::New(wrapperPtr.get
())); |
| 107 | 107 |
| 108 return wrapperPtr; | 108 return wrapperPtr; |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace WebCore | 111 } // namespace WebCore |
| 112 | 112 |
| 113 #endif // V8EventListenerList_h | 113 #endif // V8EventListenerList_h |
| OLD | NEW |