VersionedDOM: Difference between revisions

(Created page with "The VersionedDOM enables to have multiple versions of the DOM nodes of a document at the same time in the memory. With VersionedDOM, the WEB content could modify DOM tree whi...")
 
 
(8 intermediate revisions by the same user not shown)
Line 6: Line 6:
To make the implementation more easier, versioned pointers assume there is one thread at most to modify the DOM three and create a new version at any moment, other threads can read the older versions at the same time.  So, the web content/main thread is the modifier in our case, and layout and renderer threads are readers.
To make the implementation more easier, versioned pointers assume there is one thread at most to modify the DOM three and create a new version at any moment, other threads can read the older versions at the same time.  So, the web content/main thread is the modifier in our case, and layout and renderer threads are readers.


The versioned pointers are implemented as a C++ template to override operators of assignment, casting, ... etc.  It is transparency for modifiers, they don't aware the existing of the versioned pointer.
The versioned pointers are implemented as C++ templates to override operators of assignment, casting, ... etc.  With the help of the template classes of versioned pointers, the modifiers would be changed minor.


The scope of the code of readers is far smaller than the modifier.  So, it is more easy to change the way of accessing pointers at readers side.  The readers are only the layout engine and the renderer.
The scope of the code of readers is far smaller than the modifier.  So, it is more easy to change the way of accessing pointers at readers side.  The readers are only the layout engine and the renderer.
* versioned pointer
** Hold pointers for objects
* const verioned pointer
** For read-only
* read-write versioned pointer
** For modifying the object, as a trigger to clone the object for the current version.
== Copy On Write ==
DOM objects are copy-on-write; a.k.a. COW, for modification of attributes other than versioned pointers.  A new version is start by a shadow of the previous version, an object are copied/cloned from the previous version at first time of being modified for the current version.  Then all changes are applied on the new instance.  With COW, the reader and modifier are not interactive, to make VersionedDOM simple and easy.


== Version Manager ==
== Version Manager ==
Line 15: Line 24:
== Version Reader ==
== Version Reader ==
The version readers are created with a given version number.  It provides the facility of reading the values of versioned pointers with the specified version.
The version readers are created with a given version number.  It provides the facility of reading the values of versioned pointers with the specified version.
== Problems ==
COW means memory copy.  It may cause the problem of massive changes on the DOM tree.  But, fortunately, for most cases, WEB content changes little.
Confirmed users
398

edits