-
Philip Chimento authored
This is the first in a series of refactors that will make object.cpp easier to maintain and eventually save memory by using two different private classes for instances and prototypes. This commit changes the ObjectInstance struct to be a C++ class. (Once we do that it becomes quite obvious that the class should be split into an instance and a prototype version; it has two constructors, and many methods that apply only to one or the other.) The way we distinguish instances and prototypes is that the GObject *m_gobj member is null in the prototype; but again this indicates why we need the refactor, since occasionally m_gobj is also null during object disposal. We try to keep the diff minimal by writing the methods in the same place where the equivalent C code was already written. This unfortunately leaves the code somewhat disordered compared to the class body declaration. The code is now a bit more readable due to small accessor methods such as is_prototype(), is_custom_js_class(), etc. These methods will likely be inlined by the compiler.
f311af8f