diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 20:51:16 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 20:51:16 +0000 |
commit | 933a23d23270bba7b6a3a26c2424b299386b548e (patch) | |
tree | 3c42d8b6d0cd5053cdb9390a2d02b4df6ec73243 /webkit/port/bindings/v8/v8_proxy.cpp | |
parent | f16576d5803e57d36bf625cc3f23c9530f683dcd (diff) | |
download | chromium_src-933a23d23270bba7b6a3a26c2424b299386b548e.zip chromium_src-933a23d23270bba7b6a3a26c2424b299386b548e.tar.gz chromium_src-933a23d23270bba7b6a3a26c2424b299386b548e.tar.bz2 |
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
Diffstat (limited to 'webkit/port/bindings/v8/v8_proxy.cpp')
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 85 |
1 files changed, 0 insertions, 85 deletions
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<v8::String>::New(v8::String::New(keyBuffer)); - keyBuffer[0] = '2'; - m_nonInlineKey = v8::Persistent<v8::String>::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<v8::String> 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<v8::Object> object = listener->getListenerObject(); - v8::Local<v8::Value> 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<v8::Object> 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<v8::Object> object = element->getListenerObject(); - object->DeleteHiddenValue(getKey(element->isInline())); - } - m_list.clear(); -} - -V8EventListener* V8EventListenerList::find(v8::Local<v8::Object> object, bool isInline) -{ - v8::Local<v8::Value> value = object->GetHiddenValue(getKey(isInline)); - if (value.IsEmpty()) - return 0; - return reinterpret_cast<V8EventListener*>(v8::External::Unwrap(value)); -} - - // Static utility context. v8::Persistent<v8::Context> V8Proxy::m_utilityContext; |