Skip to content

Commit

Permalink
Merge vbufStorageCleanup branch which adds extra safety checks to pub…
Browse files Browse the repository at this point in the history
…lic functions in vbufBase, better handles controlField ID conflicts, and may provide some speed improvements when deleting a buffer.
  • Loading branch information
michaelDCurran committed May 9, 2011
2 parents 1f99986 + 5ed2bc2 commit 739375b
Show file tree
Hide file tree
Showing 4 changed files with 219 additions and 124 deletions.
17 changes: 9 additions & 8 deletions nvdaHelper/vbufBase/backend.cpp
Expand Up @@ -120,8 +120,11 @@ void VBufBackend_t::renderThread_terminate() {
runningBackends.erase(this);
}

void VBufBackend_t::invalidateSubtree(VBufStorage_controlFieldNode_t* node) {
nhAssert(node); //node can not be NULL
bool VBufBackend_t::invalidateSubtree(VBufStorage_controlFieldNode_t* node) {
if(!isNodeInBuffer(node)) {
LOG_DEBUGWARNING(L"Node at "<<node<<L" not in buffer at "<<this);
return false;
}
LOG_DEBUG(L"Invalidating node "<<node->getDebugInfo());
this->lock.acquire();
bool needsInsert=true;
Expand Down Expand Up @@ -156,6 +159,7 @@ void VBufBackend_t::invalidateSubtree(VBufStorage_controlFieldNode_t* node) {
}
this->lock.release();
this->requestUpdate();
return true;
}

void VBufBackend_t::update() {
Expand All @@ -181,15 +185,12 @@ void VBufBackend_t::update() {
LOG_DEBUG(L"Rendered content in temp buffer");
replacementSubtreeMap.insert(make_pair(node,tempBuf));
}
LOG_DEBUG(L"Clearing invalid subtree set");
this->lock.acquire();
LOG_DEBUG(L"Replacing nodes with content of temp buffers");
this->replaceSubtrees(replacementSubtreeMap);
this->lock.release();
//Delete all the temp buffers
for(map<VBufStorage_fieldNode_t*,VBufStorage_buffer_t*>::iterator i=replacementSubtreeMap.begin();i!=replacementSubtreeMap.end();++i) {
delete i->second;
if(!this->replaceSubtrees(replacementSubtreeMap)) {
LOG_DEBUGWARNING(L"Error replacing one or more subtrees");
}
this->lock.release();
} else {
LOG_DEBUG(L"Initial render");
this->lock.acquire();
Expand Down
2 changes: 1 addition & 1 deletion nvdaHelper/vbufBase/backend.h
Expand Up @@ -141,7 +141,7 @@ class VBufBackend_t : public VBufStorage_buffer_t {
* marks a particular node as invalid, so that its content is re-rendered on next update.
* @param node the node that should be invalidated.
*/
virtual void invalidateSubtree(VBufStorage_controlFieldNode_t*);
virtual bool invalidateSubtree(VBufStorage_controlFieldNode_t*);

/**
* Clears the content of the backend and terminates any code used for rendering.
Expand Down

0 comments on commit 739375b

Please sign in to comment.