From 933a23d23270bba7b6a3a26c2424b299386b548e Mon Sep 17 00:00:00 2001 From: "jianli@chromium.org" Date: Fri, 3 Apr 2009 20:51:16 +0000 Subject: Chrome side change to use V8EventListenerList from upstream. This involves removing V8EventListenerList from v8_proxy and change the project files to compile V8EventListenerList. Review URL: http://codereview.chromium.org/60102 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13107 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/port/bindings/v8/v8_proxy.cpp | 85 ------------------------------------ 1 file changed, 85 deletions(-) (limited to 'webkit/port/bindings/v8/v8_proxy.cpp') diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index 54d24a9..5740c1e 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -50,91 +50,6 @@ namespace WebCore { -V8EventListenerList::V8EventListenerList(const char* name) -{ - ASSERT(strlen(name) <= kMaxKeyNameLength); - v8::HandleScope handleScope; - - // Write the name into a temporary buffer, leaving 1 space at the beginning - // for a prefix we'll vary between the inline and non-inline keys. - char keyBuffer[kMaxKeyNameLength + 2] = { 0 }; - strncpy(keyBuffer + 1, name, kMaxKeyNameLength); - keyBuffer[0] = '1'; - m_inlineKey = v8::Persistent::New(v8::String::New(keyBuffer)); - keyBuffer[0] = '2'; - m_nonInlineKey = v8::Persistent::New(v8::String::New(keyBuffer)); -} - -V8EventListenerList::~V8EventListenerList() -{ - m_inlineKey.Dispose(); - m_nonInlineKey.Dispose(); -} - -V8EventListenerList::iterator V8EventListenerList::begin() -{ - return m_list.begin(); -} - -V8EventListenerList::iterator V8EventListenerList::end() -{ - return m_list.end(); -} - -v8::Handle V8EventListenerList::getKey(bool isInline) -{ - if (isInline) - return m_inlineKey; - else - return m_nonInlineKey; -} - -// See comment in .h file for this function, and update accordingly if -// implementation details change here. -void V8EventListenerList::add(V8EventListener* listener) -{ - m_list.append(listener); - - v8::HandleScope handleScope; - v8::Local object = listener->getListenerObject(); - v8::Local value = v8::External::Wrap(listener); - object->SetHiddenValue(getKey(listener->isInline()), value); -} - -void V8EventListenerList::remove(V8EventListener* listener) -{ - v8::HandleScope handleScope; - for (size_t i = 0; i < m_list.size(); i++) { - V8EventListener* element = m_list.at(i); - if (element->isInline() == listener->isInline() && element == listener) { - v8::Local object = listener->getListenerObject(); - object->DeleteHiddenValue(getKey(listener->isInline())); - m_list.remove(i); - break; - } - } -} - -void V8EventListenerList::clear() -{ - v8::HandleScope handleScope; - for (size_t i = 0; i < m_list.size(); i++) { - V8EventListener* element = m_list.at(i); - v8::Local object = element->getListenerObject(); - object->DeleteHiddenValue(getKey(element->isInline())); - } - m_list.clear(); -} - -V8EventListener* V8EventListenerList::find(v8::Local object, bool isInline) -{ - v8::Local value = object->GetHiddenValue(getKey(isInline)); - if (value.IsEmpty()) - return 0; - return reinterpret_cast(v8::External::Unwrap(value)); -} - - // Static utility context. v8::Persistent V8Proxy::m_utilityContext; -- cgit v1.1