[V8] Make isValidDOMObject() static
authorharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2012 11:44:57 +0000 (11:44 +0000)
committerharaken@chromium.org <haraken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Nov 2012 11:44:57 +0000 (11:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=101914

Reviewed by Adam Barth.

isValidDOMObject() is used by DOMWrapper.cpp only.

No tests. No change in behavior.

* bindings/v8/V8DOMWrapper.cpp:
(WebCore::isValidDOMObject):
(WebCore):
(WebCore::V8DOMWrapper::maybeDOMWrapper):
* bindings/v8/V8DOMWrapper.h:
(V8DOMWrapper):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@134396 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/v8/V8DOMWrapper.cpp
Source/WebCore/bindings/v8/V8DOMWrapper.h

index 02f9b79..199cc40 100644 (file)
@@ -1,3 +1,21 @@
+2012-11-13  Kentaro Hara  <haraken@chromium.org>
+
+        [V8] Make isValidDOMObject() static
+        https://bugs.webkit.org/show_bug.cgi?id=101914
+
+        Reviewed by Adam Barth.
+
+        isValidDOMObject() is used by DOMWrapper.cpp only.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8DOMWrapper.cpp:
+        (WebCore::isValidDOMObject):
+        (WebCore):
+        (WebCore::V8DOMWrapper::maybeDOMWrapper):
+        * bindings/v8/V8DOMWrapper.h:
+        (V8DOMWrapper):
+
 2012-11-13  Mihnea Ovidenie  <mihnea@adobe.com>
 
         [CSSRegions] Incorrect computed height for content with region-break-before
index 28a9072..6d04e7f 100644 (file)
@@ -109,14 +109,17 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(WrapperTypeInfo* type, v
     return instance;
 }
 
-#ifndef NDEBUG
-bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value)
+static bool hasInternalField(v8::Handle<v8::Value> value)
 {
     if (value.IsEmpty() || !value->IsObject())
         return false;
+    return v8::Handle<v8::Object>::Cast(value)->InternalFieldCount();
+}
 
-    v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
-    if (!object->InternalFieldCount())
+#ifndef NDEBUG
+bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value)
+{
+    if (!hasInternalField(value))
         return false;
 
     ASSERT(object->InternalFieldCount() >= v8DefaultWrapperInternalFieldCount);
@@ -129,16 +132,9 @@ bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value)
 }
 #endif
 
-bool V8DOMWrapper::isValidDOMObject(v8::Handle<v8::Value> value)
-{
-    if (value.IsEmpty() || !value->IsObject())
-        return false;
-    return v8::Handle<v8::Object>::Cast(value)->InternalFieldCount();
-}
-
 bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, WrapperTypeInfo* type)
 {
-    if (!isValidDOMObject(value))
+    if (!hasInternalField(value))
         return false;
 
     v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value);
index 19d0e34..3c5684f 100644 (file)
@@ -105,8 +105,6 @@ namespace WebCore {
         template<typename T>
         static v8::Persistent<v8::Object> setJSWrapperForDOMObject(PassRefPtr<T>, v8::Handle<v8::Object>, v8::Isolate* = 0);
 
-        static bool isValidDOMObject(v8::Handle<v8::Value>);
-
         // Check whether a V8 value is a wrapper of type |classType|.
         static bool isWrapperOfType(v8::Handle<v8::Value>, WrapperTypeInfo*);