Confirmed users
398
edits
| (3 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 | 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 == | == Copy On Write == | ||
DOM objects are copy-on-write; a.k.a. COW, for modification. 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. | 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 == | ||