Commit 7cd53ed1 authored by jamesr@google.com's avatar jamesr@google.com
Browse files

2010-04-27 James Robinson <jamesr@chromium.org>

        Reviewed by Adam Barth.

        Fix gcc 4.4.1 warnings on Linux in the chromium V8 bindings code.
        https://bugs.webkit.org/show_bug.cgi?id=38153

        * bindings/scripts/CodeGeneratorV8.pm:
        * bindings/v8/V8Proxy.cpp:
        (WebCore::V8Proxy::callFunction):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58345 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b35692d3
2010-04-27 James Robinson <jamesr@chromium.org>
Reviewed by Adam Barth.
Fix gcc 4.4.1 warnings on Linux in the chromium V8 bindings code.
https://bugs.webkit.org/show_bug.cgi?id=38153
* bindings/scripts/CodeGeneratorV8.pm:
* bindings/v8/V8Proxy.cpp:
(WebCore::V8Proxy::callFunction):
2010-04-27 Eric Seidel <eric@webkit.org>
 
Unreviewed, rolling out r58318.
......@@ -208,6 +208,7 @@ sub GetGValueTypeName {
"boolean", "boolean",
"char", "char",
"long", "long",
"long long", "int64",
"short", "int",
"uchar", "uchar",
"unsigned", "uint",
......@@ -232,6 +233,7 @@ sub GetGlibTypeName {
"boolean", "gboolean",
"char", "gchar",
"long", "glong",
"long long", "gint64",
"short", "gshort",
"uchar", "guchar",
"unsigned", "guint",
......@@ -255,6 +257,7 @@ sub IsGDOMClassType {
return 0 if $type eq "boolean";
return 0 if $type eq "char";
return 0 if $type eq "long";
return 0 if $type eq "long long";
return 0 if $type eq "short";
return 0 if $type eq "uchar";
return 0 if $type eq "unsigned";
......@@ -439,6 +442,7 @@ my %param_spec_options = ("int", "G_MININT, /* min */\nG_MAXINT, /* max */\n0, /
"double", "G_MINDOUBLE, /* min */\nG_MAXDOUBLE, /* max */\n0.0, /* default */",
"uint64", "0, /* min */\nG_MAXUINT64, /* min */\n0, /* default */",
"long", "G_MINLONG, /* min */\nG_MAXLONG, /* max */\n0, /* default */",
"int64", "G_MININT64, /* min */\nG_MAXINT64, /* max */\n0, /* default */",
"ulong", "0, /* min */\nG_MAXULONG, /* max */\n0, /* default */",
"uint", "0, /* min */\nG_MAXUINT, /* max */\n0, /* default */",
"ushort", "0, /* min */\nG_MAXUINT16, /* max */\n0, /* default */",
......@@ -584,6 +588,7 @@ sub getIncludeHeader {
return "" if $type eq "int";
return "" if $type eq "long";
return "" if $type eq "long long";
return "" if $type eq "short";
return "" if $type eq "char";
return "" if $type eq "float";
......
......@@ -2852,6 +2852,8 @@ sub ReturnNativeToJSValue
return "return v8::Integer::NewFromUnsigned($value)" if $nativeType eq "unsigned";
return "return v8DateOrNull($value)" if $type eq "Date";
# long long and unsigned long long are not representable in ECMAScript.
return "return v8::Number::New(static_cast<double>($value))" if $type eq "long long" or $type eq "unsigned long long";
return "return v8::Number::New($value)" if $codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType";
return "return $value.v8Value()" if $nativeType eq "ScriptValue";
......
......@@ -321,6 +321,44 @@ webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value)
}
gint64
webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
gint64 res = item->longLongAttr();
return res;
}
void
webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->setLongLongAttr(value);
}
guint64
webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self)
{
g_return_val_if_fail (self, 0);
WebCore::TestObj * item = WebKit::core(self);
guint64 res = item->unsignedLongLongAttr();
return res;
}
void
webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value)
{
g_return_if_fail (self);
WebCore::TestObj * item = WebKit::core(self);
item->setUnsignedLongLongAttr(value);
}
gchar*
webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self)
{
......@@ -462,6 +500,8 @@ enum {
PROP_READ_ONLY_STRING_ATTR,
PROP_READ_ONLY_TEST_OBJ_ATTR,
PROP_INT_ATTR,
PROP_LONG_LONG_ATTR,
PROP_UNSIGNED_LONG_LONG_ATTR,
PROP_STRING_ATTR,
PROP_TEST_OBJ_ATTR,
PROP_ATTR_WITH_EXCEPTION,
......@@ -498,6 +538,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con
coreSelf->setIntAttr((g_value_get_long(value)) );
break;
}
case PROP_UNSIGNED_LONG_LONG_ATTR:
{
coreSelf->setUnsignedLongLongAttr((g_value_get_uint64(value)) );
break;
}
case PROP_STRING_ATTR:
{
coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value)) );
......@@ -557,6 +602,16 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa
g_value_set_long(value, coreSelf->intAttr());
break;
}
case PROP_LONG_LONG_ATTR:
{
g_value_set_int64(value, coreSelf->longLongAttr());
break;
}
case PROP_UNSIGNED_LONG_LONG_ATTR:
{
g_value_set_uint64(value, coreSelf->unsignedLongLongAttr());
break;
}
case PROP_STRING_ATTR:
{
g_value_take_string(value, convertToUTF8String(coreSelf->stringAttr()));
......@@ -632,6 +687,24 @@ G_MAXLONG, /* max */
"read-write glong TestObj.int-attr", /* longer - could do with some extra doc stuff here */
G_MINLONG, /* min */
G_MAXLONG, /* max */
0, /* default */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
PROP_LONG_LONG_ATTR,
g_param_spec_int64("long-long-attr", /* name */
"test_obj_long-long-attr", /* short description */
"read-write gint64 TestObj.long-long-attr", /* longer - could do with some extra doc stuff here */
G_MININT64, /* min */
G_MAXINT64, /* max */
0, /* default */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
PROP_UNSIGNED_LONG_LONG_ATTR,
g_param_spec_uint64("unsigned-long-long-attr", /* name */
"test_obj_unsigned-long-long-attr", /* short description */
"read-write guint64 TestObj.unsigned-long-long-attr", /* longer - could do with some extra doc stuff here */
0, /* min */
G_MAXUINT64, /* min */
0, /* default */
WEBKIT_PARAM_READWRITE));
g_object_class_install_property(gobjectClass,
......
......@@ -127,6 +127,18 @@ webkit_dom_test_obj_get_int_attr (WebKitDOMTestObj *self);
WEBKIT_API void
webkit_dom_test_obj_set_int_attr (WebKitDOMTestObj *self, glong value);
WEBKIT_API gint64
webkit_dom_test_obj_get_long_long_attr (WebKitDOMTestObj *self);
WEBKIT_API void
webkit_dom_test_obj_set_long_long_attr (WebKitDOMTestObj *self, gint64 value);
WEBKIT_API guint64
webkit_dom_test_obj_get_unsigned_long_long_attr (WebKitDOMTestObj *self);
WEBKIT_API void
webkit_dom_test_obj_set_unsigned_long_long_attr (WebKitDOMTestObj *self, guint64 value);
WEBKIT_API gchar*
webkit_dom_test_obj_get_string_attr (WebKitDOMTestObj *self);
......
......@@ -45,12 +45,14 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj);
#define THUNK_GENERATOR(generator)
#endif
static const HashTableValue JSTestObjTableValues[12] =
static const HashTableValue JSTestObjTableValues[14] =
{
{ "readOnlyIntAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "readOnlyStringAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "readOnlyTestObjAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyTestObjAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "intAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjIntAttr), (intptr_t)setJSTestObjIntAttr THUNK_GENERATOR(0) },
{ "longLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongLongAttr), (intptr_t)setJSTestObjLongLongAttr THUNK_GENERATOR(0) },
{ "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) },
{ "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr THUNK_GENERATOR(0) },
{ "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr THUNK_GENERATOR(0) },
{ "attrWithException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithException), (intptr_t)setJSTestObjAttrWithException THUNK_GENERATOR(0) },
......@@ -247,6 +249,24 @@ JSValue jsTestObjIntAttr(ExecState* exec, JSValue slotBase, const Identifier&)
return result;
}
JSValue jsTestObjLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->longLongAttr());
return result;
}
JSValue jsTestObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->unsignedLongLongAttr());
return result;
}
JSValue jsTestObjStringAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
......@@ -315,6 +335,20 @@ void setJSTestObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value)
imp->setIntAttr(value.toInt32(exec));
}
void setJSTestObjLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThisObj = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
imp->setLongLongAttr(static_cast<long long>(value.toInteger(exec)));
}
void setJSTestObjUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThisObj = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThisObj->impl());
imp->setUnsignedLongLongAttr(static_cast<unsigned long long>(value.toInteger(exec)));
}
void setJSTestObjStringAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThisObj = static_cast<JSTestObj*>(thisObject);
......
......@@ -116,6 +116,10 @@ JSC::JSValue jsTestObjReadOnlyStringAttr(JSC::ExecState*, JSC::JSValue, const JS
JSC::JSValue jsTestObjReadOnlyTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
JSC::JSValue jsTestObjIntAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjIntAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjLongLongAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjLongLongAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjUnsignedLongLongAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjUnsignedLongLongAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
void setJSTestObjStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
JSC::JSValue jsTestObjTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
......
......@@ -39,6 +39,10 @@
- (DOMTestObj *)readOnlyTestObjAttr;
- (int)intAttr;
- (void)setIntAttr:(int)newIntAttr;
- (long long)longLongAttr;
- (void)setLongLongAttr:(long long)newLongLongAttr;
- (unsigned long long)unsignedLongLongAttr;
- (void)setUnsignedLongLongAttr:(unsigned long long)newUnsignedLongLongAttr;
- (NSString *)stringAttr;
- (void)setStringAttr:(NSString *)newStringAttr;
- (DOMTestObj *)testObjAttr;
......
......@@ -94,6 +94,26 @@
IMPL->setIntAttr(newIntAttr);
}
- (long long)longLongAttr
{
return IMPL->longLongAttr();
}
- (void)setLongLongAttr:(long long)newLongLongAttr
{
IMPL->setLongLongAttr(newLongLongAttr);
}
- (unsigned long long)unsignedLongLongAttr
{
return IMPL->unsignedLongLongAttr();
}
- (void)setUnsignedLongLongAttr:(unsigned long long)newUnsignedLongLongAttr
{
IMPL->setUnsignedLongLongAttr(newUnsignedLongLongAttr);
}
- (NSString *)stringAttr
{
return IMPL->stringAttr();
......
......@@ -35,6 +35,8 @@ module test {
readonly attribute DOMString readOnlyStringAttr;
readonly attribute TestObj readOnlyTestObjAttr;
attribute long intAttr;
attribute long long longLongAttr;
attribute unsigned long long unsignedLongLongAttr;
attribute DOMString stringAttr;
attribute TestObj testObjAttr;
......
......@@ -86,6 +86,38 @@ static void intAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> v
return;
}
static v8::Handle<v8::Value> longLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.longLongAttr._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
return v8::Number::New(static_cast<double>(imp->longLongAttr()));
}
static void longLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.longLongAttr._set");
TestObj* imp = V8TestObj::toNative(info.Holder());
long long v = toInt64(value);
imp->setLongLongAttr(WTF::getPtr(v));
return;
}
static v8::Handle<v8::Value> unsignedLongLongAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.unsignedLongLongAttr._get");
TestObj* imp = V8TestObj::toNative(info.Holder());
return v8::Number::New(static_cast<double>(imp->unsignedLongLongAttr()));
}
static void unsignedLongLongAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.unsignedLongLongAttr._set");
TestObj* imp = V8TestObj::toNative(info.Holder());
unsigned long long v = toInt64(value);
imp->setUnsignedLongLongAttr(WTF::getPtr(v));
return;
}
static v8::Handle<v8::Value> stringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.TestObj.stringAttr._get");
......@@ -522,6 +554,10 @@ static const BatchedAttribute TestObjAttrs[] = {
{"readOnlyTestObjAttr", TestObjInternal::readOnlyTestObjAttrAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'intAttr' (Type: 'attribute' ExtAttr: '')
{"intAttr", TestObjInternal::intAttrAttrGetter, TestObjInternal::intAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'longLongAttr' (Type: 'attribute' ExtAttr: '')
{"longLongAttr", TestObjInternal::longLongAttrAttrGetter, TestObjInternal::longLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'unsignedLongLongAttr' (Type: 'attribute' ExtAttr: '')
{"unsignedLongLongAttr", TestObjInternal::unsignedLongLongAttrAttrGetter, TestObjInternal::unsignedLongLongAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'stringAttr' (Type: 'attribute' ExtAttr: '')
{"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
// Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '')
......
......@@ -474,7 +474,7 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
#if ENABLE(INSPECTOR)
Page* inspectedPage = InspectorTimelineAgent::instanceCount() ? m_frame->page(): 0;
if (inspectedPage)
if (inspectedPage) {
if (InspectorTimelineAgent* timelineAgent = inspectedPage->inspectorTimelineAgent()) {
v8::ScriptOrigin origin = function->GetScriptOrigin();
String resourceName("undefined");
......@@ -486,6 +486,7 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8
timelineAgent->willCallFunction(resourceName, lineNumber);
} else
inspectedPage = 0;
}
#endif // !ENABLE(INSPECTOR)
m_recursion++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment