Permalink
Browse files

core, break: deprecated object.dispose

  • Loading branch information...
xicilion committed Nov 1, 2017
1 parent a1ef84d commit a3e91bb9496d7e2e4eb1822f74f8c940ad03ed91
View
@@ -21,7 +21,6 @@ class object_base {
public:
// object_base
virtual result_t dispose() = 0;
virtual result_t toString(exlib::string& retVal) = 0;
virtual result_t toJSON(exlib::string key, v8::Local<v8::Value>& retVal) = 0;
@@ -37,7 +36,6 @@ class object_base {
}
public:
static void s_dispose(const v8::FunctionCallbackInfo<v8::Value>& args);
static void s_toString(const v8::FunctionCallbackInfo<v8::Value>& args);
static void s_toJSON(const v8::FunctionCallbackInfo<v8::Value>& args);
};
@@ -47,7 +45,6 @@ namespace fibjs {
inline ClassInfo& object_base::class_info()
{
static ClassData::ClassMethod s_method[] = {
{ "dispose", s_dispose, false },
{ "toString", s_toString, false },
{ "toJSON", s_toJSON, false }
};
@@ -62,19 +59,6 @@ inline ClassInfo& object_base::class_info()
return s_ci;
}
inline void object_base::s_dispose(const v8::FunctionCallbackInfo<v8::Value>& args)
{
METHOD_NAME("object.dispose");
METHOD_INSTANCE(object_base);
METHOD_ENTER();
METHOD_OVER(0, 0);
hr = pInst->dispose();
METHOD_VOID();
}
inline void object_base::s_toString(const v8::FunctionCallbackInfo<v8::Value>& args)
{
exlib::string vr;
View
@@ -421,7 +421,6 @@ class object_base : public obj_base {
DECLARE_CLASSINFO(object_base);
private:
static void s_dispose(const v8::FunctionCallbackInfo<v8::Value>& args);
static void s_toString(const v8::FunctionCallbackInfo<v8::Value>& args);
static void s_toJSON(const v8::FunctionCallbackInfo<v8::Value>& args);
};
@@ -474,7 +473,6 @@ inline void* ClassInfo::getInstance(void* o)
inline ClassInfo& object_base::class_info()
{
static ClassData::ClassMethod s_method[] = {
{ "dispose", s_dispose },
{ "toString", s_toString },
{ "toJSON", s_toJSON }
};
@@ -489,19 +487,6 @@ inline ClassInfo& object_base::class_info()
return s_ci;
}
inline void object_base::s_dispose(const v8::FunctionCallbackInfo<v8::Value>& args)
{
METHOD_NAME("object.dispose");
METHOD_INSTANCE(object_base);
METHOD_ENTER();
METHOD_OVER(0, 0);
hr = pInst->dispose();
METHOD_VOID();
}
inline void object_base::s_toString(const v8::FunctionCallbackInfo<v8::Value>& args)
{
exlib::string vr;
View
@@ -1,9 +1,6 @@
/*! @brief 基础对象,所有对象均继承于此*/
interface object
{
/*! @brief 强制回收对象,调用此方法后,对象资源将立即释放*/
dispose();
/*! @brief 返回对象的字符串表示,一般返回 "[Native Object]",对象可以根据自己的特性重新实现
@return 返回对象的字符串表示
*/
View
@@ -15,7 +15,6 @@ function f() {
s1.write("GET / HTTP/1.0\r\n\r\n");
s1.read(10240);
s1.close();
s1.dispose();
t = new Date().getTime() - t;
if (t > mt) mt = t;
sum += t;
View
@@ -42,7 +42,6 @@ describe("buffered stream", () => {
break;
assert.equal(d.toString(), s.substring(p, p + sz));
p += sz;
d.dispose();
}
f.close();
}
View
@@ -16,7 +16,6 @@ describe("mongodb", () => {
var mdb = db.open("mongodb://127.0.0.1/test");
mdb.close();
// var no1 = os.memoryUsage().nativeObjects.objects;
// mdb.dispose();
// assert.equal(no1 - 2, os.memoryUsage().nativeObjects.objects);
})
View
@@ -73,7 +73,6 @@ describe("net", () => {
c.send(b);
} finally {
c.close();
c.dispose();
}
}
@@ -99,7 +98,6 @@ describe("net", () => {
s1.send(new Buffer("GET / HTTP/1.0"));
assert.equal("GET / HTTP/1.0", s1.recv());
s1.close();
s1.dispose();
}
function conn() {
@@ -110,7 +108,6 @@ describe("net", () => {
s1.send(new Buffer("GET / HTTP/1.0"));
assert.equal("GET / HTTP/1.0", s1.recv());
s1.close();
s1.dispose();
}
conn_socket();
View
@@ -29,7 +29,8 @@ describe('os', () => {
var no1 = test_util.countObject('Buffer');
var b = new Buffer();
assert.equal(no1 + 1, test_util.countObject('Buffer'));
b.dispose();
b = undefined;
GC();
assert.equal(no1, test_util.countObject('Buffer'));
});
View
@@ -29,7 +29,6 @@ describe("profiler", () => {
it("take snapshot & dispose", () => {
var ss = profiler.takeSnapshot();
ss.dispose();
});
it("crash when double take", () => {
View
@@ -652,9 +652,6 @@ describe('xml', () => {
var childs = e.childNodes;
assert.equal(childs.length, 1);
assert.equal(e1.parentNode, e);
e.dispose();
assert.equal(childs.length, 0);
assert.equal(e1.parentNode, null);
});
});

0 comments on commit a3e91bb

Please sign in to comment.