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

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

Issue 7089017: Change source look-up design (Closed) Base URL: https://chromedevtools.googlecode.com/svn/trunk
Patch Set: fcr Created 9 years, 6 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
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 a9e1467ef7225788ee0798c0b95fa0082a2fc46d..2f8d517e301b71f2d975b681fbe348efdea01e4d 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
@@ -4,6 +4,8 @@
package org.chromium.debug.core.model;
+import static org.chromium.debug.core.util.ChromiumDebugPluginUtil.getSafe;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -18,7 +20,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.chromium.debug.core.ChromiumDebugPlugin;
import org.chromium.debug.core.ChromiumSourceDirector;
import org.chromium.sdk.Breakpoint;
-import org.chromium.sdk.BreakpointTypeExtension;
import org.chromium.sdk.CallbackSemaphore;
import org.chromium.sdk.JavascriptVm;
import org.chromium.sdk.SyncCallback;
@@ -218,6 +219,9 @@ public class BreakpointSynchronizer {
for (Breakpoint sdkBreakpoint : sdkBreakpointsToCreate) {
Object sourceElement = sourceDirector.getSourceElement(sdkBreakpoint);
if (sourceElement instanceof IFile == false) {
+ statusBuilder.getReportBuilder().addProblem(
+ ReportBuilder.Problem.UNRESOLVED_REMOTE_BREAKPOINT,
+ sdkBreakpoint.getTarget().accept(BREAKPOINT_DEBUG_DESTINATION_VISITOR));
continue;
}
// We do not actually support working files for scripts with offset.
@@ -255,6 +259,20 @@ public class BreakpointSynchronizer {
}
}
+ private static final Breakpoint.Target.Visitor<String> BREAKPOINT_DEBUG_DESTINATION_VISITOR =
+ new Breakpoint.Target.Visitor<String>() {
+ @Override public String visitScriptName(String scriptName) {
+ return "script_name=" + scriptName;
+ }
+ @Override public String visitScriptId(long scriptId) {
+ return "script_id" + scriptId;
+ }
+ @Override public String visitUnknown(Breakpoint.Target target) {
+ return "Unknown target: + " + target;
+ }
+ };
+
+
private static class BreakpointMerger extends Merger<WrappedBreakpoint, Breakpoint> {
private final Direction direction;
private final List<WrappedBreakpoint> missingUi = new ArrayList<WrappedBreakpoint>();
@@ -396,8 +414,16 @@ public class BreakpointSynchronizer {
}
}
+ enum Problem {
+ UNRESOLVED_REMOTE_BREAKPOINT;
+ String getVisibleName() {
+ return toString();
+ }
+ }
+
private final Direction direction;
private final Map<Property, AtomicInteger> counters;
+ private final Map<Problem, List<String>> problems;
ReportBuilder(Direction direction) {
this.direction = direction;
@@ -405,12 +431,22 @@ public class BreakpointSynchronizer {
for (Property property : Property.class.getEnumConstants()) {
counters.put(property, new AtomicInteger(0));
}
+ problems = new HashMap<Problem, List<String>>(1);
}
public void increment(Property property) {
counters.get(property).addAndGet(1);
}
+ public synchronized void addProblem(Problem problem, String message) {
+ List<String> list = getSafe(problems, problem);
+ if (list == null) {
+ list = new ArrayList<String>();
+ problems.put(problem, list);
+ }
+ list.add(message);
+ }
+
public String build() {
StringBuilder builder = new StringBuilder();
builder.append("direction=").append(direction); //$NON-NLS-1$
@@ -422,6 +458,9 @@ public class BreakpointSynchronizer {
builder.append(" ").append(en.getKey().getVisibleName()); //$NON-NLS-1$
builder.append("=").append(number); //$NON-NLS-1$
}
+ if (!problems.isEmpty()) {
+ builder.append('\n').append(problems.toString());
+ }
return builder.toString();
}
}
@@ -484,12 +523,12 @@ public class BreakpointSynchronizer {
new Breakpoint.Target.Visitor<VmResourceId>() {
@Override
public VmResourceId visitScriptName(String scriptName) {
- return VmResourceId.forName(scriptName);
+ return new VmResourceId(scriptName, null);
}
@Override
public VmResourceId visitScriptId(long scriptId) {
- return VmResourceId.forId(scriptId);
+ return new VmResourceId(null, scriptId);
}
@Override

Powered by Google App Engine
This is Rietveld 408576698