Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Unified Diff: plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java

Issue 14460007: Fix race condition in breakpoint synchronization helper (Closed) Base URL: https://chromedevtools.googlecode.com/svn/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java
diff --git a/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java b/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java
index 34ecf8a54b37734ced397228a41f85fd318329bf..8225a14f90cc6074883996708c87b1f1efb5275f 100644
--- a/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java
+++ b/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java
@@ -392,16 +392,33 @@ public class BreakpointSynchronizer {
private static class PlannedTaskHelper implements SyncCallback {
private final StatusBuilder statusBuilder;
private volatile Exception exception = null;
+ private boolean registerCalled = false;
+ private boolean doneCallDeferred = false;
PlannedTaskHelper(StatusBuilder statusBuilder) {
this.statusBuilder = statusBuilder;
}
void registerSelf(RelayOk relayOk) {
statusBuilder.plan(relayOk);
+ boolean needCallDeferred;
+ synchronized (this) {
+ registerCalled = true;
+ needCallDeferred = doneCallDeferred;
+ }
+ if (needCallDeferred) {
+ statusBuilder.done(exception);
+ }
}
public void callbackDone(RuntimeException e) {
if (e != null) {
exception = e;
}
+ synchronized (this) {
+ if (!registerCalled) {
+ // Defer until helper is registered.
+ doneCallDeferred = true;
+ return;
+ }
+ }
statusBuilder.done(exception);
}
void setException(Exception ex) {
@@ -410,7 +427,7 @@ public class BreakpointSynchronizer {
}
/**
- * A class that contains several conunters.
+ * A class that contains several counters.
*/
private static class ReportBuilder {
enum Property {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698