- private void buildFlameGraph(CallGraphAnalysis callGraphAnalysis) {
- fTimeGraphViewer.setInput(null);
+ @VisibleForTesting
+ public void buildFlameGraph(CallGraphAnalysis callGraphAnalysis) {
+ /*
+ * Note for synchronization:
+ *
+ * Acquire the lock at entry. then we have 4 places to release it
+ *
+ * 1- if the lock failed
+ *
+ * 2- if the data is null and we have no UI to update
+ *
+ * 3- if the request is cancelled before it gets to the display
+ *
+ * 4- on a clean execution
+ */
+ try {
+ fLock.acquire();
+ } catch (InterruptedException e) {
+ Activator.getDefault().logError(e.getMessage(), e);
+ fLock.release();
+ }
+ if (callGraphAnalysis == null) {
+ fTimeGraphViewer.setInput(null);
+ fLock.release();
+ return;
+ }
+ fTimeGraphViewer.setInput(callGraphAnalysis.getSegmentStore());