Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 77903 Details for
Bug 202680
[update policy] Cache should use full element path as keys to cache data.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Update changing the key used in cache object.
update-2007_09_07.patch (text/plain), 8.75 KB, created by
Pawel Piech
on 2007-09-07 14:50:35 EDT
(
hide
)
Description:
Update changing the key used in cache object.
Filename:
MIME Type:
Creator:
Pawel Piech
Created:
2007-09-07 14:50:35 EDT
Size:
8.75 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.dd.dsf.ui >Index: src/org/eclipse/dd/dsf/ui/viewmodel/VMViewerUpdate.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.dd.dsf/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/VMViewerUpdate.java,v >retrieving revision 1.2 >diff -u -r1.2 VMViewerUpdate.java >--- src/org/eclipse/dd/dsf/ui/viewmodel/VMViewerUpdate.java 6 Jul 2007 20:36:30 -0000 1.2 >+++ src/org/eclipse/dd/dsf/ui/viewmodel/VMViewerUpdate.java 7 Sep 2007 18:51:36 -0000 >@@ -37,6 +37,7 @@ > > public Object getElement() { return fClientUpdate.getElement(); } > public TreePath getElementPath() { return fClientUpdate.getElementPath(); } >+ public Object getViewerInput() { return fClientUpdate.getViewerInput(); } > public IPresentationContext getPresentationContext() { return fClientUpdate.getPresentationContext(); } > > public IStatus getStatus() { return fRequestMonitor.getStatus(); } >Index: src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.dd.dsf/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java,v >retrieving revision 1.16 >diff -u -r1.16 AbstractVMLayoutNode.java >--- src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java 20 Jul 2007 23:24:35 -0000 1.16 >+++ src/org/eclipse/dd/dsf/ui/viewmodel/AbstractVMLayoutNode.java 7 Sep 2007 18:51:36 -0000 >@@ -454,7 +454,11 @@ > } > > public Object getElement() { >- return getElementPath().getLastSegment(); >+ return getElement(getElementPath()); >+ } >+ >+ public Object getViewerInput() { >+ return getVMProvider().getRootElement(); > } > > public IPresentationContext getPresentationContext() { return getVMProvider().getPresentationContext(); } >Index: src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.dd.dsf/plugins/org.eclipse.dd.dsf.ui/src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java,v >retrieving revision 1.13 >diff -u -r1.13 VMCache.java >--- src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java 7 Sep 2007 15:42:51 -0000 1.13 >+++ src/org/eclipse/dd/dsf/ui/viewmodel/update/VMCache.java 7 Sep 2007 18:51:36 -0000 >@@ -32,17 +32,43 @@ > import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenCountUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate; > import org.eclipse.debug.internal.ui.viewers.model.provisional.IHasChildrenUpdate; >+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate; >+import org.eclipse.jface.viewers.TreePath; > > @SuppressWarnings("restriction") > public abstract class VMCache > { >+ public static class CacheKey { >+ public final Object fViewerInput; >+ public final TreePath fPath; >+ public CacheKey(IViewerUpdate update) { >+ this(update.getViewerInput(), update.getElementPath()); >+ } >+ public CacheKey(Object viewerInput, TreePath path) { >+ fViewerInput = viewerInput; >+ fPath = path; >+ } >+ >+ @Override >+ public boolean equals(Object obj) { >+ return obj instanceof CacheKey && >+ ((CacheKey)obj).fViewerInput.equals(fViewerInput) && >+ ((CacheKey)obj).fPath.equals(fPath); >+ } >+ >+ @Override >+ public int hashCode() { >+ return fViewerInput.hashCode() + fPath.hashCode(); >+ } >+ } >+ > protected Executor fExecutor = new DefaultDsfExecutor(); > >- protected HashMap<Object, Integer> fChildrenCounts = new HashMap<Object, Integer>(); >+ protected HashMap<CacheKey, Integer> fChildrenCounts = new HashMap<CacheKey, Integer>(); > >- protected HashMap<Object, HashMap<Integer,Object>> fChildren = new HashMap<Object, HashMap<Integer,Object>>(); >+ protected HashMap<CacheKey, HashMap<Integer,Object>> fChildren = new HashMap<CacheKey, HashMap<Integer,Object>>(); > >- protected HashMap<Object, Boolean> fHasChildren = new HashMap<Object, Boolean>(); >+ protected HashMap<CacheKey, Boolean> fHasChildren = new HashMap<CacheKey, Boolean>(); > > protected HashMap<IDMContext<?>, IDMData> fData = new HashMap<IDMContext<?>, IDMData>(); > >@@ -66,9 +92,9 @@ > { > HashMap<?,?> oldCacheData[] = oldCache.getCacheData(); > >- fHasChildren = (HashMap<Object, Boolean>)oldCacheData[0]; >- fChildrenCounts = (HashMap<Object, Integer>)oldCacheData[1]; >- fChildren = (HashMap<Object, HashMap<Integer,Object>>)oldCacheData[2]; >+ fHasChildren = (HashMap<CacheKey, Boolean>)oldCacheData[0]; >+ fChildrenCounts = (HashMap<CacheKey, Integer>)oldCacheData[1]; >+ fChildren = (HashMap<CacheKey, HashMap<Integer,Object>>)oldCacheData[2]; > fData = (HashMap<IDMContext<?>, IDMData>)oldCacheData[3]; > fDataArchive = (HashMap<IDMContext<?>, IDMData>)oldCacheData[4]; > } >@@ -113,9 +139,10 @@ > Vector<IHasChildrenUpdate> missVector = new Vector<IHasChildrenUpdate>(); > for(IHasChildrenUpdate update : updates) > { >- if(fHasChildren.containsKey(update.getElement()) && isCacheReadEnabled()) >+ CacheKey updateKey = new CacheKey(update); >+ if(fHasChildren.containsKey(updateKey) && isCacheReadEnabled()) > { >- update.setHasChilren(fHasChildren.get(update.getElement()).booleanValue()); >+ update.setHasChilren(fHasChildren.get(updateKey).booleanValue()); > update.done(); > } > else >@@ -136,7 +163,7 @@ > if(getStatus().isOK()) > { > if(isCacheWriteEnabled()) >- fHasChildren.put(update.getElement(), this.getData()); >+ fHasChildren.put(new CacheKey(update), this.getData()); > update.setHasChilren(getData()); > } > update.done(); >@@ -156,9 +183,10 @@ > Vector<IChildrenCountUpdate> missVector = new Vector<IChildrenCountUpdate>(); > for(IChildrenCountUpdate update : updates) > { >- if(fChildrenCounts.containsKey(update.getElement()) && isCacheReadEnabled()) >+ CacheKey updateKey = new CacheKey(update); >+ if(fChildrenCounts.containsKey(updateKey) && isCacheReadEnabled()) > { >- update.setChildCount(fChildrenCounts.get(update.getElement())); >+ update.setChildCount(fChildrenCounts.get(updateKey)); > update.done(); > } > else >@@ -178,7 +206,7 @@ > if(getStatus().isOK()) > { > if(isCacheWriteEnabled()) >- fChildrenCounts.put(update.getElement(), this.getData()); >+ fChildrenCounts.put(new CacheKey(update), this.getData()); > update.setChildCount(this.getData()); > } > update.done(); >@@ -197,12 +225,13 @@ > Vector<IChildrenUpdate> updatesEntirelyMissingFromCache = new Vector<IChildrenUpdate>(); > for(final IChildrenUpdate update : updates) > { >- if(fChildren.containsKey(update.getElement()) && isCacheReadEnabled()) >+ CacheKey updateKey = new CacheKey(update); >+ if(fChildren.containsKey(updateKey) && isCacheReadEnabled()) > { > Vector<Integer> childrenMissingFromCache = new Vector<Integer>(); > for(int i = update.getOffset(); i < update.getOffset() + update.getLength(); i++) > childrenMissingFromCache.addElement(i); >- childrenMissingFromCache.removeAll(fChildren.get(update.getElement()).keySet()); >+ childrenMissingFromCache.removeAll(fChildren.get(updateKey).keySet()); > > if(childrenMissingFromCache.size() > 0) > { >@@ -265,7 +294,7 @@ > { > // we have all of the children in cache; return from cache > for(int position = update.getOffset(); position < update.getOffset() + update.getLength(); position++) >- update.setChild(fChildren.get(update.getElement()).get(position), position); >+ update.setChild(fChildren.get(updateKey).get(position), position); > update.done(); > } > } >@@ -293,10 +322,11 @@ > { > if(isCacheWriteEnabled()) > { >+ CacheKey updateKey = new CacheKey(update); > if(!fChildren.containsKey(update.getElement())) >- fChildren.put(update.getElement(), new HashMap<Integer,Object>()); >+ fChildren.put(updateKey, new HashMap<Integer,Object>()); > >- fChildren.get(update.getElement()).put(update.getOffset() + j, getData().get(j)); >+ fChildren.get(updateKey).put(update.getOffset() + j, getData().get(j)); > } > > update.setChild(getData().get(j), update.getOffset() + j);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
cdtdoug
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 202680
: 77903