components);
-
- /**
- * A wrapper for a pattern. It is implemented as a plain holder of JavaScript
- * RegExp source.
- */
- class ScriptNamePattern {
- private final String javaScriptString;
-
- public ScriptNamePattern(String javaScriptString) {
- this.javaScriptString = javaScriptString;
- }
-
- public String getJavaScriptRegExp() {
- return javaScriptString;
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/SourceNameMapperContainer.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/SourceNameMapperContainer.java
deleted file mode 100644
index e5c66ab3..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/SourceNameMapperContainer.java
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core;
-
-import org.chromium.debug.core.util.MementoFormat;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
-import org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * A special type of container that translates names of the source and delegates lookup
- * to another source container.
- * This could be useful when JS resource name is like "http://localhost/scripts/util.js"; such
- * source name could be converted into "scripts/util.js".
- * Currently container supports only prefix-based translation: if source name starts with a prefix,
- * the prefix is truncated; otherwise the source name is discarded.
- */
-public class SourceNameMapperContainer implements ISourceContainer {
-
- private static final String TYPE_ID =
- "org.chromium.debug.core.SourceNameMapperContainer.type"; //$NON-NLS-1$
-
- private final ISourceContainer targetContainer;
- private final String prefix;
-
- public SourceNameMapperContainer(String prefix, ISourceContainer targetContainer) {
- this.targetContainer = targetContainer;
- this.prefix = prefix;
- }
-
- public void dispose() {
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public ISourceContainer getTargetContainer() {
- return targetContainer;
- }
-
- public Object[] findSourceElements(String name) throws CoreException {
- if (!name.startsWith(prefix)) {
- return new Object[0];
- }
- String shortName = name.substring(prefix.length());
- return targetContainer.findSourceElements(shortName);
- }
-
-
- public String getName() {
- return NLS.bind(Messages.SourceNameMapperContainer_NAME, prefix);
- }
-
-
- public ISourceContainer[] getSourceContainers() {
- return new ISourceContainer[] { targetContainer };
- }
-
-
- public ISourceContainerType getType() {
- return DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(TYPE_ID);
- }
-
-
- public void init(ISourceLookupDirector director) {
- }
-
-
- public boolean isComposite() {
- return true;
- }
-
- private String getMemento() throws CoreException {
- StringBuilder builder = new StringBuilder();
- MementoFormat.encodeComponent(prefix, builder);
- MementoFormat.encodeComponent(targetContainer.getType().getId(), builder);
- MementoFormat.encodeComponent(targetContainer.getType().getMemento(targetContainer), builder);
- return builder.toString();
- }
-
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- /**
- * A type delegate that serializes/deserializes container instances into/from memento.
- */
- public static class TypeDelegate implements ISourceContainerTypeDelegate {
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- MementoFormat.Parser parser = new MementoFormat.Parser(memento);
- String prefix;
- String typeId;
- String subContainerMemento;
- try {
- prefix = parser.nextComponent();
- typeId = parser.nextComponent();
- subContainerMemento = parser.nextComponent();
- } catch (MementoFormat.ParserException e) {
- throw new CoreException(new Status(IStatus.ERROR,
- ChromiumDebugPlugin.PLUGIN_ID, "Failed to parse memento", e)); //$NON-NLS-1$
- }
- ISourceContainerType subContainerType =
- DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(typeId);
- ISourceContainer subContainer = subContainerType.createSourceContainer(subContainerMemento);
- return new SourceNameMapperContainer(prefix, subContainer);
- }
-
- public String getMemento(ISourceContainer container) throws CoreException {
- SourceNameMapperContainer chromeContainer = (SourceNameMapperContainer) container;
- return chromeContainer.getMemento();
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/VProjectSourceContainer.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/VProjectSourceContainer.java
deleted file mode 100644
index fe903d52..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/VProjectSourceContainer.java
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core;
-
-import org.chromium.debug.core.model.ResourceManager;
-import org.chromium.debug.core.model.VmResource;
-import org.chromium.debug.core.model.VmResourceId;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.sourcelookup.ISourceContainer;
-import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
-import org.eclipse.debug.core.sourcelookup.ISourceContainerTypeDelegate;
-import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
-
-/**
- * A source container implementation that wraps V8 virtual project. Currently virtual project
- * has a flat file structure, so the container is accordingly one-level.
- *
- * Unlike other implementation of {@link ISourceContainer} this class initially gets instantiated
- * with no data. In this state it serves as an empty container because actual VM scripts are
- * not available yet. Launch configuration UI will use it in this state more as a symbolic
- * place-holder in sources tab. Later when VM is connected, method
- * {@link #init(ISourceLookupDirector)} will be called and the actual content will be set.
- */
-public class VProjectSourceContainer implements ISourceContainer {
-
- private static final String TYPE_ID =
- "org.chromium.debug.core.VProjectSourceContainer.type"; //$NON-NLS-1$
-
- private ChromiumSourceDirector chromiumSourceDirector = null;
-
- VProjectSourceContainer() {
- }
-
- public void init(ISourceLookupDirector director) {
- if (director instanceof ChromiumSourceDirector) {
- chromiumSourceDirector = (ChromiumSourceDirector) director;
- }
- }
-
- public void dispose() {
- }
-
- public Object[] findSourceElements(String name) {
- if (chromiumSourceDirector == null) {
- return new Object[0];
- }
- ResourceManager resourceManager = chromiumSourceDirector.getResourceManager();
- LookupResult lookupResult = new LookupResult(resourceManager);
- return new Object[] { lookupResult };
- }
-
- public String getName() {
- IProject project = null;
- if (chromiumSourceDirector != null) {
- project = chromiumSourceDirector.getProject();
- }
- if (project == null) {
- return Messages.VProjectSourceContainer_DEFAULT_TYPE_NAME;
- } else {
- return project.getName();
- }
- }
-
- public ISourceContainer[] getSourceContainers() {
- return null;
- }
-
- public ISourceContainerType getType() {
- return DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(TYPE_ID);
- }
-
- public boolean isComposite() {
- return false;
- }
-
- public VmResourceId findScriptId(IFile resource) {
- if (chromiumSourceDirector == null) {
- throw new IllegalStateException();
- }
- return chromiumSourceDirector.getResourceManager().getResourceId(resource);
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- /**
- * A type delegate that implements a trivial memento. We do not save any actual data here,
- * because it all should be derived from a current VM launch.
- */
- public static class TypeDelegate implements ISourceContainerTypeDelegate {
- public ISourceContainer createSourceContainer(String memento) throws CoreException {
- return new VProjectSourceContainer();
- }
-
- public String getMemento(ISourceContainer container) throws CoreException {
- return "VProjectSourceContainer.memento.stub"; //$NON-NLS-1$
- }
- }
-
- /**
- * Result that {@link VProjectSourceContainer#findSourceElements(String)} returns instead of
- * IFile that other containers normally return. This result is could be converted to file
- * later in {@link ChromiumSourceDirector} where scriptId is available.
- *
If source director failed to process result, the back-up strategy could be to do
- * something in our implementation of ISourcePresentation.
- *
- */
- public static class LookupResult {
- private final ResourceManager resourceManager;
-
- LookupResult(ResourceManager resourceManager) {
- this.resourceManager = resourceManager;
- }
-
- public VmResource getVmResource(VmResourceId resourceId) {
- return resourceManager.getVmResource(resourceId);
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileStore.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileStore.java
deleted file mode 100755
index 65d0b234..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileStore.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.efs;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileStore;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * A script file store. Delegates all operations to the ChromiumScriptStorage
- * instance.
- */
-public class ChromiumScriptFileStore extends FileStore {
-
- /** The filesystem storage. */
- private static final ChromiumScriptStorage STORAGE = ChromiumScriptStorage.getInstance();
-
- /** The host filesystem of this resource. */
- private final ChromiumScriptFileSystem fileSystem;
-
- /** The resource path in the filesystem. */
- private final IPath path;
-
- /**
- * Constructs a proxy for a real resource (which might not exist).
- *
- * @param fileSystem that stores the resource
- * @param path of the resource
- */
- public ChromiumScriptFileStore(ChromiumScriptFileSystem fileSystem, IPath path) {
- this.fileSystem = fileSystem;
- this.path = path;
- }
-
- @Override
- public String[] childNames(int options, IProgressMonitor monitor) throws CoreException {
- return STORAGE.childNames(this.path);
- }
-
- @Override
- public IFileInfo fetchInfo(int options, IProgressMonitor monitor) throws CoreException {
- return STORAGE.fetchInfo(path, options);
- }
-
- @Override
- public IFileStore getChild(String name) {
- return fileSystem.getStore(path.append(name));
- }
-
- @Override
- public String getName() {
- if (path.isEmpty()) {
- return "ROOT"; //$NON-NLS-1$
- }
- return path.lastSegment();
- }
-
- @Override
- public IFileStore getParent() {
- if (path.segmentCount() == 0) {
- return null;
- }
- return new ChromiumScriptFileStore(fileSystem, path.removeLastSegments(1));
- }
-
- @Override
- public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException {
- return STORAGE.openInputStream(path, options);
- }
-
- @Override
- public OutputStream openOutputStream(int options, IProgressMonitor monitor) throws CoreException {
- return STORAGE.openOutputStream(path, options);
- }
-
- @Override
- public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreException {
- STORAGE.mkdir(path, options);
- return this;
- }
-
- @Override
- public URI toURI() {
- return ChromiumScriptFileSystem.getFileStoreUri(path);
- }
-
- @Override
- public void delete(int options, IProgressMonitor monitor) throws CoreException {
- STORAGE.delete(path, options);
- }
-
- @Override
- public void putInfo(IFileInfo info, int options, IProgressMonitor monitor) throws CoreException {
- STORAGE.putInfo(path, info, options);
- }
-
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileSystem.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileSystem.java
deleted file mode 100755
index 0de28330..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileSystem.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.efs;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.filesystem.provider.FileSystem;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-/**
- * An in-memory filesystem for remote scripts.
- * The supported URLs are {@code chromiumdebug:///resource_path}.
- */
-public class ChromiumScriptFileSystem extends FileSystem {
-
- /** All file URLs in this filesystem have this scheme. */
- private static final String CHROMIUMDEBUG_SCHEME = "chromiumdebug"; //$NON-NLS-1$
-
- @Override
- public IFileStore getStore(URI uri) {
- return new ChromiumScriptFileStore(this, toPath(uri));
- }
-
- public IFileStore getStore(IPath path) {
- return getStore(toUri(path));
- }
-
- /**
- * Constructs a URI by a path.
- *
- * @param path of a filesystem resource
- * @return a URI corresponding to the given {@code path}
- */
- public static URI getFileStoreUri(IPath path) {
- try {
- return new URI(CHROMIUMDEBUG_SCHEME, null, path.toPortableString(), null);
- } catch (URISyntaxException e) {
- ChromiumDebugPlugin.log(e);
- return null;
- }
- }
-
- public static boolean isChromiumDebugURI(URI uri) {
- return CHROMIUMDEBUG_SCHEME.equals(uri.getScheme());
- }
-
- /**
- * Converts a chromiumdebug FS FileStore URI into a path relative to the FS root.
- *
- * @param uri to convert
- * @return the path corresponding to the uri
- */
- static IPath toPath(URI uri) {
- return Path.fromPortableString(uri.getPath()).setDevice(null);
- }
-
- /**
- * Converts a chromiumdebug FS FileStore path into a FS URI.
- *
- * @param path to convert
- * @return the URI corresponding to the given path
- */
- static URI toUri(IPath path) {
- try {
- return new URI(CHROMIUMDEBUG_SCHEME, null, path.toPortableString(), null);
- } catch (URISyntaxException e) {
- return null;
- }
- }
-
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptStorage.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptStorage.java
deleted file mode 100755
index 8f82e35b..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptStorage.java
+++ /dev/null
@@ -1,328 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.efs;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.provider.FileInfo;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-
-/**
- * A memory-based storage for browser scripts. All resource-related EFS
- * operations are delegated into here.
- */
-public class ChromiumScriptStorage {
-
- /**
- * The filesystem root path.
- */
- // This one should go before INSTANCE.
- private static final IPath ROOT_PATH = new Path(null, ""); //$NON-NLS-1$
-
- private static final ChromiumScriptStorage INSTANCE = new ChromiumScriptStorage();
-
- public static ChromiumScriptStorage getInstance() {
- return INSTANCE;
- }
-
- private static abstract class CommonNode {
- final IPath path;
-
- final FileInfo info;
-
- final CommonNode parent;
-
- CommonNode(IPath path, FolderNode parent, boolean isDirectory) {
- this.path = path;
- this.parent = parent;
- this.info = new FileInfo(path.lastSegment());
- this.info.setDirectory(isDirectory);
- this.info.setExists(true);
- if (parent != null) {
- parent.add(this);
- }
- }
-
- String getName() {
- return info.getName();
- }
-
- boolean isFile() {
- return !info.isDirectory();
- }
-
- }
-
- private static class RootNode extends FolderNode {
- RootNode() {
- super(ROOT_PATH, null);
- if (parent != null) {
- throw new IllegalArgumentException("Parent must be null, was: " + parent); //$NON-NLS-1$
- }
- }
-
- @Override
- synchronized void add(CommonNode node) {
- if (node.isFile()) {
- throw new IllegalArgumentException("Cannot add files to the root"); //$NON-NLS-1$
- }
- super.add(node);
- }
-
- }
-
- /**
- * Contains other nodes.
- */
- private static class FolderNode extends CommonNode {
- private final Map children =
- Collections.synchronizedMap(new HashMap());
-
- FolderNode(IPath path, FolderNode parent) {
- super(path, parent, true);
- }
-
- void add(CommonNode node) {
- children.put(node.getName(), node);
- }
-
- void remove(String name) {
- // System.out.println(this.hashCode() + " removing " + name);
- CommonNode removedNode = children.remove(name);
- if (removedNode != null) {
- removedNode.info.setExists(false);
- }
- }
- }
-
- private static class FileNode extends CommonNode {
- private static final byte[] EMPTY_BYTES = new byte[0];
-
- protected volatile byte[] contents = EMPTY_BYTES;
-
- FileNode(IPath path, FolderNode parent) {
- super(path, parent, false);
- }
-
- synchronized InputStream getInputStream() {
- return new ByteArrayInputStream(contents);
- }
-
- synchronized OutputStream getOutputStream(final int options) {
- return new ByteArrayOutputStream() {
- @Override
- public void close() throws IOException {
- super.close();
- byte[] data;
- if ((options & EFS.APPEND) == 0) {
- data = this.toByteArray();
- } else {
- byte[] outputData = this.toByteArray();
- data = new byte[contents.length + this.size()];
- System.arraycopy(contents, 0, data, 0, contents.length);
- System.arraycopy(outputData, 0, data, contents.length, outputData.length);
- }
- setFileContents(data);
- }
- };
-
- }
-
- protected synchronized void setFileContents(byte[] data) {
- contents = data;
- info.setLength(data.length);
- info.setLastModified(System.currentTimeMillis());
- info.setExists(true);
- }
-
- }
-
- private static final String[] EMPTY_NAMES = new String[0];
-
- private final RootNode ROOT = new RootNode();
-
- private CommonNode find(IPath path) {
- if (path == null) {
- return null;
- }
- CommonNode currentNode = ROOT;
- // invariant: node(path[i]) is a folder
- for (int i = 0, length = path.segmentCount(); i < length; i++) {
- // > 1 segments
- if (currentNode == null || currentNode.isFile()) {
- // currentNode is not an existing folder
- return null;
- }
- // currentNode is a folder
- currentNode = ((FolderNode) currentNode).children.get(path.segment(i));
- }
- return currentNode;
- }
-
- String[] childNames(IPath path) {
- Map childrenMap = childNodes(path);
- if (childrenMap == null) {
- return EMPTY_NAMES;
- }
- return childrenMap.keySet().toArray(EMPTY_NAMES);
- }
-
- OutputStream openOutputStream(IPath path, int options) throws CoreException {
- CommonNode node = find(path);
- if (node == null) { // file does not exist
- if (path.segmentCount() > 0) {
- CommonNode parent = find(getParentPath(path));
- if (parent != null && !parent.isFile()) {
- FileNode fileNode = createFile(path, parent);
- return fileNode.getOutputStream(options);
- } else {
- throw newCoreException("Bad store path (no parent folder), child=" + path, null); //$NON-NLS-1$
- }
- } else {
- throw newCoreException("Cannot open OutputStream for the Root", null); //$NON-NLS-1$
- }
- }
- if (node.isFile()) {
- return ((FileNode) node).getOutputStream(options);
- } else {
- throw newCoreException("Cannot open a directory for writing: " + path, null); //$NON-NLS-1$
- }
- }
-
- void mkdir(IPath path, int options) throws CoreException {
- CommonNode node = find(path);
- if (node != null || path.segmentCount() == 0) { // folder exists
- return;
- }
- IPath parentPath = getParentPath(path);
- // parentPath will not be null due to the check above
- CommonNode parentNode = find(parentPath);
- if ((options & EFS.SHALLOW) != 0) {
- IPath chainPath = ROOT_PATH;
- CommonNode childNode = null;
- parentNode = find(ROOT_PATH);
- for (int i = 0, length = path.segmentCount(); i < length; i++) {
- chainPath = chainPath.append(path.segment(i));
- childNode = find(chainPath);
- if (childNode == null) {
- createFolder(chainPath, parentNode);
- parentNode = childNode;
- continue;
- }
- if (childNode.isFile()) {
- throw newCoreException("File encountered in the path: " + chainPath, null); //$NON-NLS-1$
- }
- }
- } else {
- if (parentNode == null) {
- throw newCoreException("Parent does not exist, child=" + path, null); //$NON-NLS-1$
- }
- // not shallow and parent exists
- if (!parentNode.isFile()) {
- createFolder(path, parentNode);
- } else {
- throw newCoreException("Parent is a file: " + parentNode.path, null); //$NON-NLS-1$
- }
- }
- }
-
- void delete(IPath path, int options) throws CoreException {
- CommonNode parent = find(getParentPath(path));
- if (parent == null) {
- return;
- }
- if (parent.isFile()) {
- throw newCoreException("Parent is not a directory: " + getParentPath(path), null); //$NON-NLS-1$
- }
- FolderNode parentFolder = (FolderNode) parent;
- parentFolder.remove(path.lastSegment());
- }
-
- InputStream openInputStream(IPath path, int options) throws CoreException {
- CommonNode node = find(path);
- if (node == null) {
- throw newCoreException("File not found: " + path, null); //$NON-NLS-1$
- }
- if (!node.isFile()) {
- throw newCoreException("Cannot open InputStream on directory: " + path, null); //$NON-NLS-1$
- }
- return ((FileNode) node).getInputStream();
- }
-
- IFileInfo fetchInfo(IPath path, int options) {
- CommonNode node = find(path);
- if (node == null) {
- FileInfo fileInfo = new FileInfo(path.lastSegment());
- fileInfo.setExists(false);
- return fileInfo;
- } else {
- return node.info;
- }
- }
-
- void putInfo(IPath path, IFileInfo info, int options) throws CoreException {
- CommonNode node = find(path);
- if (node == null) {
- throw newCoreException("The store does not exist: " + path, null); //$NON-NLS-1$
- } else {
- if ((options & EFS.SET_ATTRIBUTES) != 0) {
- copyAttribute(info, node.info, EFS.ATTRIBUTE_ARCHIVE);
- copyAttribute(info, node.info, EFS.ATTRIBUTE_EXECUTABLE);
- copyAttribute(info, node.info, EFS.ATTRIBUTE_HIDDEN);
- copyAttribute(info, node.info, EFS.ATTRIBUTE_LINK_TARGET);
- copyAttribute(info, node.info, EFS.ATTRIBUTE_READ_ONLY);
- }
- if ((options & EFS.SET_LAST_MODIFIED) != 0) {
- node.info.setLastModified(info.getLastModified());
- }
- }
- }
-
- private static void copyAttribute(IFileInfo from, IFileInfo to, int attribute) {
- to.setAttribute(attribute, from.getAttribute(attribute));
- }
-
- private static CoreException newCoreException(String message, Throwable cause) {
- return new CoreException(
- new Status(Status.ERROR, ChromiumDebugPlugin.PLUGIN_ID, message, cause));
- }
-
- private static IPath getParentPath(IPath path) {
- if (path.segmentCount() == 0) {
- return null;
- }
- return path.removeLastSegments(1);
- }
-
- private static void createFolder(IPath path, CommonNode parentNode) {
- new FolderNode(path, (FolderNode) parentNode);
- }
-
- private static FileNode createFile(IPath path, CommonNode parent) {
- return new FileNode(path, (FolderNode) parent);
- }
-
- private Map childNodes(IPath parent) {
- CommonNode node = find(parent);
- if (node == null || node.isFile()) {
- return null;
- }
- return ((FolderNode) node).children;
- }
-
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/messages.properties b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/messages.properties
deleted file mode 100755
index 89b06b02..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/messages.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2009 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-ChromiumDebugPlugin_InternalError=Internal Error
-ChromiumSourceDirector_WARNING_TEXT_PATTERN=You are running in ''auto-detect'' source look-up mode.\n\
- However the connected JavaScript VM (version="{0}") does not support it.\n\
- You won''t be able to set breakpoints except for scripts in virtual project.\n\
- \n\
- It is recommended that you switch to ''exact match' look-up mode (or get newer version of JavaScript VM).
-ChromiumSourceDirector_WARNING_TITLE=Auto-Detect Source Look-Up Mode Problem
-SourceNameMapperContainer_NAME=Source mapper with prefix {0}
-VProjectSourceContainer_DEFAULT_TYPE_NAME=Remote V8/Chrome Scripts
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ArrayValue.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ArrayValue.java
deleted file mode 100755
index aecae87b..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ArrayValue.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.util.Collections;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.chromium.sdk.JsArray;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IIndexedValue;
-import org.eclipse.debug.core.model.IVariable;
-
-/**
- * An IIndexedValue implementation for an array element range using a JsArray
- * instance.
- */
-public class ArrayValue extends Value implements IIndexedValue {
-
- private final AtomicReference elementsRef = new AtomicReference(null);
-
- public ArrayValue(EvaluateContext evaluateContext, JsArray array,
- ValueBase.ValueAsHostObject hostObject) {
- super(evaluateContext, array, hostObject);
- }
-
- private IVariable[] createElements() {
- JsArray jsArray = (JsArray) getJsValue();
- return StackFrame.wrapVariables(getEvaluateContext(), jsArray.getProperties(),
- ARRAY_HIDDEN_PROPERTY_NAMES,
- // Do not show internal properties for arrays (this may be an option).
- null, getHostObject(), null);
- }
-
- private IVariable[] getElements() {
- IVariable[] result = elementsRef.get();
- if (result == null) {
- result = createElements();
- elementsRef.compareAndSet(null, result);
- return elementsRef.get();
- } else {
- return result;
- }
- }
-
- public int getInitialOffset() {
- return 0;
- }
-
- public int getSize() throws DebugException {
- return getElements().length;
- }
-
- public IVariable getVariable(int offset) throws DebugException {
- return getElements()[offset];
- }
-
- public IVariable[] getVariables(int offset, int length) throws DebugException {
- IVariable[] result = new IVariable[length];
- System.arraycopy(getElements(), offset, result, 0, length);
- return result;
- }
-
- @Override
- public IVariable[] getVariables() throws DebugException {
- return getElements();
- }
-
- @Override
- public boolean hasVariables() throws DebugException {
- return getElements().length > 0;
- }
-
- private static final Set ARRAY_HIDDEN_PROPERTY_NAMES = Collections.singleton("length");
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointAdapterFactory.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointAdapterFactory.java
deleted file mode 100755
index 14072ce3..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointAdapterFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.util.ChromiumDebugPluginUtil;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Factory of LineBreakpointAdapters for browser scripts.
- */
-public class BreakpointAdapterFactory implements IAdapterFactory {
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof ITextEditor) {
- ITextEditor editorPart = (ITextEditor) adaptableObject;
- IResource resource =
- (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
- if (resource != null) {
- String extension = resource.getFileExtension();
- if (extension != null && ChromiumDebugPluginUtil.SUPPORTED_EXTENSIONS.contains(extension)) {
- return new LineBreakpointAdapter.ForVirtualProject();
- }
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList() {
- return new Class[] { IToggleBreakpointsTarget.class };
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointInTargetMap.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointInTargetMap.java
deleted file mode 100644
index 6ec5870b..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointInTargetMap.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import static org.chromium.sdk.util.BasicUtil.getSafe;
-import static org.chromium.sdk.util.BasicUtil.removeSafe;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * A one-to-one map between SDK and UI breakpoints inside one debug target.
- */
-public class BreakpointInTargetMap {
- private final Map sdkToUiMap = new HashMap();
- private final Map uiToSdkMap = new HashMap();
-
- public BreakpointInTargetMap() {
- }
-
- public synchronized SDK getSdkBreakpoint(UI uiBreakpoint) {
- return getSafe(uiToSdkMap, uiBreakpoint);
- }
-
- public synchronized UI getUiBreakpoint(SDK sdkBreakpoint) {
- return getSafe(sdkToUiMap, sdkBreakpoint);
- }
-
- public synchronized void add(SDK sdkBreakpoint, UI uiBreakpoint) {
- Object conflict1 = uiToSdkMap.put(uiBreakpoint, sdkBreakpoint);
- Object conflict2 = sdkToUiMap.put(sdkBreakpoint, uiBreakpoint);
- if (conflict1 != null || conflict2 != null) {
- throw new RuntimeException();
- }
- }
-
- public synchronized void remove(UI uiBreakpoint) {
- SDK sdkBreakpoint = removeSafe(uiToSdkMap, uiBreakpoint);
- if (sdkBreakpoint == null) {
- throw new RuntimeException();
- }
- removeSafe(sdkToUiMap, sdkBreakpoint);
- }
-
- public synchronized void clear() {
- sdkToUiMap.clear();
- uiToSdkMap.clear();
- }
-}
\ No newline at end of file
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java
deleted file mode 100644
index 34ecf8a5..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointSynchronizer.java
+++ /dev/null
@@ -1,731 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import static org.chromium.sdk.util.BasicUtil.getSafe;
-import static org.chromium.sdk.util.BasicUtil.removeSafe;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.ChromiumSourceDirector;
-import org.chromium.debug.core.ScriptNameManipulator.ScriptNamePattern;
-import org.chromium.debug.core.util.ChromiumDebugPluginUtil;
-import org.chromium.sdk.Breakpoint;
-import org.chromium.sdk.BreakpointTypeExtension;
-import org.chromium.sdk.CallbackSemaphore;
-import org.chromium.sdk.JavascriptVm;
-import org.chromium.sdk.RelayOk;
-import org.chromium.sdk.SyncCallback;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * A class responsible for comparing breakpoints in workspace and on remote VM and synchronizing
- * them in both directions. {@link Direction#RESET_REMOTE} allows several synchronization
- * jobs to different VMs.
- */
-public class BreakpointSynchronizer {
- private final JavascriptVm javascriptVm;
- private final ChromiumSourceDirector sourceDirector;
- private final BreakpointHelper breakpointHelper;
- private final String debugModelId;
-
- public BreakpointSynchronizer(JavascriptVm javascriptVm,
- ChromiumSourceDirector sourceDirector, BreakpointHelper breakpointHelper,
- String debugModelId) {
- this.javascriptVm = javascriptVm;
- this.sourceDirector = sourceDirector;
- this.breakpointHelper = breakpointHelper;
- this.debugModelId = debugModelId;
- }
-
- /**
- * Describes a direction the breakpoint synchronization should be performed in.
- */
- public enum Direction {
-
- /**
- * All breakpoints in remote VM/VMs are cleared/updated/created to conform to breakpoints in
- * Eclipse workspace.
- */
- RESET_REMOTE,
-
- /**
- * All breakpoints in local workspace are cleared/updated/created to conform to breakpoints in
- * remote VM (not applicable for multiple VMs).
- */
- RESET_LOCAL,
-
- /**
- * Breakpoints are created locally or remotely or tied together so that every breakpoint
- * has a counterpart on other side.
- */
- MERGE
- }
-
- /**
- * Additional interface used by {@link BreakpointSynchronizer}.
- */
- public interface BreakpointHelper {
- /**
- * Create breakpoint on remote VM (asynchronously) and link it to uiBreakpoint.
- */
- RelayOk createBreakpointOnRemote(ChromiumLineBreakpoint uiBreakpoint,
- VmResourceRef vmResourceRef,
- CreateCallback createCallback, SyncCallback syncCallback) throws CoreException;
-
- BreakpointInTargetMap getLineBreakpointMap();
-
- void registerExceptionBreakpoint(Collection breakpoints);
-
- interface CreateCallback {
- void failure(Exception ex);
- void success();
- }
- }
-
- public interface Callback {
- void onDone(IStatus status);
- }
-
- /**
- * The main entry method of the class. Asynchronously performs synchronization job.
- */
- public void syncBreakpoints(Direction direction, Callback callback) {
- ReportBuilder reportBuilder = new ReportBuilder(direction);
- StatusBuilder statusBuilder = new StatusBuilder(callback, reportBuilder);
-
- statusBuilder.plan(UNCODITIONALLY_RELAY_TO_REST_OF_METHOD_OK);
- Exception ex = null;
- try {
- syncBreakpointsImpl(direction, statusBuilder);
- } catch (RuntimeException e) {
- ex = e;
- } finally {
- statusBuilder.done(ex);
- }
- }
-
- private static final RelayOk UNCODITIONALLY_RELAY_TO_REST_OF_METHOD_OK = new RelayOk() {};
-
- private void syncBreakpointsImpl(final Direction direction, final StatusBuilder statusBuilder) {
- // Collect the remote breakpoints.
- Collection extends Breakpoint> sdkBreakpoints = readSdkBreakpoints(javascriptVm);
- // Collect all local breakpoints.
- ChromiumBreakpointsFiltered uiBreakpoints = getUiBreakpoints();
-
- List lineSdkBreakpoints = new ArrayList(sdkBreakpoints.size());
-
- if (direction != Direction.MERGE) {
- breakpointHelper.getLineBreakpointMap().clear();
- }
-
- // Throw away all already linked breakpoints and put remaining into lineSdkBreakpoints list.
- for (Breakpoint sdkBreakpoint : sdkBreakpoints) {
- ChromiumLineBreakpoint uiBreakpoint =
- breakpointHelper.getLineBreakpointMap().getUiBreakpoint(sdkBreakpoint);
- if (uiBreakpoint == null) {
- // No mapping. Schedule for further processing.
- lineSdkBreakpoints.add(sdkBreakpoint);
- } else {
- // There is a live mapping. This set should also contain this breakpoint.
- removeSafe(uiBreakpoints.getLineBreakpoints(), uiBreakpoint);
- statusBuilder.getReportBuilder().increment(ReportBuilder.Property.LINKED);
- }
- }
-
- // Sort all breakpoints by (script_name, line_number).
- SortedBreakpoints sortedUiBreakpoints =
- sortBreakpoints(uiBreakpoints.getLineBreakpoints(), uiBreakpointHandler);
- SortedBreakpoints sortedSdkBreakpoints =
- sortBreakpoints(lineSdkBreakpoints, sdkBreakpointHandler);
-
- BreakpointMerger breakpointMerger =
- new BreakpointMerger(direction, breakpointHelper.getLineBreakpointMap());
-
- // Find all unlinked breakpoints on both sides.
- mergeBreakpoints(breakpointMerger, sortedUiBreakpoints, sortedSdkBreakpoints);
-
- List sdkBreakpointsToDelete;
- List sdkBreakpointsToCreate;
- List uiBreakpointsToDelete;
- List uiBreakpointsToCreate;
-
- // Plan actions for all breakpoints without pair.
- if (direction == Direction.RESET_REMOTE) {
- sdkBreakpointsToDelete = breakpointMerger.getMissingSdk();
- sdkBreakpointsToCreate = Collections.emptyList();
- } else {
- sdkBreakpointsToCreate = breakpointMerger.getMissingSdk();
- sdkBreakpointsToDelete = Collections.emptyList();
- }
-
- if (direction == Direction.RESET_LOCAL) {
- uiBreakpointsToDelete = breakpointMerger.getMissingUi();
- uiBreakpointsToCreate = Collections.emptyList();
- } else {
- uiBreakpointsToCreate = breakpointMerger.getMissingUi();
- uiBreakpointsToDelete = Collections.emptyList();
- }
-
- // First delete everything, then create (we may need to re-create some breakpoints, so order
- // is significant).
- deteleBreakpoints(sdkBreakpointsToDelete, uiBreakpointsToDelete, statusBuilder);
- createBreakpoints(sdkBreakpointsToCreate, uiBreakpointsToCreate, statusBuilder);
-
- breakpointHelper.registerExceptionBreakpoint(uiBreakpoints.getExceptionBreakpoints());
- }
-
- private void deteleBreakpoints(List sdkBreakpointsToDelete,
- List uiBreakpointsToDelete, final StatusBuilder statusBuilder) {
- for (Breakpoint sdkBreakpoint : sdkBreakpointsToDelete) {
- final PlannedTaskHelper deleteTaskHelper = new PlannedTaskHelper(statusBuilder);
- JavascriptVm.BreakpointCallback callback = new JavascriptVm.BreakpointCallback() {
- public void failure(String errorMessage) {
- deleteTaskHelper.setException(new Exception(errorMessage));
- }
- public void success(Breakpoint breakpoint) {
- statusBuilder.getReportBuilder().increment(ReportBuilder.Property.DELETED_ON_REMOTE);
- }
- };
- RelayOk relayOk = sdkBreakpoint.clear(callback, deleteTaskHelper);
- deleteTaskHelper.registerSelf(relayOk);
- }
- for (ChromiumLineBreakpoint uiBreakpoint : uiBreakpointsToDelete) {
- ChromiumLineBreakpoint.getIgnoreList().add(uiBreakpoint);
- try {
- try {
- uiBreakpoint.delete();
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- } finally {
- ChromiumLineBreakpoint.getIgnoreList().remove(uiBreakpoint);
- }
- statusBuilder.getReportBuilder().increment(ReportBuilder.Property.DELETED_LOCALLY);
- }
- }
-
- private void createBreakpoints(List sdkBreakpointsToCreate,
- List uiBreakpointsToCreate, final StatusBuilder statusBuilder) {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- 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(ChromiumDebugPluginUtil.BREAKPOINT_TARGET_TO_STRING));
- continue;
- }
- // We do not actually support working files for scripts with offset.
- int script_line_offset = 0;
- IFile resource = (IFile) sourceElement;
- ChromiumLineBreakpoint uiBreakpoint;
- try {
- uiBreakpoint = ChromiumLineBreakpoint.Helper.createLocal(
- sdkBreakpoint, breakpointManager, resource, script_line_offset, debugModelId);
- breakpointHelper.getLineBreakpointMap().add(sdkBreakpoint, uiBreakpoint);
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- statusBuilder.getReportBuilder().increment(ReportBuilder.Property.CREATED_LOCALLY);
- }
- for (ChromiumLineBreakpoint uiBreakpoint : uiBreakpointsToCreate) {
- VmResourceRef vmResourceRef = uiBreakpointHandler.getVmResourceRef(uiBreakpoint);
- if (vmResourceRef == null) {
- // Actually we should not get here, because getScript call succeeded before.
- continue;
- }
-
- final PlannedTaskHelper createTaskHelper = new PlannedTaskHelper(statusBuilder);
- BreakpointHelper.CreateCallback createCallback = new BreakpointHelper.CreateCallback() {
- public void success() {
- statusBuilder.getReportBuilder().increment(ReportBuilder.Property.CREATED_ON_REMOTE);
- }
- public void failure(Exception ex) {
- createTaskHelper.setException(ex);
- }
- };
- try {
- RelayOk relayOk = breakpointHelper.createBreakpointOnRemote(uiBreakpoint, vmResourceRef,
- createCallback, createTaskHelper);
- createTaskHelper.registerSelf(relayOk);
- } catch (CoreException e) {
- statusBuilder.addOnStartException(e);
- }
- }
- }
-
- private static class BreakpointMerger extends Merger {
- private final Direction direction;
- private final List missingUi = new ArrayList();
- private final List missingSdk = new ArrayList();
- private final BreakpointInTargetMap breakpointMap;
-
- BreakpointMerger(Direction direction,
- BreakpointInTargetMap breakpointMap) {
- this.direction = direction;
- this.breakpointMap = breakpointMap;
- }
- @Override
- void both(ChromiumLineBreakpoint v1, Breakpoint v2) {
- if (direction == Direction.MERGE) {
- breakpointMap.add(v2, v1);
- } else {
- onlyFirst(v1);
- onlySecond(v2);
- }
- }
- @Override
- void onlyFirst(ChromiumLineBreakpoint v1) {
- missingUi.add(v1);
- }
- @Override
- void onlySecond(Breakpoint v2) {
- missingSdk.add(v2);
- }
- List getMissingUi() {
- return missingUi;
- }
- List getMissingSdk() {
- return missingSdk;
- }
- }
-
- /**
- * A class responsible for creating a summary status of synchronization operation. The status
- * is created once all asynchronous jobs have finished. Each job first registers itself
- * via {@link #plan()} method and
- * later reports its result via {@link #done(Exception)} method.
- * When the last job is reporting its finishing, the status gets built and sent to
- * {@link #callback}. If no exceptions were registered,
- * status contains text report from {@link ReportBuilder}.
- */
- private static class StatusBuilder {
- private final Callback callback;
- private int plannedNumber = 0;
- private final List exceptions = new ArrayList(0);
- private boolean alreadyReported = false;
- private final ReportBuilder reportBuilder;
-
- StatusBuilder(Callback callback, ReportBuilder reportBuilder) {
- this.callback = callback;
- this.reportBuilder = reportBuilder;
- }
-
- ReportBuilder getReportBuilder() {
- return reportBuilder;
- }
-
- public synchronized void plan(RelayOk relayOk) {
- if (alreadyReported) {
- throw new IllegalStateException();
- }
- plannedNumber++;
- }
-
- public void done(Exception ex) {
- boolean timeToReport = doneImpl(ex);
- if (timeToReport) {
- reportResult();
- }
- }
-
- public synchronized void addOnStartException(Exception ex) {
- exceptions.add(ex);
- }
-
- private synchronized boolean doneImpl(Exception ex) {
- if (ex != null) {
- exceptions.add(ex);
- }
- plannedNumber--;
- if (plannedNumber == 0) {
- if (!alreadyReported) {
- alreadyReported = true;
- return true;
- }
- }
- return false;
- }
-
- private void reportResult() {
- IStatus status;
- if (exceptions.isEmpty()) {
- status = new Status(IStatus.OK, ChromiumDebugPlugin.PLUGIN_ID,
- "Breakpoint synchronization done: " + reportBuilder.build(), null); //$NON-NLS-1$
- } else {
- IStatus[] subStatuses = new IStatus[exceptions.size()];
- for (int i = 0 ; i < subStatuses.length; i++) {
- subStatuses[i] = new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
- exceptions.get(i).getMessage(), exceptions.get(i));
- }
- status = new MultiStatus(ChromiumDebugPlugin.PLUGIN_ID, IStatus.ERROR, subStatuses,
- "Breakpoint synchronization errors", null); //$NON-NLS-1$
- }
- if (callback != null) {
- callback.onDone(status);
- }
- }
- }
-
- private static class PlannedTaskHelper implements SyncCallback {
- private final StatusBuilder statusBuilder;
- private volatile Exception exception = null;
- PlannedTaskHelper(StatusBuilder statusBuilder) {
- this.statusBuilder = statusBuilder;
- }
- void registerSelf(RelayOk relayOk) {
- statusBuilder.plan(relayOk);
- }
- public void callbackDone(RuntimeException e) {
- if (e != null) {
- exception = e;
- }
- statusBuilder.done(exception);
- }
- void setException(Exception ex) {
- exception = ex;
- }
- }
-
- /**
- * A class that contains several conunters.
- */
- private static class ReportBuilder {
- enum Property {
- LINKED,
- CREATED_LOCALLY,
- DELETED_LOCALLY,
- CREATED_ON_REMOTE,
- DELETED_ON_REMOTE;
- String getVisibleName() {
- return toString();
- }
- }
-
- enum Problem {
- UNRESOLVED_REMOTE_BREAKPOINT;
- String getVisibleName() {
- return toString();
- }
- }
-
- private final Direction direction;
- private final Map counters;
- private final Map> problems;
-
- ReportBuilder(Direction direction) {
- this.direction = direction;
- counters = new EnumMap(Property.class);
- for (Property property : Property.class.getEnumConstants()) {
- counters.put(property, new AtomicInteger(0));
- }
- problems = new HashMap>(1);
- }
-
- public void increment(Property property) {
- counters.get(property).addAndGet(1);
- }
-
- public synchronized void addProblem(Problem problem, String message) {
- List list = getSafe(problems, problem);
- if (list == null) {
- list = new ArrayList();
- problems.put(problem, list);
- }
- list.add(message);
- }
-
- public String build() {
- StringBuilder builder = new StringBuilder();
- builder.append("direction=").append(direction); //$NON-NLS-1$
- for (Map.Entry en : counters.entrySet()) {
- int number = en.getValue().get();
- if (number == 0) {
- continue;
- }
- 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();
- }
- }
-
- /**
- * A handler for properties of breakpoint type B that helps reading them.
- */
- private static abstract class PropertyHandler {
- /** @return vm resource name or null */
- abstract VmResourceRef getVmResourceRef(B breakpoint);
- /** @return 0-based number */
- abstract long getLineNumber(B breakpoint);
- }
-
- private final PropertyHandler uiBreakpointHandler =
- new PropertyHandler() {
- @Override
- long getLineNumber(ChromiumLineBreakpoint chromiumLineBreakpoint) {
- int lineNumber;
- try {
- // TODO(peter.rybin): Consider supporting inline scripts here.
- return chromiumLineBreakpoint.getLineNumber() - 1;
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- VmResourceRef getVmResourceRef(ChromiumLineBreakpoint chromiumLineBreakpoint) {
- IMarker marker = chromiumLineBreakpoint.getMarker();
- if (marker == null) {
- return null;
- }
- IResource resource = marker.getResource();
- if (resource instanceof IFile == false) {
- return null;
- }
- IFile file = (IFile) resource;
- try {
- return sourceDirector.findVmResourceRef(file);
- } catch (CoreException e) {
- throw new RuntimeException("Failed to read script name from breakpoint", e); //$NON-NLS-1$
- }
- }
- };
-
- private static final PropertyHandler sdkBreakpointHandler =
- new PropertyHandler() {
- @Override
- long getLineNumber(Breakpoint breakpoint) {
- return breakpoint.getLineNumber();
- }
-
- @Override
- VmResourceRef getVmResourceRef(Breakpoint breakpoint) {
- return breakpoint.getTarget().accept(resourceRefVisitor);
- }
-
- private final Breakpoint.Target.Visitor resourceRefVisitor =
- new BreakpointTypeExtension.ScriptRegExpSupport.Visitor() {
- @Override
- public VmResourceRef visitScriptName(String scriptName) {
- return VmResourceRef.forVmResourceId(new VmResourceId(scriptName, null));
- }
-
- @Override
- public VmResourceRef visitScriptId(Object scriptId) {
- return VmResourceRef.forVmResourceId(new VmResourceId(null, scriptId));
- }
-
- @Override
- public VmResourceRef visitRegExp(String regExp) {
- if (regExp == null) {
- return null;
- }
- ScriptNamePattern pattern = new ScriptNamePattern(regExp);
- return VmResourceRef.forRegExpBased(pattern);
- }
-
- @Override
- public VmResourceRef visitUnknown(Breakpoint.Target target) {
- return null;
- }
- };
- };
-
- /**
- * A helping structure that holds field of complicated type.
- */
- private static class SortedBreakpoints {
- final Map> data;
-
- SortedBreakpoints(Map> data) {
- this.data = data;
- }
- }
-
- /**
- * Put all breakpoints into map script_name -> line_number -> breakpoint.
- */
- private static SortedBreakpoints sortBreakpoints(Collection extends B> breakpoints,
- PropertyHandler handler) {
- Map> result = new HashMap>();
- for (B breakpoint : breakpoints) {
- VmResourceRef vmResourceRef = handler.getVmResourceRef(breakpoint);
- if (vmResourceRef == null) {
- continue;
- }
- Map subMap = getSafe(result, vmResourceRef);
- if (subMap == null) {
- subMap = new HashMap(3);
- result.put(vmResourceRef, subMap);
- }
- long line = handler.getLineNumber(breakpoint);
- // For simplicity we ignore multiple breakpoints on the same line.
- subMap.put(line, breakpoint);
- }
- return new SortedBreakpoints(result);
- }
-
- /**
- * A class that implements merge operation for a particular complete/incomplete pair of values.
- */
- private static abstract class Merger {
- abstract void onlyFirst(V1 v1);
- abstract void onlySecond(V2 v2);
- abstract void both(V1 v1, V2 v2);
- }
-
- /**
- * Merges values of 2 maps.
- * @param map2 must implement {@link Map#remove} method.
- */
- private static void mergeMaps(Map map1, Map map2,
- Merger merger) {
- for (Map.Entry en : map1.entrySet()) {
- V2 v2 = removeSafe(map2, en.getKey());
- if (v2 == null) {
- merger.onlyFirst(en.getValue());
- } else {
- merger.both(en.getValue(), v2);
- }
- }
- for (V2 v2 : map2.values()) {
- merger.onlySecond(v2);
- }
- }
-
- private static void mergeBreakpoints(final Merger perBreakpointMerger,
- SortedBreakpoints side1, SortedBreakpoints side2) {
- Merger, Map> perScriptMerger =
- new Merger, Map>() {
- @Override
- void both(Map v1, Map v2) {
- mergeMaps(v1, v2, perBreakpointMerger);
- }
-
- @Override
- void onlyFirst(Map v1) {
- mergeMaps(v1, Collections.emptyMap(), perBreakpointMerger);
- }
-
- @Override
- void onlySecond(Map v2) {
- mergeMaps(Collections.emptyMap(), v2, perBreakpointMerger);
- }
- };
- mergeMaps(side1.data, side2.data, perScriptMerger);
- }
-
-
- private static Collection extends Breakpoint> readSdkBreakpoints(JavascriptVm javascriptVm) {
- class CallbackImpl implements JavascriptVm.ListBreakpointsCallback {
- public void failure(Exception exception) {
- problem = exception;
- }
-
- public void success(Collection extends Breakpoint> breakpoints) {
- result = breakpoints;
- }
- Collection extends Breakpoint> getResult() {
- if (problem != null) {
- throw new RuntimeException("Failed to synchronize breakpoints", problem); //$NON-NLS-1$
- }
- return result;
- }
- Exception problem = null;
- Collection extends Breakpoint> result = null;
- }
-
- CallbackImpl callback = new CallbackImpl();
- CallbackSemaphore callbackSemaphore = new CallbackSemaphore();
-
- RelayOk relayOk = javascriptVm.listBreakpoints(callback, callbackSemaphore);
- boolean res = callbackSemaphore.tryAcquireDefault(relayOk);
- if (!res) {
- throw new RuntimeException("Timeout"); //$NON-NLS-1$
- }
-
- return callback.getResult();
- }
-
- private ChromiumBreakpointsFiltered getUiBreakpoints() {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- final Set lineBreakpoints = new HashSet();
- final List exceptionBreakpoints =
- new ArrayList(2);
-
- for (IBreakpoint breakpoint :
- breakpointManager.getBreakpoints(VProjectWorkspaceBridge.DEBUG_MODEL_ID)) {
- {
- ChromiumLineBreakpoint chromiumLineBreakpoint =
- ChromiumBreakpointAdapter.tryCastBreakpoint(breakpoint);
- if (chromiumLineBreakpoint != null) {
- lineBreakpoints.add(chromiumLineBreakpoint);
- continue;
- }
- }
- {
- ChromiumExceptionBreakpoint chromiumExceptionBreakpoint =
- ChromiumExceptionBreakpoint.tryCastBreakpoint(breakpoint);
- if (chromiumExceptionBreakpoint != null) {
- exceptionBreakpoints.add(chromiumExceptionBreakpoint);
- continue;
- }
- }
- }
-
- return new ChromiumBreakpointsFiltered() {
- @Override public Set getLineBreakpoints() {
- return lineBreakpoints;
- }
- @Override public Collection getExceptionBreakpoints() {
- return exceptionBreakpoints;
- }
- };
- }
-
- private interface ChromiumBreakpointsFiltered {
- // We need this method to return Set for future purposes.
- Set getLineBreakpoints();
- Collection getExceptionBreakpoints();
- }
-
- public static class ProtocolNotSupportedOnRemote extends Exception {
- ProtocolNotSupportedOnRemote() {
- }
- ProtocolNotSupportedOnRemote(String message, Throwable cause) {
- super(message, cause);
- }
- ProtocolNotSupportedOnRemote(String message) {
- super(message);
- }
- ProtocolNotSupportedOnRemote(Throwable cause) {
- super(cause);
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointAdapter.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointAdapter.java
deleted file mode 100644
index ee939e6b..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointAdapter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * Implements breakpoint adapter for breakpoints provided by org.chromium.debug.*
- */
-public class ChromiumBreakpointAdapter {
- public static ChromiumLineBreakpoint tryCastBreakpoint(IBreakpoint breakpoint) {
- if (!supportsBreakpoint(breakpoint)) {
- return null;
- }
- if (breakpoint instanceof ChromiumLineBreakpoint == false) {
- return null;
- }
- return (ChromiumLineBreakpoint) breakpoint;
- }
-
- private static boolean supportsBreakpoint(IBreakpoint breakpoint) {
- return VProjectWorkspaceBridge.DEBUG_MODEL_ID.equals(breakpoint.getModelIdentifier());
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory.java
deleted file mode 100644
index 7ddd28cb..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * An IWorkbenchAdapter factory for ChromiumLineBreakpoints.
- */
-public class ChromiumBreakpointWBAFactory implements IAdapterFactory {
-
- protected static final Object[] EMPTY_CHILDREN = new Object[0];
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adapterType != IWorkbenchAdapter.class ||
- !(adaptableObject instanceof ChromiumLineBreakpoint)) {
- return null;
- }
- return new IWorkbenchAdapter() {
-
- public Object[] getChildren(Object o) {
- return EMPTY_CHILDREN;
- }
-
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
-
- public String getLabel(Object o) {
- ChromiumLineBreakpoint bp = (ChromiumLineBreakpoint) o;
- try {
- return bp.getMarker().getAttribute(IMarker.MESSAGE).toString();
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(e);
- }
- return null;
- }
-
- public Object getParent(Object o) {
- return null;
- }
- };
- }
-
- @SuppressWarnings("unchecked")
- public Class[] getAdapterList() {
- return new Class[] { IWorkbenchAdapter.class };
- }
-
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumExceptionBreakpoint.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumExceptionBreakpoint.java
deleted file mode 100644
index d06b0dda..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumExceptionBreakpoint.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.Breakpoint;
-import org.eclipse.debug.core.model.IBreakpoint;
-
-/**
- * JavaScript exception breakpoint. It always stops for uncaught breakpoints,
- * and optionally stops on caught breakpoints (see 'include caught' property).
- */
-public class ChromiumExceptionBreakpoint extends Breakpoint {
- /** Include caught */
- private static final String INCLUDE_CAUGHT_ATTR =
- ChromiumDebugPlugin.PLUGIN_ID + ".includeCaught"; //$NON-NLS-1$
-
- public ChromiumExceptionBreakpoint() {
- }
-
- public ChromiumExceptionBreakpoint(final IResource resource,
- final boolean includingCaught, final String modelId) throws DebugException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker = resource.createMarker(ChromiumDebugPlugin.EXCEPTION_BP_MARKER);
- setMarker(marker);
- marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
- marker.setAttribute(IBreakpoint.ID, modelId);
- marker.setAttribute(IMarker.MESSAGE,
- Messages.ChromiumExceptionBreakpoint_MessageMarkerFormat);
- }
- };
- run(getMarkerRule(resource), runnable);
- }
-
- public void setIncludeCaught(boolean value) throws CoreException {
- try {
- setAttribute(INCLUDE_CAUGHT_ATTR, value);
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(e);
- }
- }
-
- public boolean getIncludeCaught() {
- return getMarker().getAttribute(INCLUDE_CAUGHT_ATTR, false);
- }
-
- @Override
- public String getModelIdentifier() {
- return getMarker().getAttribute(IBreakpoint.ID, ""); //$NON-NLS-1$
- }
-
- public static ChromiumExceptionBreakpoint tryCastBreakpoint(IBreakpoint breakpoint) {
- if (breakpoint instanceof ChromiumExceptionBreakpoint == false) {
- return null;
- }
- return (ChromiumExceptionBreakpoint) breakpoint;
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumLineBreakpoint.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumLineBreakpoint.java
deleted file mode 100644
index 52b8373f..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumLineBreakpoint.java
+++ /dev/null
@@ -1,363 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import static org.chromium.sdk.util.BasicUtil.containsSafe;
-import static org.chromium.sdk.util.BasicUtil.removeSafe;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Set;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.ScriptNameManipulator.ScriptNamePattern;
-import org.chromium.debug.core.sourcemap.SourcePosition;
-import org.chromium.debug.core.sourcemap.SourcePositionMap;
-import org.chromium.debug.core.sourcemap.SourcePositionMap.TranslateDirection;
-import org.chromium.sdk.Breakpoint;
-import org.chromium.sdk.Breakpoint.Target;
-import org.chromium.sdk.BreakpointTypeExtension.ScriptRegExpSupport;
-import org.chromium.sdk.IgnoreCountBreakpointExtension;
-import org.chromium.sdk.JavascriptVm;
-import org.chromium.sdk.JavascriptVm.BreakpointCallback;
-import org.chromium.sdk.RelayOk;
-import org.chromium.sdk.SyncCallback;
-import org.chromium.sdk.util.BasicUtil;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.LineBreakpoint;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * JavaScript line breakpoint.
- */
-public class ChromiumLineBreakpoint extends LineBreakpoint {
-
- /** Ignore count */
- private static final String IGNORE_COUNT_ATTR = ChromiumDebugPlugin.PLUGIN_ID + ".ignoreCount"; //$NON-NLS-1$
-
- /** Condition */
- private static final String CONDITION_ATTR = ChromiumDebugPlugin.PLUGIN_ID + ".condition"; //$NON-NLS-1$
-
- /**
- * Default constructor is required for the breakpoint manager to re-create
- * persisted breakpoints. After instantiating a breakpoint, the setMarker
- * method is called to restore this breakpoint's attributes.
- */
- public ChromiumLineBreakpoint() {
- }
-
- /**
- * Constructs a line breakpoint on the given resource at the given line number
- * (line number is 1-based).
- *
- * @param resource file on which to set the breakpoint
- * @param lineNumber 1-based line number of the breakpoint
- * @throws CoreException if unable to create the breakpoint
- */
- public ChromiumLineBreakpoint(final IResource resource, final int lineNumber,
- final String modelId) throws CoreException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker = resource.createMarker(ChromiumDebugPlugin.BP_MARKER);
- setMarker(marker);
- marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
- marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
- marker.setAttribute(IBreakpoint.ID, modelId);
- marker.setAttribute(IMarker.MESSAGE, NLS.bind(
- Messages.JsLineBreakpoint_MessageMarkerFormat, resource.getName(), lineNumber));
- }
- };
- run(getMarkerRule(resource), runnable);
- }
-
- @Override
- public boolean isEnabled() {
- try {
- return super.isEnabled();
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(e);
- return false;
- }
- }
-
- private void setMarkerAttribute(String attributeName, Object value) {
- try {
- setAttribute(attributeName, value);
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(e);
- }
- }
-
-
- public void setCondition(String condition) throws CoreException {
- setMarkerAttribute(CONDITION_ATTR, condition);
- }
-
- public String getCondition() {
- return getMarker().getAttribute(CONDITION_ATTR, (String) null);
- }
-
- public String getModelIdentifier() {
- return getMarker().getAttribute(IBreakpoint.ID, "");
- }
-
- public IgnoreCountData getIgnoreCountData() {
- String dataStr = getMarker().getAttribute(IGNORE_COUNT_ATTR, "");
- return IgnoreCountData.parseString(dataStr);
- }
-
- public void setIgnoreCountData(IgnoreCountData data) throws CoreException {
- getMarker().setAttribute(IGNORE_COUNT_ATTR, data.getStringRepresentation());
- }
-
- /**
- * @return ignore count number or {@link Breakpoint#EMPTY_VALUE} based on state
- */
- public int getEffectiveIgnoreCount() {
- IgnoreCountData data = getIgnoreCountData();
- return data.getEffectiveValue();
- }
-
- /**
- * Resets ignore count so that it's effective value becomes {@link Breakpoint#EMPTY_VALUE},
- * but the change does not cause update back to remote VM.
- */
- public void silentlyResetIgnoreCount() throws CoreException {
- IgnoreCountData data = getIgnoreCountData();
- if (data.getState() == IgnoreCountData.State.RESET || data.getValue() <= 0) {
- return;
- }
- data.setState(IgnoreCountData.State.RESET);
- setIgnoreCountData(data);
- }
-
- /**
- * Returns set of properties that have changed comparing to the state saved in delta parameter.
- * Doesn't enumerate properties that were changed 'silently'
- * (see {@link #silentlyResetIgnoreCount()}).
- */
- public Set getChangedProperty(IMarkerDelta delta) {
- Set result = EnumSet.noneOf(MutableProperty.class);
-
- IMarker marker = getMarker();
- if (marker.getAttribute(IBreakpoint.ENABLED, Boolean.TRUE) !=
- delta.getAttribute(IBreakpoint.ENABLED, Boolean.TRUE)) {
- result.add(MutableProperty.ENABLED);
- }
- if (!BasicUtil.eq(marker.getAttribute(CONDITION_ATTR, (String) null),
- delta.getAttribute(CONDITION_ATTR, (String) null))) {
- result.add(MutableProperty.CONDITION);
- }
- {
- IgnoreCountData currentData =
- IgnoreCountData.parseString(marker.getAttribute(IGNORE_COUNT_ATTR, ""));
- IgnoreCountData oldData =
- IgnoreCountData.parseString(delta.getAttribute(IGNORE_COUNT_ATTR, ""));
- boolean differs;
- if (currentData.getState() == IgnoreCountData.State.RESET) {
- // Ignore all changes while we are in reset state.
- differs = false;
- } else {
- differs = currentData.getEffectiveValue() != oldData.getEffectiveValue();
- }
- if (differs) {
- result.add(MutableProperty.IGNORE_COUNT);
- }
- }
-
- return result;
- }
-
- public enum MutableProperty {
- ENABLED, CONDITION, IGNORE_COUNT
- }
-
- /**
- * A helper that propagates changes in Eclipse Debugger breakpoints (i.e.
- * {@link ChromiumLineBreakpoint}) to ChromeDevTools SDK breakpoints. Note that
- * {@link ChromiumLineBreakpoint} can't do it itself, because it may correspond to several
- * SDK {@link JavascriptVm}'s simultaneously.
- */
- public static class Helper {
- // TODO: rename 'remove' -> 'remote'.
- public interface CreateOnRemoveCallback {
- void success(Breakpoint breakpoint);
- void failure(String errorMessage);
- }
-
- public static RelayOk createOnRemote(final ChromiumLineBreakpoint uiBreakpoint,
- VmResourceRef vmResourceRef, final ConnectedTargetData connectedTargetData,
- final CreateOnRemoveCallback createOnRemoveCallback,
- SyncCallback syncCallback) throws CoreException {
- final JavascriptVm javascriptVm = connectedTargetData.getJavascriptVm();
-
- // ILineBreakpoint lines are 1-based while V8 lines are 0-based
- final int line = (uiBreakpoint.getLineNumber() - 1);
- final int column = 0;
-
- BreakpointCallback callback = new BreakpointCallback() {
- public void success(Breakpoint sdkBreakpoint) {
- createOnRemoveCallback.success(sdkBreakpoint);
- }
- public void failure(String errorMessage) {
- createOnRemoveCallback.failure(errorMessage);
- }
- };
-
- class SdkParams {
- SdkParams(Target target, int line, int column) {
- this.target = target;
- this.line = line;
- this.column = column;
- }
-
- final Breakpoint.Target target;
- final int line;
- final int column;
- }
-
- SdkParams sdkParams = vmResourceRef.accept(new VmResourceRef.Visitor() {
- @Override
- public SdkParams visitRegExpBased(ScriptNamePattern scriptNamePattern) {
- // TODO: support source mapping perhaps.
-
- ScriptRegExpSupport scriptRegExpSupport =
- javascriptVm.getBreakpointTypeExtension().getScriptRegExpSupport();
- if (scriptRegExpSupport == null) {
- // TODO: check earlier in UI.
- throw new RuntimeException("Script RegExp is not supported by VM");
- }
-
- final Breakpoint.Target targetValue =
- scriptRegExpSupport.createTarget(scriptNamePattern.getJavaScriptRegExp());
- return new SdkParams(targetValue, line, column);
- }
-
- @Override
- public SdkParams visitResourceId(VmResourceId resourceId) {
- SourcePositionMap map = connectedTargetData.getSourcePositionMap();
- SourcePosition vmPosition =
- map.translatePosition(resourceId, line, column,TranslateDirection.USER_TO_VM);
- final int vmLine = vmPosition.getLine();
- final int vmColumn = vmPosition.getColumn();
- final Breakpoint.Target target;
- VmResourceId vmSideVmResourceId = vmPosition.getId();
- if (vmSideVmResourceId.getId() == null) {
- target = new Breakpoint.Target.ScriptName(vmSideVmResourceId.getName());
- } else {
- target = new Breakpoint.Target.ScriptId(vmSideVmResourceId.getId());
- }
-
- return new SdkParams(target, vmLine, vmColumn);
- }
- });
-
- IgnoreCountBreakpointExtension extension = javascriptVm.getIgnoreCountBreakpointExtension();
- if (extension == null) {
- if (uiBreakpoint.getEffectiveIgnoreCount() != Breakpoint.EMPTY_VALUE) {
- ChromiumDebugPlugin.log(
- new Exception("Failed to set breakpoint ignore count as it is not supported by VM"));
- }
- return javascriptVm.setBreakpoint(
- sdkParams.target,
- sdkParams.line,
- sdkParams.column,
- uiBreakpoint.isEnabled(),
- uiBreakpoint.getCondition(),
- callback, syncCallback);
- } else {
- return extension.setBreakpoint(
- javascriptVm,
- sdkParams.target,
- sdkParams.line,
- sdkParams.column,
- uiBreakpoint.isEnabled(),
- uiBreakpoint.getCondition(),
- uiBreakpoint.getEffectiveIgnoreCount(),
- callback, syncCallback);
- }
- }
-
- public static void updateOnRemote(final Breakpoint sdkBreakpoint,
- final ChromiumLineBreakpoint uiBreakpoint,
- Set propertyDelta) throws CoreException {
-
- if (propertyDelta.contains(MutableProperty.ENABLED)) {
- sdkBreakpoint.setEnabled(uiBreakpoint.isEnabled());
- }
- if (propertyDelta.contains(MutableProperty.CONDITION)) {
- sdkBreakpoint.setCondition(uiBreakpoint.getCondition());
- }
- sdkBreakpoint.flush(null, null);
-
- if (propertyDelta.contains(MutableProperty.IGNORE_COUNT)) {
- // Ignore count is a transient property and doesn't need flush.
- IgnoreCountBreakpointExtension extension =
- sdkBreakpoint.getIgnoreCountBreakpointExtension();
- if (extension == null) {
- ChromiumDebugPlugin.log(
- new Exception("Failed to set breakpoint ignore count as it is not supported by VM"));
- } else {
- extension.setIgnoreCount(sdkBreakpoint, uiBreakpoint.getEffectiveIgnoreCount(),
- null, null);
- }
- }
- }
-
- public static ChromiumLineBreakpoint createLocal(Breakpoint sdkBreakpoint,
- IBreakpointManager breakpointManager, IFile resource, int script_line_offset,
- String debugModelId) throws CoreException {
- ChromiumLineBreakpoint uiBreakpoint = new ChromiumLineBreakpoint(resource,
- (int) sdkBreakpoint.getLineNumber() + 1 + script_line_offset,
- debugModelId);
- uiBreakpoint.setCondition(sdkBreakpoint.getCondition());
- uiBreakpoint.setEnabled(sdkBreakpoint.isEnabled());
- ignoreList.add(uiBreakpoint);
- try {
- breakpointManager.addBreakpoint(uiBreakpoint);
- } finally {
- ignoreList.remove(uiBreakpoint);
- }
- return uiBreakpoint;
- }
- }
-
- private static final BreakpointIgnoreList ignoreList = new BreakpointIgnoreList();
-
- public static BreakpointIgnoreList getIgnoreList() {
- return ignoreList;
- }
-
- public static class BreakpointIgnoreList {
- private final List list = new ArrayList(1);
-
- public boolean contains(ChromiumLineBreakpoint breakpoint) {
- return containsSafe(list, breakpoint);
- }
-
- public void remove(ChromiumLineBreakpoint lineBreakpoint) {
- boolean res = removeSafe(list, lineBreakpoint);
- if (!res) {
- throw new IllegalStateException();
- }
- }
-
- public void add(ChromiumLineBreakpoint lineBreakpoint) {
- if (containsSafe(list, lineBreakpoint)) {
- throw new IllegalStateException();
- }
- list.add(lineBreakpoint);
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectedTargetData.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectedTargetData.java
deleted file mode 100644
index 43a40a42..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectedTargetData.java
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.util.Collection;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.model.DebugTargetImpl.ListenerBlock;
-import org.chromium.debug.core.model.DebugTargetImpl.State;
-import org.chromium.debug.core.sourcemap.PositionMapBuilderImpl;
-import org.chromium.debug.core.sourcemap.SourcePositionMap;
-import org.chromium.debug.core.sourcemap.SourcePositionMapBuilder;
-import org.chromium.debug.core.util.ChromiumDebugPluginUtil;
-import org.chromium.sdk.DebugContext;
-import org.chromium.sdk.DebugEventListener;
-import org.chromium.sdk.JavascriptVm;
-import org.chromium.sdk.Script;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointListener;
-import org.eclipse.debug.core.IBreakpointManager;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchListener;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IDisconnect;
-import org.eclipse.debug.core.model.ISuspendResume;
-import org.eclipse.debug.core.model.ITerminate;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Contains state and behavior of 'connected' {@link DebugTargetImpl}. Its inner implementation of
- * {@link DebugTargetImpl#State} is for {@link DebugTargetImpl} only and is available externally
- * only at construction. The class can be used
- * only after {@link #setVmEmbedder} was called. Listeners can be used from the
- * beginning, but they are blocking until {@link #listenerBlock} is unblocked which is done
- * externally after {@link #setVmEmbedder} is called.
- *
- * It corresponds to 'connected' state of target and post-terminated state.
- */
-public class ConnectedTargetData {
-
- /**
- * Creates instance and returns its inner state class. This is the only moment when inner
- * state class gets available outside the class.
- * @param listenerBlock blocks 2 event listeners to let all infrastructure get initialized
- * @return inner state of data that provides getter to the data itself.
- */
- static TargetInnerState create(DebugTargetImpl debugTargetImpl, ListenerBlock listenerBlock) {
- ConnectedTargetData data = new ConnectedTargetData(debugTargetImpl, listenerBlock);
-
- // No public getter for stateImpl. We expose state only to one who creates us.
- return data.debugTargetState;
- }
-
- private final DebugTargetImpl debugTargetImpl;
- private final TargetInnerState debugTargetState = new TargetInnerState();
- private final JavascriptThread singleThread;
- private final JavascriptThread[] threadArray;
- private final SourcePositionMapBuilder sourcePositionMapBuilder = new PositionMapBuilderImpl();
- private final ListenerBlock listenerBlock;
- private final DebugEventListenerImpl debugEventListener = new DebugEventListenerImpl();
-
- private JavascriptVmEmbedder vmEmbedder = null;
- private WorkspaceBridge workspaceRelations = null;
-
- private volatile boolean isDisconnected = false;
-
- private ConnectedTargetData(DebugTargetImpl debugTargetImpl, ListenerBlock listenerBlock) {
- this.debugTargetImpl = debugTargetImpl;
- this.singleThread = new JavascriptThread(this);
- this.threadArray = new JavascriptThread[] { singleThread };
- this.listenerBlock = listenerBlock;
- }
-
- void setVmEmbedder(JavascriptVmEmbedder vmEmbedder) {
- ConnectedTargetData.this.vmEmbedder = vmEmbedder;
-
- initWorkspaceRelations();
- }
-
- public void initListeners() {
- IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
- breakpointManager.addBreakpointListener(debugTargetState.getBreakpointListner());
- breakpointManager.addBreakpointManagerListener(workspaceRelations.getBreakpointHandler());
- workspaceRelations.getBreakpointHandler().initBreakpointManagerListenerState(
- breakpointManager);
-
- workspaceRelations.startInitialization();
- }
-
- public JavascriptVmEmbedder getJavascriptEmbedder() {
- return vmEmbedder;
- }
-
- public JavascriptVm getJavascriptVm() {
- return getJavascriptEmbedder().getJavascriptVm();
- }
-
- void fireBecameConnectedEvents() {
- setDisconnected(false);
- DebugTargetImpl.fireDebugEvent(new DebugEvent(debugTargetImpl, DebugEvent.CHANGE));
- fireEventForThread(DebugEvent.CREATE, DebugEvent.UNSPECIFIED);
- }
-
- void fireResumeEvent(int detail) {
- fireEventForThread(DebugEvent.RESUME, detail);
- DebugTargetImpl.fireDebugEvent(new DebugEvent(debugTargetImpl, DebugEvent.RESUME, detail));
- }
-
- public Collection extends VmResource> getVmResource(IFile resource) throws CoreException {
- return workspaceRelations.findVmResourcesFromWorkspaceFile(resource);
- }
-
- private final VmStatusListenerImpl vmStatusListener = new VmStatusListenerImpl();
-
- private class VmStatusListenerImpl implements DebugEventListener.VmStatusListener {
- private String currentRequest = null;
- private int numberOfEnqueued;
-
- public synchronized void busyStatusChanged(String currentRequest, int numberOfEnqueued) {
- this.currentRequest = currentRequest;
- this.numberOfEnqueued = numberOfEnqueued;
- DebugTargetImpl.fireDebugEvent(new DebugEvent(debugTargetImpl, DebugEvent.CHANGE));
- }
-
- public synchronized String getStatusString() {
- if (currentRequest == null) {
- return null;
- }
- return NLS.bind(Messages.DebugTargetImpl_BUSY_WITH, currentRequest, numberOfEnqueued);
- }
- }
-
- public void synchronizeBreakpoints(BreakpointSynchronizer.Direction direction,
- BreakpointSynchronizer.Callback callback) {
- workspaceRelations.synchronizeBreakpoints(direction, callback);
- }
-
- public DebugEventListenerImpl getDebugEventListener() {
- return debugEventListener;
- }
-
- public JavascriptVmEmbedder.Listener getEmbedderListener() {
- return embedderListener;
- }
-
- public WorkspaceBridge getWorkspaceRelations() {
- return workspaceRelations;
- }
-
- public SourcePositionMap getSourcePositionMap() {
- return sourcePositionMapBuilder.getSourcePositionMap();
- }
-
- public SourcePositionMapBuilder getSourcePositionMapBuilder() {
- return sourcePositionMapBuilder;
- }
-
- public SourceWrapSupport getSourceWrapSupport() {
- return debugTargetImpl.getSourceWrapSupport();
- }
-
- public DebugTargetImpl getDebugTarget() {
- return debugTargetImpl;
- }
-
- public String getName() {
- return debugTargetState.getName();
- }
-
- private JavascriptThread getThread() {
- return disconnectAspect.isDisconnected()
- ? null
- : singleThread;
- }
-
- private void fireEventForThread(int kind, int detail) {
- try {
- IThread[] threads = debugTargetState.getThreads();
- if (threads.length > 0) {
- DebugTargetImpl.fireDebugEvent(new DebugEvent(threads[0], kind, detail));
- }
- } catch (DebugException e) {
- // Actually, this is not thrown in our getThreads()
- return;
- }
- }
-
- private void fireTerminateEvent() {
- // TODO(peter.rybin): from Alexander Pavlov: I think you need to fire a terminate event after
- // this line, for consolePseudoProcess if one is not null.
-
- // Do not report on threads -- the children are gone when terminated.
- DebugTargetImpl.fireDebugEvent(
- new DebugEvent(debugTargetImpl, DebugEvent.TERMINATE, DebugEvent.UNSPECIFIED));
- DebugTargetImpl.fireDebugEvent(
- new DebugEvent(debugTargetImpl.getLaunch(), DebugEvent.TERMINATE, DebugEvent.UNSPECIFIED));
- }
-
- void fireSuspendEvent(int detail) {
- fireEventForThread(DebugEvent.SUSPEND, detail);
- DebugTargetImpl.fireDebugEvent(new DebugEvent(debugTargetImpl, DebugEvent.SUSPEND, detail));
- }
-
- private void setDisconnected(boolean disconnected) {
- isDisconnected = disconnected;
- }
-
- boolean isDisconnected() {
- return isDisconnected;
- }
-
- private void initWorkspaceRelations() {
- ConnectedTargetData.this.workspaceRelations =
- debugTargetImpl.getWorkspaceBridgeFactory().attachedToVm(ConnectedTargetData.this,
- vmEmbedder.getJavascriptVm());
-
- // We'd like to know when launch is removed to remove our project.
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(new ILaunchListener() {
- public void launchAdded(ILaunch launch) {
- }
- public void launchChanged(ILaunch launch) {
- }
- // TODO(peter.rybin): maybe have one instance of listener for all targets?
- public void launchRemoved(ILaunch launch) {
- if (launch != debugTargetImpl.getLaunch()) {
- return;
- }
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this);
- workspaceRelations.launchRemoved();
- }
- });
- }
-
- private final IDisconnect disconnectAspect = new IDisconnect() {
- public boolean canDisconnect() {
- return !isDisconnected();
- }
-
- public void disconnect() throws DebugException {
- if (!canDisconnect()) {
- return;
- }
- workspaceRelations.beforeDetach();
- if (!vmEmbedder.getJavascriptVm().detach()) {
- ChromiumDebugPlugin.logWarning(Messages.DebugTargetImpl_BadResultWhileDisconnecting);
- }
- // This is a duplicated call to disconnected().
- // The primary one comes from V8DebuggerToolHandler#onDebuggerDetached
- // but we want to make sure the target becomes disconnected even if
- // there is a browser failure and it does not respond.
- debugEventListener.disconnected();
- }
-
- public boolean isDisconnected() {
- return isDisconnected;
- }
- };
-
- private final ITerminate terminateAspect = new ITerminate() {
- public boolean canTerminate() {
- return !isTerminated();
- }
-
- public boolean isTerminated() {
- return disconnectAspect.isDisconnected();
- }
-
- public void terminate() throws DebugException {
- disconnectAspect.disconnect();
- }
- };
-
- private final JavascriptVmEmbedder.Listener embedderListener =
- new JavascriptVmEmbedder.Listener() {
- public void reset() {
- listenerBlock.waitUntilReady();
- workspaceRelations.handleVmResetEvent();
- DebugTargetImpl.fireDebugEvent(
- new DebugEvent(debugTargetImpl, DebugEvent.CHANGE, DebugEvent.CONTENT));
- }
- public void closed() {
- debugEventListener.disconnected();
- }
- };
-
- private class DebugEventListenerImpl implements DebugEventListener {
-
- public void disconnected() {
- if (!disconnectAspect.isDisconnected()) {
- setDisconnected(true);
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointManagerListener(
- workspaceRelations.getBreakpointHandler());
- DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(
- debugTargetImpl);
- fireTerminateEvent();
-
-// final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("STANDALONE_V8");
-// ChromiumDebugPluginUtil.deleteVirtualProjectAsync(project);
- }
- }
-
- public void resumed() {
- listenerBlock.waitUntilReady();
- singleThread.getRemoteEventListener().resumed(null);
- }
-
- public void suspended(DebugContext context) {
- listenerBlock.waitUntilReady();
- singleThread.getRemoteEventListener().suspended(context);
- }
-
- public void scriptLoaded(Script newScript) {
- listenerBlock.waitUntilReady();
- workspaceRelations.scriptLoaded(newScript);
- }
-
- public void scriptCollected(Script script) {
- listenerBlock.waitUntilReady();
- workspaceRelations.scriptCollected(script);
- }
-
- public void scriptContentChanged(Script newScript) {
- listenerBlock.waitUntilReady();
- workspaceRelations.reloadScript(newScript);
- }
-
- public VmStatusListener getVmStatusListener() {
- return vmStatusListener;
- }
- }
-
- class TargetInnerState extends State {
- @Override
- boolean supportsBreakpoint(IBreakpoint breakpoint) {
- return workspaceRelations.getBreakpointHandler().supportsBreakpoint(breakpoint);
- }
-
- @Override
- String getVmStatus() {
- if (isDisconnected) {
- return null;
- }
- return vmStatusListener.getStatusString();
- }
-
- @Override
- IThread[] getThreads() throws DebugException {
- return disconnectAspect.isDisconnected()
- ? DebugTargetImpl.EMPTY_THREADS
- : threadArray;
- }
-
- @Override
- ConnectedTargetData getConnectedTargetDataOrNull() {
- return getConnectedTargetData();
- }
-
- ConnectedTargetData getConnectedTargetData() {
- return ConnectedTargetData.this;
- }
-
- @Override
- ISuspendResume getSuspendResume() {
- return singleThread.getSuspendResumeAspect();
- }
-
- @Override
- ITerminate getTerminate() {
- return terminateAspect;
- }
-
- @Override
- IDisconnect getDisconnect() {
- return disconnectAspect;
- }
-
- @Override
- String getName() {
- JavascriptVmEmbedder vmEmbedder = getJavascriptEmbedder();
- return vmEmbedder.getTargetName();
- }
-
- @Override
- EvaluateContext getEvaluateContext() {
- return getThread().getEvaluateContext();
- }
-
- @Override
- IBreakpointListener getBreakpointListner() {
- return workspaceRelations.getBreakpointHandler();
- }
- }
-}
\ No newline at end of file
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectionLoggerImpl.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectionLoggerImpl.java
deleted file mode 100644
index 15037a8e..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectionLoggerImpl.java
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import org.chromium.sdk.ConnectionLogger;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.ITerminate;
-
-/**
- * Connection logger that writes both incoming and outgoing streams into
- * logWriter with simple annotations.
- */
-public class ConnectionLoggerImpl implements ConnectionLogger {
- /**
- * Additional interface logger sends its output to.
- */
- public interface LogLifecycleListener {
- /**
- * Notifies about logging start. Before this call {@link ConnectionLoggerImpl}
- * is considered to be simply garbage-collectible. After this call
- * {@link ConnectionLoggerImpl} must call {@link #logClosed()}.
- *
- * @param connectionLogger instance of host {@link ConnectionLoggerImpl}, which is nice
- * to have because theoretically we may receive this call before constructor of
- * {@link ConnectionLoggerImpl} returned
- */
- void logStarted(ConnectionLoggerImpl connectionLogger);
-
- /**
- * Notifies about log stream being closed. Technically, last messages may arrive
- * even after this. It is supposed that log representation may be closed on this call
- * because we are not 100% accurate.
- */
- void logClosed();
- }
-
-
- public ConnectionLoggerImpl(Writer logWriter, LogLifecycleListener lifecycleListener) {
- this.logWriter = logWriter;
- this.lifecycleListener = lifecycleListener;
- }
-
- /**
- * We mix 2 streams into a single console. This type helps to annotate them textually.
- */
- private static abstract class StreamId {
- abstract String getStreamName();
- }
-
- @Override
- public StreamListener getIncomingStreamListener() {
- StreamId streamId = new StreamId() {
- public String getStreamName() {
- return Messages.ConnectionLoggerImpl_ReceivedFromChrome;
- }
- };
- return new StreamListenerImpl(streamId);
- }
-
- @Override
- public StreamListener getOutgoingStreamListener() {
- StreamId streamId = new StreamId() {
- public String getStreamName() {
- return Messages.ConnectionLoggerImpl_SentToChrome;
- }
- };
- return new StreamListenerImpl(streamId);
- }
-
- private class StreamListenerImpl implements StreamListener {
- private final StreamId streamId;
-
- private StreamListenerImpl(StreamId streamId) {
- this.streamId = streamId;
- }
-
- @Override
- public void addContent(CharSequence text) {
- writeToLog(text, streamId);
- flushLogWriter();
- }
-
- @Override
- public void addSeparator() {
- writeToLog(MESSAGE_SEPARATOR, streamId);
- flushLogWriter();
- }
- }
-
- public void start() {
- lifecycleListener.logStarted(this);
- }
-
- public void handleEos() {
- isClosed = true;
- lifecycleListener.logClosed();
- }
-
- public ITerminate getConnectionTerminate() {
- return connectionTerminate;
- }
-
- public void setConnectionCloser(ConnectionCloser connectionCloser) {
- this.connectionCloser = connectionCloser;
- }
-
- private synchronized void writeToLog(CharSequence str, StreamId streamId) {
- try {
- printHead(streamId);
- logWriter.append(str);
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
- private void printHead(StreamId streamId) throws IOException {
- if (lastSource != streamId) {
- if (lastSource != null) {
- logWriter.append('\n');
- }
- logWriter.append("> ").append(streamId.getStreamName()).append('\n'); //$NON-NLS-1$
- lastSource = streamId;
- }
- }
- private void flushLogWriter() {
- try {
- logWriter.flush();
- } catch (IOException e) {
- DebugPlugin.log(e);
- }
- }
-
- private final Writer logWriter;
- private final LogLifecycleListener lifecycleListener;
- private StreamId lastSource = null;
- private volatile ConnectionCloser connectionCloser = null;
- private volatile boolean isClosed = false;
-
- private final ITerminate connectionTerminate = new ITerminate() {
- public boolean canTerminate() {
- return !isClosed && connectionCloser != null;
- }
-
- public boolean isTerminated() {
- return isClosed;
- }
-
- public void terminate() {
- ConnectionCloser connectionCloser0 = ConnectionLoggerImpl.this.connectionCloser;
- if (connectionCloser0 == null) {
- throw new IllegalStateException();
- }
- connectionCloser0.closeConnection();
- }
- };
-
- private static final String MESSAGE_SEPARATOR = Messages.ConnectionLoggerImpl_MessageSeparator;
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConsolePseudoProcess.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConsolePseudoProcess.java
deleted file mode 100644
index ac550549..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/ConsolePseudoProcess.java
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.IStreamListener;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamMonitor;
-import org.eclipse.debug.core.model.IStreamsProxy;
-import org.eclipse.debug.core.model.ITerminate;
-
-/**
- * This process corresponds to a Debugger-Chrome connection and its main
- * purpose is to expose connection log (see process console in UI).
- */
-public class ConsolePseudoProcess extends PlatformObject implements IProcess {
-
- private final ILaunch launch;
- private final Retransmitter outputMonitor;
- private final ITerminate connectionTerminate;
- private final String name;
- private Map attributes = null;
-
- private final IStreamsProxy streamsProxy = new IStreamsProxy() {
- public IStreamMonitor getErrorStreamMonitor() {
- return NullStreamMonitor.INSTANCE;
- }
- public IStreamMonitor getOutputStreamMonitor() {
- return outputMonitor;
- }
- public void write(String input) {
- // ignore
- }
- };
-
- /**
- * Constructs a ConsolePseudoProcess, adding this process to the given launch.
- *
- * @param launch the parent launch of this process
- * @param name the label used for this process
- */
- public ConsolePseudoProcess(ILaunch launch, String name, Retransmitter retransmitter,
- ITerminate connectionTerminate) {
- this.launch = launch;
- this.name = name;
- this.outputMonitor = retransmitter;
- outputMonitor.consolePseudoProcess = this;
- this.connectionTerminate = connectionTerminate;
-
- this.launch.addProcess(this);
- fireCreationEvent();
- }
-
- /**
- * @return writer which directs its contents to process console
- */
- public Writer getOutputWriter() {
- return outputMonitor;
- }
-
- public String getLabel() {
- return name;
- }
-
- public ILaunch getLaunch() {
- return launch;
- }
-
- public boolean isTerminated() {
- return connectionTerminate.isTerminated();
- }
-
- public void terminate() throws DebugException {
- connectionTerminate.terminate();
- }
-
- public boolean canTerminate() {
- return connectionTerminate.canTerminate();
- }
-
- public IStreamsProxy getStreamsProxy() {
- return streamsProxy;
- }
-
- /*
- * We do not expect intensive usage of attributes for this class. In fact, other option was to
- * keep this method no-op.
- */
- public synchronized void setAttribute(String key, String value) {
- if (attributes == null) {
- attributes = new HashMap(1);
- }
- String origVal = attributes.get(key);
- if (origVal != null && origVal.equals(value)) {
- return;
- }
-
- attributes.put(key, value);
- fireChangeEvent();
- }
-
- /*
- * We do not expect intensive usage of attributes for this class. In fact, other option was to
- * put a stub here.
- */
- public synchronized String getAttribute(String key) {
- if (attributes == null) {
- return null;
- }
- return attributes.get(key);
- }
-
- public int getExitValue() throws DebugException {
- if (isTerminated()) {
- return 0;
- }
- throw new DebugException(new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
- "Process hasn't been terminated yet")); //$NON-NLS-1$
- }
-
- private void fireCreationEvent() {
- fireEvent(new DebugEvent(this, DebugEvent.CREATE));
- }
-
- private void fireEvent(DebugEvent event) {
- DebugPlugin manager = DebugPlugin.getDefault();
- if (manager != null) {
- manager.fireDebugEventSet(new DebugEvent[] { event });
- }
- }
-
- private void fireTerminateEvent() {
- outputMonitor.flush();
- fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
- }
-
- private void fireChangeEvent() {
- fireEvent(new DebugEvent(this, DebugEvent.CHANGE));
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter.equals(IProcess.class)) {
- return this;
- }
- if (adapter.equals(ILaunch.class)) {
- return getLaunch();
- }
- if (adapter.equals(ILaunchConfiguration.class)) {
- return getLaunch().getLaunchConfiguration();
- }
- return super.getAdapter(adapter);
- }
-
-
- private static class NullStreamMonitor implements IStreamMonitor {
- public void addListener(IStreamListener listener) {
- }
- public String getContents() {
- return null;
- }
- public void removeListener(IStreamListener listener) {
- }
- static final NullStreamMonitor INSTANCE = new NullStreamMonitor();
- }
-
- /**
- * Responsible for getting text as {@link Writer} and retransmitting it
- * as {@link IStreamMonitor} to whoever is interested.
- * However in its initial state it only receives signal (the text) and saves it in a buffer.
- * For {@link Retransmitter} to start giving the signal away one should
- * call {@link #startFlushing} method.
- */
- public static class Retransmitter extends Writer implements IStreamMonitor {
- private StringWriter writer = new StringWriter();
- private boolean isFlushing = false;
- private final List listeners = new ArrayList(2);
- private volatile ConsolePseudoProcess consolePseudoProcess = null;
-
- public synchronized void addListener(IStreamListener listener) {
- listeners.add(listener);
- }
-
- public String getContents() {
- return null;
- }
-
- public synchronized void removeListener(IStreamListener listener) {
- listeners.remove(listener);
- }
-
- @Override
- public synchronized void flush() {
- if (!isFlushing) {
- return;
- }
- String text = writer.toString();
- int lastLinePos;
- final boolean flushOnlyFullLines = true;
- if (flushOnlyFullLines) {
- int pos = text.lastIndexOf('\n');
- if (pos == -1) {
- // No full line in the buffer.
- return;
- }
- lastLinePos = pos + 1;
- } else {
- lastLinePos = text.length();
- }
- String readyText = text.substring(0, lastLinePos);
- writer = new StringWriter();
- if (lastLinePos != text.length()) {
- String rest = text.substring(lastLinePos);
- writer.append(rest);
- }
- for (IStreamListener listener : listeners) {
- listener.streamAppended(readyText, this);
- }
- }
-
- @Override
- public synchronized void close() {
- // do nothing
- }
-
- @Override
- public synchronized void write(char[] cbuf, int off, int len) {
- writer.write(cbuf, off, len);
- }
-
- public synchronized void startFlushing() {
- isFlushing = true;
- flush();
- }
-
- public void processClosed() {
- ConsolePseudoProcess consolePseudoProcess0 = this.consolePseudoProcess;
- if (consolePseudoProcess0 != null) {
- consolePseudoProcess0.fireTerminateEvent();
- }
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugElementImpl.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugElementImpl.java
deleted file mode 100755
index 3c18fd8c..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugElementImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.model.JavascriptThread.SuspendedState;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IDebugElement;
-
-/**
- * A generic IDebugElement implementation. It holds a familiy of more specialized
- * base classes.
- */
-public abstract class DebugElementImpl extends PlatformObject implements IDebugElement {
- public abstract DebugTargetImpl getDebugTarget();
-
- public ILaunch getLaunch() {
- return getDebugTarget().getLaunch();
- }
-
- public String getModelIdentifier() {
- return getDebugTarget().getChromiumModelIdentifier();
- }
-
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter == IDebugElement.class) {
- return this;
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * An abstract base class for debug element that refers to {@link ConnectedTargetData}.
- * It declares no data field.
- */
- public static abstract class WithConnectedBase extends DebugElementImpl {
- @Override
- public DebugTargetImpl getDebugTarget() {
- return getConnectedData().getDebugTarget();
- }
-
- public abstract ConnectedTargetData getConnectedData();
- }
-
- /**
- * A base class for debug element that refers to {@link ConnectedTargetData}.
- */
- public static class WithConnected extends WithConnectedBase {
- private final ConnectedTargetData connectedTargetData;
-
- public WithConnected(ConnectedTargetData connectedTargetData) {
- this.connectedTargetData = connectedTargetData;
- }
-
- @Override
- public ConnectedTargetData getConnectedData() {
- return connectedTargetData;
- }
- }
-
- /**
- * An abstract base class for debug element that refers to
- * {@link JavascriptThread.SuspendedState}. It declares no data field.
- */
- public static abstract class WithSuspendedBase extends WithConnectedBase {
- public ConnectedTargetData getConnectedData() {
- return getSuspendedState().getThread().getConnectedData();
- }
-
- public abstract JavascriptThread.SuspendedState getSuspendedState();
- }
-
- /**
- * A base class for debug element that refers to {@link JavascriptThread.SuspendedState}.
- */
- public static class WithSuspended extends WithSuspendedBase {
- private final JavascriptThread.SuspendedState suspendedState;
-
- public WithSuspended(JavascriptThread.SuspendedState suspendedState) {
- this.suspendedState = suspendedState;
- }
-
- @Override
- public SuspendedState getSuspendedState() {
- return suspendedState;
- }
- }
-
- /**
- * An abstract base class for debug element that refers to {@link EvaluateContext}.
- * It declares no data field.
- */
- public static abstract class WithEvaluateBase extends WithSuspendedBase {
- @Override
- public SuspendedState getSuspendedState() {
- return getEvaluateContext().getThreadSuspendedState();
- }
-
- public abstract EvaluateContext getEvaluateContext();
- }
-
- /**
- * A base class for debug element that refers to {@link EvaluateContext}.
- */
- public static class WithEvaluate extends WithEvaluateBase {
- private final EvaluateContext evaluateContext;
-
- public WithEvaluate(EvaluateContext evaluateContext) {
- this.evaluateContext = evaluateContext;
- }
-
- @Override
- public EvaluateContext getEvaluateContext() {
- return evaluateContext;
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugTargetImpl.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugTargetImpl.java
deleted file mode 100755
index 01b829b8..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugTargetImpl.java
+++ /dev/null
@@ -1,374 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.model.BreakpointSynchronizer.Direction;
-import org.chromium.sdk.util.Destructable;
-import org.chromium.sdk.util.DestructingGuard;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IBreakpointListener;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IDisconnect;
-import org.eclipse.debug.core.model.IMemoryBlock;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.ISuspendResume;
-import org.eclipse.debug.core.model.ITerminate;
-import org.eclipse.debug.core.model.IThread;
-
-/**
- * An IDebugTarget implementation for remote JavaScript debugging.
- * This class is essentially a thin wrapper that uses its internal state object
- * as implementation. The at first target is in 'initialize' state, later
- * it should transfer into 'normal' state.
- */
-
-public class DebugTargetImpl extends DebugElementImpl implements IDebugTarget {
- /**
- * Loads browser tabs, consults the {@code selector} which of the tabs to
- * attach to, and if any has been selected, requests an attachment to the tab.
- *
- * @param debugTargetImpl target that is attached
- * @param remoteServer embedding application we are connected with
- * @param destructingGuard guard that should gain any destructable value -- a caller
- * will dispose everything if this method fails
- * @param attachCallback to invoke on successful attachment, can fail to be called
- * @param monitor to report the progress to
- * @return false if user canceled attach (via tab selection dialog) or true otherwise
- */
- public static boolean attach(DebugTargetImpl debugTargetImpl,
- JavascriptVmEmbedder.ConnectionToRemote remoteServer,
- DestructingGuard destructingGuard, Runnable attachCallback,
- IProgressMonitor monitor) throws CoreException {
-
- monitor.beginTask("", 2); //$NON-NLS-1$
- JavascriptVmEmbedder.VmConnector connector = remoteServer.selectVm();
- if (connector == null) {
- return false;
- }
-
- monitor.worked(1);
-
- ConnectedTargetData.TargetInnerState connectedState;
- ConnectedTargetData connectedData;
-
- ListenerBlock listenerBlock = new ListenerBlock();
- try {
- connectedState = ConnectedTargetData.create(debugTargetImpl, listenerBlock);
- connectedData = connectedState.getConnectedTargetData();
-
- final JavascriptVmEmbedder embedder = connector.attach(connectedData.getEmbedderListener(),
- connectedData.getDebugEventListener());
- // From this moment V8 may call our listeners. We block them by listenerBlock for a while.
-
- Destructable embedderDestructor = new Destructable() {
- public void destruct() {
- embedder.getJavascriptVm().detach();
- }
- };
-
- destructingGuard.addValue(embedderDestructor);
-
- connectedData.setVmEmbedder(embedder);
-
- debugTargetImpl.setInnerState(connectedState);
-
- connectedData.fireBecameConnectedEvents();
-
- listenerBlock.setProperlyInitialized();
- } finally {
- listenerBlock.unblock();
- }
-
- connectedData.initListeners();
-
- try {
- if (attachCallback != null) {
- attachCallback.run();
- }
- } catch (Exception e) {
- ChromiumDebugPlugin.log(e);
- }
-
- return true;
- }
-
- /**
- * Defines an actual state of target. It is who implements virtually all operations
- * of {@link DebugTargetImpl}.
- */
- static abstract class State {
- abstract ITerminate getTerminate();
- abstract ISuspendResume getSuspendResume();
- abstract IDisconnect getDisconnect();
- abstract IBreakpointListener getBreakpointListner();
- abstract IThread[] getThreads() throws DebugException;
- abstract String getName();
- abstract String getVmStatus();
- abstract boolean supportsBreakpoint(IBreakpoint breakpoint);
- abstract EvaluateContext getEvaluateContext();
- abstract ConnectedTargetData getConnectedTargetDataOrNull();
- }
-
- static final IThread[] EMPTY_THREADS = new IThread[0];
-
- private final WorkspaceBridge.Factory workspaceBridgeFactory;
-
- private final SourceWrapSupport sourceWrapSupport;
-
- private final ILaunch launch;
- private final BreakpointSynchronizer.Direction presetSyncDirection;
- private volatile State currentState = new TargetInitializeState(this);
-
- public DebugTargetImpl(ILaunch launch, WorkspaceBridge.Factory workspaceBridgeFactory,
- SourceWrapSupport sourceWrapSupport, BreakpointSynchronizer.Direction presetSyncDirection) {
- this.launch = launch;
- this.workspaceBridgeFactory = workspaceBridgeFactory;
- this.sourceWrapSupport = sourceWrapSupport;
- this.presetSyncDirection = presetSyncDirection;
- }
-
- public void fireTargetCreated() {
- fireDebugEvent(new DebugEvent(this, DebugEvent.CREATE));
- }
-
- void setInnerState(State state) {
- currentState = state;
- }
-
- ConnectedTargetData getConnectedDataOrNull() {
- return currentState.getConnectedTargetDataOrNull();
- }
-
- WorkspaceBridge.Factory getWorkspaceBridgeFactory() {
- return workspaceBridgeFactory;
- }
-
- @Override
- public DebugTargetImpl getDebugTarget() {
- return this;
- }
-
- @Override
- public ILaunch getLaunch() {
- return launch;
- }
-
- @Override
- public boolean canTerminate() {
- return currentState.getTerminate().canTerminate();
- }
-
- @Override
- public boolean isTerminated() {
- return currentState.getTerminate().isTerminated();
- }
-
- @Override
- public void terminate() throws DebugException {
- currentState.getTerminate().terminate();
- }
-
- @Override
- public boolean canResume() {
- return currentState.getSuspendResume().canResume();
- }
-
- @Override
- public boolean canSuspend() {
- return currentState.getSuspendResume().canSuspend();
- }
-
- @Override
- public boolean isSuspended() {
- return currentState.getSuspendResume().isSuspended();
- }
-
- @Override
- public void resume() throws DebugException {
- currentState.getSuspendResume().resume();
- }
-
- @Override
- public void suspend() throws DebugException {
- currentState.getSuspendResume().suspend();
- }
-
- @Override
- public void breakpointAdded(IBreakpoint breakpoint) {
- currentState.getBreakpointListner().breakpointAdded(breakpoint);
- }
-
- @Override
- public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
- currentState.getBreakpointListner().breakpointRemoved(breakpoint, delta);
- }
-
- @Override
- public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
- currentState.getBreakpointListner().breakpointChanged(breakpoint, delta);
- }
-
- @Override
- public boolean canDisconnect() {
- return currentState.getDisconnect().canDisconnect();
- }
-
- @Override
- public void disconnect() throws DebugException {
- currentState.getDisconnect().disconnect();
- }
-
- @Override
- public boolean isDisconnected() {
- return currentState.getDisconnect().isDisconnected();
- }
-
- @Override
- public boolean supportsStorageRetrieval() {
- return false;
- }
-
- @Override
- public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException {
- return null;
- }
-
- @Override
- public IProcess getProcess() {
- return null;
- }
-
- @Override
- public IThread[] getThreads() throws DebugException {
- return currentState.getThreads();
- }
-
- @Override
- public boolean hasThreads() throws DebugException {
- return getThreads().length != 0;
- }
-
- @Override
- public String getName() {
- return currentState.getName();
- }
-
- @Override
- public boolean supportsBreakpoint(IBreakpoint breakpoint) {
- return currentState.supportsBreakpoint(breakpoint);
- }
-
- public String getChromiumModelIdentifier() {
- return workspaceBridgeFactory.getDebugModelIdentifier();
- }
-
- public WorkspaceBridge.JsLabelProvider getLabelProvider() {
- return workspaceBridgeFactory.getLabelProvider();
- }
-
- public String getVmStatus() {
- return currentState.getVmStatus();
- }
-
- public ConnectedTargetData getConnectedOrNull() {
- return currentState.getConnectedTargetDataOrNull();
- }
-
- public SourceWrapSupport getSourceWrapSupport() {
- return sourceWrapSupport;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter == EvaluateContext.class) {
- return currentState.getEvaluateContext();
- } else if (adapter == ILaunch.class) {
- return this.launch;
- }
- return super.getAdapter(adapter);
- }
-
- public static List getAllConnectedTargetDatas() {
- IDebugTarget[] array = DebugPlugin.getDefault().getLaunchManager().getDebugTargets();
- List result = new ArrayList(array.length);
- for (IDebugTarget target : array) {
- if (target instanceof DebugTargetImpl == false) {
- continue;
- }
- if (target.getLaunch().isTerminated()) {
- continue;
- }
- DebugTargetImpl debugTargetImpl = (DebugTargetImpl) target;
-
- ConnectedTargetData connectedData = debugTargetImpl.getConnectedDataOrNull();
-
- if (connectedData == null) {
- continue;
- }
-
- result.add(connectedData);
- }
- return result;
- }
-
- static class ListenerBlock {
- private volatile boolean isBlocked = true;
- private volatile boolean hasBeenProperlyInitialized = false;
- private final Object monitor = new Object();
- void waitUntilReady() {
- if (isBlocked) {
- synchronized (monitor) {
- while (isBlocked) {
- try {
- monitor.wait();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- if (!hasBeenProperlyInitialized) {
- throw new RuntimeException("DebugTarget has not been properly initialized"); //$NON-NLS-1$
- }
- }
- void setProperlyInitialized() {
- hasBeenProperlyInitialized = true;
- }
- void unblock() {
- isBlocked = false;
- synchronized (monitor) {
- monitor.notifyAll();
- }
- }
- }
-
- /**
- * Fires a debug event
- *
- * @param event to be fired
- */
- public static void fireDebugEvent(DebugEvent event) {
- DebugPlugin debugPlugin = DebugPlugin.getDefault();
- if (debugPlugin != null) {
- debugPlugin.fireDebugEventSet(new DebugEvent[] { event });
- }
- }
-
- public BreakpointSynchronizer.Direction getPresetSyncDirection() {
- return presetSyncDirection;
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/EvaluateContext.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/EvaluateContext.java
deleted file mode 100644
index 6b304c33..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/EvaluateContext.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.sdk.JsEvaluateContext;
-
-/**
- * Projection of {@link JsEvaluateContext} into Eclipse world.
- */
-public class EvaluateContext {
- private final JsEvaluateContext jsEvaluateContext;
- private final JavascriptThread.SuspendedState threadState;
-
- EvaluateContext(JsEvaluateContext jsEvaluateContext,
- JavascriptThread.SuspendedState threadState) {
- this.jsEvaluateContext = jsEvaluateContext;
- this.threadState = threadState;
- }
-
- public JsEvaluateContext getJsEvaluateContext() {
- return jsEvaluateContext;
- }
-
- public JavascriptThread.SuspendedState getThreadSuspendedState() {
- return threadState;
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/HardcodedSourceWrapProvider.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/HardcodedSourceWrapProvider.java
deleted file mode 100644
index daa80bd9..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/HardcodedSourceWrapProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.osgi.util.NLS;
-import org.json.simple.JSONObject;
-
-/**
- * Provides a set of standard known source wrappers (for example for Node.JS).
- */
-public class HardcodedSourceWrapProvider implements IPredefinedSourceWrapProvider {
- @Override
- public Collection getWrappers() {
- return entries;
- }
-
- private final List entries =
- Arrays.asList(new NodeJsStandardEntry(), new NodeJsWithDefinedEntry());
-
- private static abstract class NodeJsBase extends Entry {
- protected static final String SUFFIX = "\n});"; //$NON-NLS-1$
-
- private final String prefix;
-
- NodeJsBase(String id, String name, String prefix) {
- super(id, new SourceWrapSupport.StringBasedWrapper(name, prefix, SUFFIX));
- this.prefix = prefix;
- }
-
- @Override
- public String getHumanDescription() {
- JSONObject object = new JSONObject();
- object.put("prefix", prefix); //$NON-NLS-1$
- object.put("suffix", SUFFIX); //$NON-NLS-1$
-
- return NLS.bind(Messages.HardcodedSourceWrapProvider_DESCRIPTION, getSpecialization(),
- object.toJSONString());
- }
-
- protected abstract String getSpecialization();
- }
-
- private static class NodeJsStandardEntry extends NodeJsBase {
- private static final String NAME = Messages.HardcodedSourceWrapProvider_STANDARD;
- // As defined at https://github.com/joyent/node.git
- // commit fc025f878a0b7a5bbb5810005da3e09cb856b773 Jan 31, 2010 (version 0.1.29)
- private static final String PREFIX =
- "(function (exports, require, module, __filename, __dirname) { "; //$NON-NLS-1$
-
- NodeJsStandardEntry() {
- super(NodeJsStandardEntry.class.getName(), NAME, PREFIX);
- }
-
- @Override
- protected String getSpecialization() {
- return Messages.HardcodedSourceWrapProvider_STANDARD_2;
- }
- }
-
- private static class NodeJsWithDefinedEntry extends NodeJsBase {
- private static final String NAME = Messages.HardcodedSourceWrapProvider_WITH_DEFINED_2;
- // As defined at https://github.com/joyent/node.git between commits:
- // 703a1ffe52b66972f38db19fb68e0f70c3dd2631 Jul 29, 2011 (version 0.5.3)
- // 9967c369c9272335bb0343558673b689725c6d7c Jun 12, 2011 (version 0.5.0)
- private static final String PREFIX =
- "(function (exports, require, module, __filename, __dirname, define) { "; //$NON-NLS-1$
-
- NodeJsWithDefinedEntry() {
- super(NodeJsWithDefinedEntry.class.getName(), NAME, PREFIX);
- }
-
- @Override
- protected String getSpecialization() {
- return Messages.HardcodedSourceWrapProvider_WITH_DEFINED;
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/IPredefinedSourceWrapProvider.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/IPredefinedSourceWrapProvider.java
deleted file mode 100644
index 712b7986..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/IPredefinedSourceWrapProvider.java
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.RegistryFactory;
-
-/**
- * Provides a collection of source wrappers. They are predefined and immutable.
- */
-public interface IPredefinedSourceWrapProvider {
- Collection getWrappers();
-
- /**
- * Describes source wrapper.
- */
- abstract class Entry {
- private final String id;
- private final SourceWrapSupport.Wrapper wrapper;
-
- public Entry(String id, SourceWrapSupport.Wrapper wrapper) {
- this.id = id;
- this.wrapper = wrapper;
- }
-
- /**
- * @return a unique id of the source wrap entry (fully qualified name is recommended)
- */
- public String getId() {
- return id;
- }
-
- /**
- * @return an instance of source wrapper
- */
- public SourceWrapSupport.Wrapper getWrapper() {
- return wrapper;
- }
-
- /**
- * @return a human-readable wrapper description that can be used in UI
- */
- public abstract String getHumanDescription();
- }
-
- /**
- * Provides a standard mean of accessing instance of this interface. It uses
- * Eclipse/OSGI extension registry.
- */
- class Access {
- public static final String EXTENSION_POINT_ID =
- "org.chromium.debug.core.model_IPredefinedSourceWrapProvider";
- public static final String ELEMENT_NAME = "wrap-provider";
- public static final String CLASS_PROPERTY = "class";
-
- /**
- * @return all entries from all providers in for of id-to-entry map
- */
- public static Map getEntries() {
- return ENTRY_MAP;
- }
-
- private static final Map ENTRY_MAP;
- static {
- ENTRY_MAP = new HashMap();
- for (IPredefinedSourceWrapProvider provider : getProviders()) {
- for (IPredefinedSourceWrapProvider.Entry entry : provider.getWrappers()) {
- ENTRY_MAP.put(entry.getId(), entry);
- }
- }
- }
-
- /**
- * Provides a standard mean of getting an instances of interface. It uses
- * Eclipse/OSGI extension registry.
- */
- private static Collection getProviders() {
- List result = new ArrayList();
- IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
- EXTENSION_POINT_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
-
- for (IExtension extension : extensions) {
- for (IConfigurationElement element : extension.getConfigurationElements()) {
- if (!ELEMENT_NAME.equals(element.getName())) {
- continue;
- }
- Object obj;
- try {
- obj = element.createExecutableExtension(CLASS_PROPERTY);
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- IPredefinedSourceWrapProvider provider = (IPredefinedSourceWrapProvider) obj;
- result.add(provider);
- }
- }
- return result;
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/IgnoreCountData.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/IgnoreCountData.java
deleted file mode 100644
index efde8e30..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/IgnoreCountData.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.sdk.Breakpoint;
-
-/**
- * A structure used to store ignore count parameter. It contains integer 'value' and
- * additional field 'state' (see the enum).
- */
-public class IgnoreCountData {
- public static IgnoreCountData parseString(String input) {
- int separatorPos = input.indexOf('/');
- String valueStr;
- String stateStr;
- if (separatorPos == -1) {
- valueStr = input;
- stateStr = null;
- } else {
- valueStr = input.substring(0, separatorPos);
- stateStr = input.substring(separatorPos + 1);
- }
- int value;
- if (valueStr.isEmpty()) {
- value = Breakpoint.EMPTY_VALUE;
- } else {
- try {
- value = Integer.parseInt(valueStr);
- } catch (NumberFormatException e) {
- ChromiumDebugPlugin.log(new Exception("Failed to parse ignore count value: " + input, e));
- value = Breakpoint.EMPTY_VALUE;
- }
- }
-
- IgnoreCountData.State state;
- if (stateStr == null) {
- if (value == Breakpoint.EMPTY_VALUE) {
- state = State.DISABLED;
- } else {
- state = State.ENABLED;
- }
- } else {
- try {
- state = State.valueOf(stateStr);
- } catch (IllegalArgumentException e) {
- ChromiumDebugPlugin.log(new Exception("Failed to parse ignore count value: " + input, e));
- state = State.ENABLED;
- }
- }
- return new IgnoreCountData(value, state);
- }
-
- private int value;
- private IgnoreCountData.State state;
-
- public IgnoreCountData(int value, IgnoreCountData.State state) {
- this.value = value;
- this.state = state;
- }
- public int getValue() {
- return value;
- }
- public void setValue(int value) {
- this.value = value;
- }
-
- public int getEffectiveValue() {
- if (state == IgnoreCountData.State.ENABLED) {
- return value;
- } else {
- return Breakpoint.EMPTY_VALUE;
- }
- }
-
- public IgnoreCountData.State getState() {
- return state;
- }
- public void setState(IgnoreCountData.State state) {
- this.state = state;
- }
- public String getStringRepresentation() {
- return value + "/" + state.toString();
- }
-
- /**
- * Additional field of the ignore count data. It modulates semantics of the numeric 'value'.
- */
- public enum State {
- /**
- * User has set ignore count for the breakpoint, value stores the number.
- */
- ENABLED,
-
- /**
- * User has disabled ignore count, value stores last used number and is visible
- * in 'properties' dialog.
- */
- DISABLED,
-
- /**
- * IDE has disabled ignore count because debugger finally has stopped on the breakpoint.
- * This differs from {@link #DISABLED} only to give breakpoint handler a hint that this
- * change mustn't be applied to SDK.
- */
- RESET
- }
-}
\ No newline at end of file
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavaScriptFormatter.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavaScriptFormatter.java
deleted file mode 100644
index 65b29811..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavaScriptFormatter.java
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.RegistryFactory;
-
-/**
- * Provides a format operation for JavaScript source text. Result is optimized for
- * future position translation operation.
- *
- * A particular implementation of adapter should be registered as an extension.
- */
-public interface JavaScriptFormatter {
-
- Result format(String sourceString);
-
- /**
- * Represents formatting result. It contains a formatted text and a mapping
- * between original and formatted versions.
- */
- interface Result {
- String getFormattedText();
-
- StringMappingData getInputTextData();
- StringMappingData getFormattedTextData();
- }
-
- /**
- * Provides a standard mean of getting a single implementation of this interface. It uses
- * Eclipse/OSGI extension registry.
- */
- class Access {
- public static final String EXTENSION_POINT_ID =
- "org.chromium.debug.core.model_JavaScriptFormatter";
- public static final String ELEMENT_NAME = "formatter";
- public static final String CLASS_PROPERTY = "class";
-
- /**
- * @return an instance of (any random) implementation of {@link JavaScriptFormatter} or null
- */
- public static JavaScriptFormatter getInstance() {
- IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(
- EXTENSION_POINT_ID);
- IExtension[] extensions = extensionPoint.getExtensions();
-
- for (IExtension extension : extensions) {
- for (IConfigurationElement element : extension.getConfigurationElements()) {
- if (!ELEMENT_NAME.equals(element.getName())) {
- continue;
- }
- Object obj;
- try {
- obj = element.createExecutableExtension(CLASS_PROPERTY);
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- return (JavaScriptFormatter) obj;
- }
- }
- return null;
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptThread.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptThread.java
deleted file mode 100644
index 51873f14..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptThread.java
+++ /dev/null
@@ -1,590 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import static org.chromium.sdk.util.BasicUtil.toArray;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.sdk.Breakpoint;
-import org.chromium.sdk.CallFrame;
-import org.chromium.sdk.DebugContext;
-import org.chromium.sdk.DebugContext.StepAction;
-import org.chromium.sdk.ExceptionData;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.ISuspendResume;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.core.model.IVariable;
-
-/**
- * This class represents the only Chromium V8 VM thread.
- */
-public class JavascriptThread extends DebugElementImpl.WithConnected
- implements IThread, IAdaptable {
-
- private final RemoteEventListener remoteEventListener = new RemoteEventListener();
-
- private volatile StepState currentStepState = new RunningState(ResumeReason.UNSPECIFIED);
- private final Object currentStepStateMonitor = new Object();
-
- private volatile SuspendReason expectedSuspendReason = SuspendReason.UNSPECIFIED;
-
- /**
- * Holds 'suspended' state of the thread. As such has a getter to {@link DebugContext}.
- * It also keep references to basic enclosing objects.
- */
- public interface SuspendedState {
- JavascriptThread getThread();
-
- DebugContext getDebugContext();
-
- /**
- * Unsafe asynchronous getter: may return false, while the actual value has become true.
- */
- boolean isDismissed();
- }
-
- /**
- * Visitor that is used to describe thread state in UI. It doesn't expose too much of internals.
- */
- public interface StateVisitor {
- R visitResumed(ResumeReason resumeReason);
- R visitSuspended(IBreakpoint[] breakpoints, ExceptionData exceptionData);
- }
-
- /**
- * Constructs a new thread for the given target
- *
- * @param connectedTargetData this thread is created for
- */
- public JavascriptThread(ConnectedTargetData connectedTargetData) {
- super(connectedTargetData);
- }
-
- /**
- * @return a separated interface for all remote events dispatching
- */
- RemoteEventListener getRemoteEventListener() {
- return remoteEventListener;
- }
-
- ISuspendResume getSuspendResumeAspect() {
- return suspendResumeAspect;
- }
-
- public StackFrameBase[] getStackFrames() throws DebugException {
- return currentStepState.getStackFrames();
- }
-
- /**
- * @return expose some information about thread state for UI presentation
- */
- public R describeState(StateVisitor visitor) {
- return currentStepState.describeState(visitor);
- }
-
- private static StackFrameBase[] wrapStackFrames(JavascriptThread.SuspendedState threadState) {
- DebugContext debugContext = threadState.getDebugContext();
- List extends CallFrame> jsFrames = debugContext.getCallFrames();
- List result = new ArrayList(jsFrames.size() + 1);
-
- ExceptionData exceptionData = debugContext.getExceptionData();
- if (exceptionData != null) {
- // Add fake 'throw exception' frame.
- EvaluateContext evaluateContext =
- new EvaluateContext(debugContext.getGlobalEvaluateContext(), threadState);
- result.add(new ExceptionStackFrame(evaluateContext, exceptionData));
- }
- for (CallFrame jsFrame : jsFrames) {
- result.add(new StackFrame(threadState, jsFrame));
- }
- return toArray(result, StackFrameBase.class);
- }
-
- /**
- * A fake stackframe that represents 'throwing exception'. It's a frame that holds an exception
- * as its only variable. This might be the only means to expose exception value to user because
- * exception may be raised with no frames on stack (e.g. compile error).
- */
- private static class ExceptionStackFrame extends StackFrameBase {
- private final IVariable[] variables;
- private final ExceptionData exceptionData;
-
- private ExceptionStackFrame(EvaluateContext evaluateContext, ExceptionData exceptionData) {
- super(evaluateContext);
- this.exceptionData = exceptionData;
-
- Variable variable = Variable.forException(evaluateContext, exceptionData);
- variables = new IVariable[] { variable };
- }
-
- @Override
- public IVariable[] getVariables() throws DebugException {
- return variables;
- }
-
- @Override
- public boolean hasVariables() throws DebugException {
- return variables.length > 0;
- }
-
- @Override
- public int getLineNumber() throws DebugException {
- return -1;
- }
-
- @Override
- public int getCharStart() throws DebugException {
- return -1;
- }
-
- @Override
- public int getCharEnd() throws DebugException {
- return getCharStart();
- }
-
- @Override
- public String getName() throws DebugException {
- return "";
- }
-
- @Override
- Object getObjectForEquals() {
- return exceptionData;
- }
-
- @Override
- boolean isRegularFrame() {
- return false;
- }
- }
-
- public boolean hasStackFrames() throws DebugException {
- return isSuspended();
- }
-
- public int getPriority() throws DebugException {
- return 0;
- }
-
- public IStackFrame getTopStackFrame() throws DebugException {
- // Do not return frames[0] if it's a fake 'exception throwing' frame.
- StackFrameBase[] frames = getStackFrames();
- if (frames.length == 0) {
- return null;
- }
- if (frames[0].isRegularFrame()) {
- return frames[0];
- }
- if (frames.length == 1) {
- return null;
- }
- return frames[1];
- }
-
- public String getName() throws DebugException {
- return getDebugTarget().getLabelProvider().getThreadLabel(this);
- }
-
- public IBreakpoint[] getBreakpoints() {
- return currentStepState.getBreakpoints();
- }
-
- public boolean canResume() {
- return suspendResumeAspect.canResume();
- }
-
- public boolean canSuspend() {
- return suspendResumeAspect.canSuspend();
- }
-
- public boolean isSuspended() {
- return suspendResumeAspect.isSuspended();
- }
-
- public void resume() throws DebugException {
- suspendResumeAspect.resume();
- }
-
- public void suspend() throws DebugException {
- suspendResumeAspect.suspend();
- }
-
- public boolean canStepInto() {
- return currentStepState.canStep();
- }
-
- public boolean canStepOver() {
- return currentStepState.canStep();
- }
-
- public boolean canStepReturn() {
- return currentStepState.canStep();
- }
-
- public boolean isStepping() {
- return currentStepState.isStepping();
- }
-
- public void stepInto() throws DebugException {
- currentStepState.step(StepAction.IN, ResumeReason.STEP_INTO);
- }
-
- public void stepOver() throws DebugException {
- currentStepState.step(StepAction.OVER, ResumeReason.STEP_OVER);
- }
-
- public void stepReturn() throws DebugException {
- currentStepState.step(StepAction.OUT, ResumeReason.STEP_RETURN);
- }
-
- public boolean canTerminate() {
- return getDebugTarget().canTerminate();
- }
-
- public boolean isTerminated() {
- return getDebugTarget().isTerminated();
- }
-
- public void terminate() throws DebugException {
- getDebugTarget().terminate();
- }
-
- EvaluateContext getEvaluateContext() {
- return currentStepState.getEvaluateContext();
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- if (adapter == EvaluateContext.class) {
- return getEvaluateContext();
- }
- return super.getAdapter(adapter);
- }
-
- class RemoteEventListener {
-
- void suspended(DebugContext context) {
- SuspendedStateImpl suspendedState;
- synchronized (currentStepStateMonitor) {
- if (currentStepState.isSuspended()) {
- throw new IllegalStateException("Already in suspended state");
- }
- suspendedState = new SuspendedStateImpl(context);
- currentStepState = suspendedState;
- }
-
- WorkspaceBridge workspaceRelations = getConnectedData().getWorkspaceRelations();
-
- Collection extends IBreakpoint> uiBreakpointsHit;
- SuspendReason suspendedReason;
-
- if (context.getState() == DebugContext.State.EXCEPTION) {
- uiBreakpointsHit =
- workspaceRelations.getBreakpointHandler().exceptionBreakpointHit(
- context.getExceptionData().isUncaught());
- suspendedReason = SuspendReason.BREAKPOINT;
- } else {
- Collection extends Breakpoint> sdkBreakpointsHit = context.getBreakpointsHit();
- uiBreakpointsHit =
- workspaceRelations.getBreakpointHandler().breakpointsHit(sdkBreakpointsHit);
- if (sdkBreakpointsHit.isEmpty()) {
- suspendedReason = expectedSuspendReason;
- } else {
- suspendedReason = SuspendReason.BREAKPOINT;
- }
- }
-
- suspendedState.setBreakpoints(uiBreakpointsHit);
-
- int suspendedDetail;
- if (suspendedReason == null) {
- suspendedDetail = DebugEvent.UNSPECIFIED;
- } else {
- suspendedDetail = suspendedReason.detailCode;
- }
- getConnectedData().fireSuspendEvent(suspendedDetail);
- }
-
- void resumed(ResumeReason resumeReason) {
- synchronized (currentStepStateMonitor) {
- if (!currentStepState.isSuspended()) {
- // Ignore.
- return;
- }
- if (resumeReason == null) {
- resumeReason = ResumeReason.UNSPECIFIED;
- }
- currentStepState.dismiss();
- currentStepState = new RunningState(resumeReason);
- }
- getConnectedData().fireResumeEvent(resumeReason.detailCode);
- }
-
- }
-
- private static abstract class StepState {
- abstract EvaluateContext getEvaluateContext();
-
- abstract IBreakpoint[] getBreakpoints();
-
- abstract StackFrameBase[] getStackFrames();
-
- abstract boolean isSuspended();
- abstract void resume();
- abstract boolean canSuspend();
- abstract void suspend();
-
- abstract boolean isStepping();
- abstract void step(StepAction stepAction, ResumeReason resumeReason);
- abstract boolean canStep();
-
- abstract R describeState(StateVisitor visitor);
-
- abstract void dismiss();
- }
-
- private class RunningState extends StepState {
- private final ResumeReason resumeReason;
-
- RunningState(ResumeReason resumeReason) {
- this.resumeReason = resumeReason;
- }
-
- @Override boolean isSuspended() {
- return false;
- }
-
- @Override boolean canSuspend() {
- return true;
- }
-
- @Override
- void suspend() {
- expectedSuspendReason = SuspendReason.CLIENT_REQUEST;
- getConnectedData().getJavascriptVm().suspend(null);
- }
-
- @Override StackFrameBase[] getStackFrames() {
- return EMPTY_FRAMES;
- }
-
- @Override IBreakpoint[] getBreakpoints() {
- return EMPTY_BREAKPOINTS;
- }
-
- @Override boolean isStepping() {
- return resumeReason.isStepping;
- }
-
- @Override boolean canStep() {
- return false;
- }
-
- @Override void step(StepAction stepAction, ResumeReason resumeReason) {
- // Ignore.
- }
-
- @Override void resume() {
- // Ignore.
- }
-
- @Override EvaluateContext getEvaluateContext() {
- return null;
- }
-
- @Override void dismiss() {
- }
-
- @Override
- R describeState(StateVisitor visitor) {
- return visitor.visitResumed(resumeReason);
- }
- }
-
- private class SuspendedStateImpl extends StepState implements SuspendedState {
- private final DebugContext context;
- private volatile boolean isDismissed = false;
-
- /**
- * Breakpoints this thread is suspended at or empty array if none.
- */
- private volatile IBreakpoint[] breakpoints = EMPTY_BREAKPOINTS;
-
- /**
- * Cached stack
- */
- private final AtomicReference stackFrames =
- new AtomicReference(null);
-
- SuspendedStateImpl(DebugContext context) {
- this.context = context;
- }
-
- @Override public JavascriptThread getThread() {
- return JavascriptThread.this;
- }
-
- @Override public DebugContext getDebugContext() {
- return context;
- }
-
- @Override void dismiss() {
- isDismissed = true;
- }
-
- @Override public boolean isDismissed() {
- return isDismissed;
- }
-
- void setBreakpoints(Collection extends IBreakpoint> uiBreakpoints) {
- this.breakpoints = toArray(uiBreakpoints, IBreakpoint.class);
- }
-
- @Override boolean isSuspended() {
- return true;
- }
-
- @Override boolean canSuspend() {
- return false;
- }
-
- @Override void suspend() {
- // Ignore.
- }
-
- @Override boolean canStep() {
- return true;
- }
-
- @Override
- void resume() {
- continueVm(StepAction.CONTINUE, ResumeReason.CLIENT_REQUEST, SuspendReason.UNSPECIFIED);
- }
-
- @Override
- void step(StepAction stepAction, ResumeReason resumeReason) {
- continueVm(stepAction, resumeReason, SuspendReason.STEP_END);
- }
-
- private void continueVm(StepAction stepAction, final ResumeReason resumeReason,
- SuspendReason futureSuspendReason) {
- expectedSuspendReason = futureSuspendReason;
-
- DebugContext.ContinueCallback callback = new DebugContext.ContinueCallback() {
- @Override public void success() {
- remoteEventListener.resumed(resumeReason);
- }
-
- @Override public void failure(String errorMessage) {
- ChromiumDebugPlugin.log(new Exception("Failed to resume: " + errorMessage));
- }
- };
-
- context.continueVm(stepAction, 1, callback);
- }
-
- @Override
- StackFrameBase[] getStackFrames() {
- StackFrameBase[] result = stackFrames.get();
- if (result == null) {
- result = wrapStackFrames(this);
- stackFrames.compareAndSet(null, result);
- result = stackFrames.get();
- }
- return result;
- }
-
- @Override IBreakpoint[] getBreakpoints() {
- return breakpoints;
- }
-
- @Override boolean isStepping() {
- return false;
- }
-
- @Override EvaluateContext getEvaluateContext() {
- return new EvaluateContext(context.getGlobalEvaluateContext(), this);
- }
-
- @Override
- R describeState(StateVisitor visitor) {
- return visitor.visitSuspended(breakpoints, context.getExceptionData());
- }
- }
-
- private final ISuspendResume suspendResumeAspect = new ISuspendResume() {
- @Override public boolean canResume() {
- return !isDisconnected() && isSuspended();
- }
-
- @Override public boolean isSuspended() {
- return !isDisconnected() && currentStepState.isSuspended();
- }
-
- @Override public void resume() throws DebugException {
- currentStepState.resume();
- }
-
- @Override public boolean canSuspend() {
- return !isDisconnected() && currentStepState.canSuspend();
- }
-
- @Override public void suspend() throws DebugException {
- currentStepState.suspend();
- }
-
- private boolean isDisconnected() {
- return getConnectedData().isDisconnected();
- }
- };
-
- /**
- * Wraps Eclipse mixed-up constants in a dedicated enum type.
- */
- public enum ResumeReason {
- STEP_INTO(DebugEvent.STEP_INTO, true),
- STEP_OVER(DebugEvent.STEP_OVER, true),
- STEP_RETURN(DebugEvent.STEP_RETURN, true),
- CLIENT_REQUEST(DebugEvent.CLIENT_REQUEST, false),
- UNSPECIFIED(DebugEvent.UNSPECIFIED, false);
-
- private final int detailCode;
- private final boolean isStepping;
-
- ResumeReason(int detailCode, boolean isStepping) {
- this.detailCode = detailCode;
- this.isStepping = isStepping;
- }
- }
-
- /**
- * Wraps Eclipse mixed-up constants in a dedicated enum type.
- */
- private enum SuspendReason {
- STEP_END(DebugEvent.STEP_END),
- CLIENT_REQUEST(DebugEvent.CLIENT_REQUEST),
- BREAKPOINT(DebugEvent.BREAKPOINT),
- UNSPECIFIED(DebugEvent.UNSPECIFIED);
-
- final int detailCode;
-
- SuspendReason(int detailCode) {
- this.detailCode = detailCode;
- }
- }
-
- private static final StackFrame[] EMPTY_FRAMES = new StackFrame[0];
- private static final IBreakpoint[] EMPTY_BREAKPOINTS = new IBreakpoint[0];
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptVmEmbedder.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptVmEmbedder.java
deleted file mode 100644
index 340953f8..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptVmEmbedder.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.ScriptNameManipulator;
-import org.chromium.sdk.DebugEventListener;
-import org.chromium.sdk.JavascriptVm;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * Abstraction of application embedding JavaScript VM. Technically subtypes
- * of {@code JavascriptVm} describe embedding application themselves.
- * This interface simply holds reference to {@code JavascriptVm} and adapts
- * various subtypes of {@code JavascriptVm} to a uniform interface
- * suitable for {@code DebugTargetImpl}. Notably, it has polymorphous method
- * {@code #attach(Listener, DebugEventListener)}, which {@code JavascriptVm}
- * lacks.
- */
-public interface JavascriptVmEmbedder {
-
- /**
- * First intermediate object that corresponds to already connected server.
- * This does not refer to a particular Javascript VM though:
- * the server may contain several VMs to choose from.
- */
- interface ConnectionToRemote {
- /**
- * This method performs selecting a particular Javascript VM. This is
- * likely to be a user-assisted activity, so this method may block
- * indefinitely.
- * @return null if no VM has been chosen and we should cancel the operation
- */
- VmConnector selectVm() throws CoreException;
-
- void disposeConnection();
- }
-
- /**
- * Intermediate object that works as an intermediate factory
- * for {@code JavascriptVmEmbedder}.
- */
- interface VmConnector {
- JavascriptVmEmbedder attach(Listener embedderListener, DebugEventListener debugEventListener)
- throws CoreException;
- }
-
- /**
- * @return not null
- */
- JavascriptVm getJavascriptVm();
-
- String getTargetName();
-
- String getThreadName();
-
- /**
- * @return script name manipulator that knows the schema of script names in this JavaScript VM
- */
- ScriptNameManipulator getScriptNameManipulator();
-
- /**
- * Listener that should handle embedder-specific events.
- * TODO(peter.rybin): clean-up this interface; maybe decrease number of
- * methods.
- */
- interface Listener {
- /**
- * State of VM has been reset. All scripts might have been changed, name of
- * target and thread might have been changed. E.g. browser tab might have
- * been navigated from one url to another.
- */
- void reset();
-
- void closed();
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptVmEmbedderFactory.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptVmEmbedderFactory.java
deleted file mode 100644
index 1e6f4007..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/JavascriptVmEmbedderFactory.java
+++ /dev/null
@@ -1,452 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import static org.chromium.sdk.util.BasicUtil.join;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.ScriptNameManipulator;
-import org.chromium.debug.core.util.JavaScriptRegExpSupport;
-import org.chromium.sdk.Browser;
-import org.chromium.sdk.Browser.TabConnector;
-import org.chromium.sdk.Browser.TabFetcher;
-import org.chromium.sdk.BrowserFactory;
-import org.chromium.sdk.BrowserTab;
-import org.chromium.sdk.ConnectionLogger;
-import org.chromium.sdk.DebugEventListener;
-import org.chromium.sdk.JavascriptVm;
-import org.chromium.sdk.StandaloneVm;
-import org.chromium.sdk.TabDebugEventListener;
-import org.chromium.sdk.UnsupportedVersionException;
-import org.chromium.sdk.wip.WipBackend;
-import org.chromium.sdk.wip.WipBrowser;
-import org.chromium.sdk.wip.WipBrowser.WipTabConnector;
-import org.chromium.sdk.wip.WipBrowserFactory;
-import org.chromium.sdk.wip.WipBrowserTab;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-
-public class JavascriptVmEmbedderFactory {
- public static JavascriptVmEmbedder.ConnectionToRemote connectToChromeDevTools(String host,
- int port, NamedConnectionLoggerFactory connectionLoggerFactory,
- final TabSelector tabSelector) throws CoreException {
-
- SocketAddress address = new InetSocketAddress(host, port);
- final Browser browser = browserCache.getOrCreateBrowser(address, connectionLoggerFactory);
-
- return connect(browser, tabSelector);
- }
-
- public static JavascriptVmEmbedder.ConnectionToRemote connectToWipBrowser(String host, int port,
- WipBackend backend,
- final NamedConnectionLoggerFactory browserLoggerFactory,
- final NamedConnectionLoggerFactory tabLoggerFactory,
- WipTabSelector tabSelector) throws CoreException {
-
- InetSocketAddress address = new InetSocketAddress(host, port);
- WipBrowserFactory.LoggerFactory factory = new WipBrowserFactory.LoggerFactory() {
- @Override
- public ConnectionLogger newBrowserConnectionLogger() {
- return browserLoggerFactory.createLogger("Connection to browser");
- }
-
- @Override
- public ConnectionLogger newTabConnectionLogger() {
- return browserLoggerFactory.createLogger("Connection to tab");
- }
- };
-
- final WipBrowser browser =
- WipBrowserFactory.INSTANCE.createBrowser(address, factory);
-
- return connectWip(browser, backend, tabSelector);
- }
-
- private static JavascriptVmEmbedder.ConnectionToRemote connect(Browser browser,
- final TabSelector tabSelector) throws CoreException {
-
- final TabFetcher tabFetcher;
- try {
- tabFetcher = browser.createTabFetcher();
- } catch (UnsupportedVersionException e) {
- throw newCoreException(e);
- } catch (IOException e) {
- throw newCoreException(e);
- }
-
- return new JavascriptVmEmbedder.ConnectionToRemote() {
- public JavascriptVmEmbedder.VmConnector selectVm() throws CoreException {
- Browser.TabConnector targetTabConnector;
- try {
- targetTabConnector = tabSelector.selectTab(tabFetcher);
- } catch (IOException e) {
- throw newCoreException("Failed to get tabs for debugging", e);
- }
- if (targetTabConnector == null) {
- return null;
- }
-
- return new EmbeddingTabConnectorImpl(targetTabConnector);
- }
-
- public void disposeConnection() {
- tabFetcher.dismiss();
- }
- };
- }
-
- private static JavascriptVmEmbedder.ConnectionToRemote connectWip(final WipBrowser browser,
- final WipBackend backend, final WipTabSelector tabSelector) throws CoreException {
- return new JavascriptVmEmbedder.ConnectionToRemote() {
- public JavascriptVmEmbedder.VmConnector selectVm() throws CoreException {
- WipTabSelector.BrowserAndBackend browserAndBackend =
- new WipTabSelector.BrowserAndBackend() {
- @Override public WipBrowser getBrowser() {
- return browser;
- }
- @Override public WipBackend getBackend() {
- return backend;
- }
- };
- WipBrowser.WipTabConnector targetTabConnector;
- try {
- targetTabConnector = tabSelector.selectTab(browserAndBackend);
- } catch (IOException e) {
- throw newCoreException("Failed to get tabs for debugging", e);
- }
- if (targetTabConnector == null) {
- return null;
- }
-
- return new WipEmbeddingTabConnector(targetTabConnector, backend.getId());
- }
-
- public void disposeConnection() {
- }
- };
- }
-
- private static abstract class EmbeddingTabConnectorBase
- implements JavascriptVmEmbedder.VmConnector {
- private final TC targetTabConnector;
-
- EmbeddingTabConnectorBase(TC targetTabConnector) {
- this.targetTabConnector = targetTabConnector;
- }
-
- protected TC getTabConnector() {
- return targetTabConnector;
- }
-
- public JavascriptVmEmbedder attach(final JavascriptVmEmbedder.Listener embedderListener,
- final DebugEventListener debugEventListener) throws CoreException {
- TabDebugEventListener tabDebugEventListener = new TabDebugEventListener() {
- public DebugEventListener getDebugEventListener() {
- return debugEventListener;
- }
- public void closed() {
- embedderListener.closed();
- }
- public void navigated(String newUrl) {
- embedderListener.reset();
- }
- };
-
- return attach(tabDebugEventListener);
- }
-
- protected abstract JavascriptVmEmbedder attach(TabDebugEventListener tabDebugEventListener)
- throws CoreException;
-
- protected static abstract class EmbedderBase implements JavascriptVmEmbedder {
- @Override
- public ScriptNameManipulator getScriptNameManipulator() {
- return BROWSER_SCRIPT_NAME_MANIPULATOR;
- }
- }
-
- private static final ScriptNameManipulator BROWSER_SCRIPT_NAME_MANIPULATOR =
- new ScriptNameManipulator() {
- @Override
- public FilePath getFileName(String scriptName) {
- String filePath;
- try {
- URI uri = new URI(scriptName);
- filePath = uri.getPath();
- } catch (URISyntaxException e) {
- filePath = scriptName;
- }
- return new StringBasedFileName(filePath);
- }
-
- @Override
- public ScriptNamePattern createPattern(List components) {
- String pathString = join(components, "/");
- return new ScriptNamePattern(
- JavaScriptRegExpSupport.encodeLiteral(pathString) + "/?($|\\?)");
- }
- };
- }
-
- private static class EmbeddingTabConnectorImpl
- extends EmbeddingTabConnectorBase {
- EmbeddingTabConnectorImpl(TabConnector targetTabConnector) {
- super(targetTabConnector);
- }
-
- @Override
- protected JavascriptVmEmbedder attach(TabDebugEventListener tabDebugEventListener)
- throws CoreException {
- final BrowserTab browserTab;
- try {
- browserTab = getTabConnector().attach(tabDebugEventListener);
- } catch (IOException e) {
- throw newCoreException("Failed to connect to browser tab", e);
- }
- return new EmbedderBase() {
- public JavascriptVm getJavascriptVm() {
- return browserTab;
- }
-
- public String getTargetName() {
- return Messages.DebugTargetImpl_TargetName;
- }
-
-
- public String getThreadName() {
- return browserTab.getUrl();
- }
- };
- }
- }
-
- private static class WipEmbeddingTabConnector
- extends EmbeddingTabConnectorBase {
- private final String backendId;
-
- WipEmbeddingTabConnector(WipTabConnector targetTabConnector, String backendId) {
- super(targetTabConnector);
- this.backendId = backendId;
- }
-
- @Override
- protected JavascriptVmEmbedder attach(TabDebugEventListener tabDebugEventListener)
- throws CoreException {
- final WipBrowserTab browserTab;
- try {
- browserTab = getTabConnector().attach(tabDebugEventListener);
- } catch (IOException e) {
- throw newCoreException("Failed to connect to browser tab: " + e.getMessage(), e);
- }
- return new EmbedderBase() {
- public JavascriptVm getJavascriptVm() {
- return browserTab.getJavascriptVm();
- }
-
- public String getTargetName() {
- return Messages.DebugTargetImpl_TargetName + " # " + backendId;
- }
-
- public String getThreadName() {
- return browserTab.getUrl();
- }
- };
- }
- }
-
- public static JavascriptVmEmbedder.ConnectionToRemote connectToStandalone(String host, int port,
- NamedConnectionLoggerFactory connectionLoggerFactory) {
- SocketAddress address = new InetSocketAddress(host, port);
- ConnectionLogger connectionLogger =
- connectionLoggerFactory.createLogger(address.toString());
- final StandaloneVm standaloneVm = BrowserFactory.getInstance().createStandalone(address,
- connectionLogger);
-
- return new JavascriptVmEmbedder.ConnectionToRemote() {
- public JavascriptVmEmbedder.VmConnector selectVm() {
- return new JavascriptVmEmbedder.VmConnector() {
- public JavascriptVmEmbedder attach(JavascriptVmEmbedder.Listener embedderListener,
- DebugEventListener debugEventListener)
- throws CoreException {
- embedderListener = null;
- //+ @since 0.9 modified exception message string
- String ERROR_STRING = "Nodeclipse/chromedevtools failed to connect to Standalone V8 VM "
- +"( Check Help (F1) and Support http://www.nodeclipse.org/#support )\n. Info:";
- try {
- standaloneVm.attach(debugEventListener);
- } catch (IOException e) {
- throw newCoreException(ERROR_STRING, e);
- } catch (UnsupportedVersionException e) {
- throw newCoreException(ERROR_STRING, e);
- }
- return new JavascriptVmEmbedder() {
- public JavascriptVm getJavascriptVm() {
- return standaloneVm;
- }
- public String getTargetName() {
- String embedderName = standaloneVm.getEmbedderName();
- String vmVersion = standaloneVm.getVmVersion();
- String disconnectReason = standaloneVm.getDisconnectReason();
- String targetTitle;
- if (embedderName == null) {
- targetTitle = ""; //$NON-NLS-1$
- } else {
- targetTitle = MessageFormat.format(
- Messages.JavascriptVmEmbedderFactory_TargetName0, embedderName, vmVersion);
- }
- boolean isAttached = standaloneVm.isAttached();
- if (!isAttached) {
- String disconnectMessage;
- if (disconnectReason == null) {
- disconnectMessage = Messages.JavascriptVmEmbedderFactory_Terminated;
- } else {
- disconnectMessage = MessageFormat.format(
- Messages.JavascriptVmEmbedderFactory_TerminatedWithReason,
- disconnectReason);
- }
- targetTitle = "<" + disconnectMessage + "> " + targetTitle;
- }
- return targetTitle;
- }
- public String getThreadName() {
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public ScriptNameManipulator getScriptNameManipulator() {
- return STANDALONE_SCRIPT_NAME_MANIPULATOR;
- }
- };
- }
- };
- }
-
- public void disposeConnection() {
- // Nothing to do. We do not take connection for ConnectionToRemote.
- }
- };
- }
-
- private static final ScriptNameManipulator STANDALONE_SCRIPT_NAME_MANIPULATOR =
- new ScriptNameManipulator() {
- @Override
- public FilePath getFileName(String scriptName) {
- return new StringBasedFileName(scriptName);
- }
-
- @Override
- public ScriptNamePattern createPattern(List components) {
- String pathString = join(components, "/");
- return new ScriptNamePattern(JavaScriptRegExpSupport.encodeLiteral(pathString) + "/?$");
- }
- };
-
- private static CoreException newCoreException(String message, Throwable cause) {
- return new CoreException(
- new Status(Status.ERROR, ChromiumDebugPlugin.PLUGIN_ID, message, cause));
- }
- private static CoreException newCoreException(Exception e) {
- return new CoreException(
- new Status(Status.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
- "Failed to connect to the remote browser", e));
- }
-
- private static final BrowserCache browserCache = new BrowserCache();
- /**
- * Cache of browser instances.
- */
- private static class BrowserCache {
-
- /**
- * Tries to return already created instance of Browser connected to {@code address}
- * or create new instance.
- * However, it creates a new instance each time that {@code ConnectionLogger} is not null
- * (because you cannot add connection logger to existing connection).
- * @throws CoreException if browser can't be created because of conflict with connectionLogger
- */
- synchronized Browser getOrCreateBrowser(final SocketAddress address,
- final NamedConnectionLoggerFactory connectionLoggerFactory) throws CoreException {
- Browser result = address2Browser.get(address);
- if (result == null) {
-
- ConnectionLogger.Factory wrappedFactory = new ConnectionLogger.Factory() {
- public ConnectionLogger newConnectionLogger() {
- return connectionLoggerFactory.createLogger(address.toString());
- }
- };
- result = createBrowserImpl(address, wrappedFactory);
-
- address2Browser.put(address, result);
- }
- return result;
- }
- private Browser createBrowserImpl(SocketAddress address,
- ConnectionLogger.Factory connectionLoggerFactory) {
- return BrowserFactory.getInstance().create(address, connectionLoggerFactory);
- }
-
- private final Map address2Browser =
- new HashMap();
- }
-
- private static class StringBasedFileName implements ScriptNameManipulator.FilePath {
- private final String fullName;
- private final int lastPos;
-
- public StringBasedFileName(String fullName) {
- this.fullName = fullName;
- this.lastPos = fullName.lastIndexOf('/');
- }
-
- @Override
- public Iterator iterator() {
- return new Iterator() {
- private int currentPos = lastPos;
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String next() {
- int nextPos = fullName.lastIndexOf('/', currentPos - 1);
- String result;
- if (nextPos == -1) {
- result = fullName.substring(0, currentPos);
- } else {
- result = fullName.substring(nextPos + 1, currentPos);
- }
- currentPos = nextPos;
- return result;
- }
-
- @Override
- public boolean hasNext() {
- return currentPos != -1;
- }
- };
- }
-
- @Override
- public String getLastComponent() {
- if (lastPos == -1) {
- return fullName;
- } else {
- return fullName.substring(lastPos + 1);
- }
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LaunchInitializationProcedure.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LaunchInitializationProcedure.java
deleted file mode 100644
index 84ad5bba..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LaunchInitializationProcedure.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.util.ProgressUtil;
-import org.chromium.debug.core.util.ProgressUtil.MonitorWrapper;
-import org.chromium.debug.core.util.ProgressUtil.Stage;
-import org.chromium.sdk.CallbackSemaphore;
-import org.chromium.sdk.RelayOk;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Does several things we need on debug session start. This procedure works asynchronously while
- * user may already start his debug activity.
- */
-class LaunchInitializationProcedure {
- static void startAsync(VProjectWorkspaceBridge workspaceBridge,
- BreakpointSynchronizer.Direction presetDirection) {
- final LaunchInitializationProcedure procedure =
- new LaunchInitializationProcedure(workspaceBridge, presetDirection);
-
- ILaunch launch = workspaceBridge.getConnectedTargetData().getDebugTarget().getLaunch();
- final String jobName = NLS.bind(Messages.LaunchInitializationProcedure_JOB_NAME,
- launch.getLaunchConfiguration().getName());
- Job job = new Job(jobName) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- return procedure.execute(monitor);
- }
- };
- job.schedule();
- }
-
- private final VProjectWorkspaceBridge workspaceBridge;
- private final BreakpointSynchronizer.Direction presetDirection;
-
- private LaunchInitializationProcedure(VProjectWorkspaceBridge workspaceBridge,
- BreakpointSynchronizer.Direction presetDirection) {
- this.workspaceBridge = workspaceBridge;
- this.presetDirection = presetDirection;
- }
-
- /**
- * A list of tasks for progress monitor.
- */
- private interface WorkPlan {
- Stage PREINIT = new Stage(Messages.LaunchInitializationProcedure_UPDATE_DEBUGGER_STATE, 0.1f);
- Stage SET_OPTIONS = new Stage(Messages.LaunchInitializationProcedure_SET_OPTIONS, 1f);
- Stage LOAD_SCRIPTS = new Stage(Messages.LaunchInitializationProcedure_LOAD_SCRIPTS, 1f);
- Stage SYNCHRONIZE_BREAKPOINTS =
- new Stage(Messages.LaunchInitializationProcedure_SYNCHRONIZE_BREAKPOINTS, 1f);
-
- boolean IS_INITIZALIZED = ProgressUtil.layoutProgressPlan(PREINIT, SET_OPTIONS, LOAD_SCRIPTS,
- SYNCHRONIZE_BREAKPOINTS);
- }
-
- private IStatus execute(IProgressMonitor monitor) {
- ConnectedTargetData connectedTargetData = workspaceBridge.getConnectedTargetData();
-
- MonitorWrapper monitorWrapper = new MonitorWrapper(monitor, ""); //$NON-NLS-1$
-
- monitorWrapper.beginTask();
- try {
- WorkPlan.PREINIT.start(monitorWrapper);
- // Nothing here right now.
- WorkPlan.PREINIT.finish(monitorWrapper);
- checkIsCanceled(monitorWrapper);
- WorkPlan.SET_OPTIONS.start(monitorWrapper);
- // Not implemented yet
- WorkPlan.SET_OPTIONS.finish(monitorWrapper);
- checkIsCanceled(monitorWrapper);
- WorkPlan.LOAD_SCRIPTS.start(monitorWrapper);
- workspaceBridge.reloadScriptsAtStart();
- WorkPlan.LOAD_SCRIPTS.finish(monitorWrapper);
- checkIsCanceled(monitorWrapper);
- synchronizeBreakpoints(
- WorkPlan.SYNCHRONIZE_BREAKPOINTS.createSubMonitorWrapper(monitorWrapper));
-
- } finally {
- monitorWrapper.done();
- }
- return Status.OK_STATUS;
- }
-
- /**
- * A list of tasks for breakpoint synchronization subprocess.
- */
- private interface BreakpointsWorkPlan {
- Stage ANALYZE = new Stage(null, 1f);
- Stage REMOTE_CHANGES = new Stage(null, 1f);
-
- boolean IS_LAYOUTED = ProgressUtil.layoutProgressPlan(ANALYZE, REMOTE_CHANGES);
- }
-
- private void synchronizeBreakpoints(MonitorWrapper monitor) {
- monitor.beginTask();
- try {
- BreakpointsWorkPlan.ANALYZE.start(monitor);
-
- DebugTargetImpl debugTarget = workspaceBridge.getConnectedTargetData().getDebugTarget();
- ILaunchConfiguration launchConfiguration = debugTarget.getLaunch().getLaunchConfiguration();
-
- BreakpointSynchronizer.Direction direction;
- if (presetDirection == null) {
- try {
- direction = LaunchParams.readBreakpointSyncDirection(launchConfiguration);
- } catch (CoreException e) {
- ChromiumDebugPlugin.log(
- new Exception("Failed to read breakpoint synchronization direction " + //$NON-NLS-1$
- "from launch configuration " + launchConfiguration.getName(), e)); //$NON-NLS-1$
- direction = null;
- }
- } else {
- direction = presetDirection;
- }
-
- if (direction == null) {
- return;
- }
- final CallbackSemaphore callbackSemaphore = new CallbackSemaphore();
- BreakpointSynchronizer.Callback callback = new BreakpointSynchronizer.Callback() {
- public void onDone(IStatus status) {
- callbackSemaphore.callbackDone(null);
- }
- };
- workspaceBridge.getBreakpointSynchronizer().syncBreakpoints(direction, callback);
- RelayOk relayOk = SYNCHRONIZER_MUST_RELAY_OK;
- checkIsCanceled(monitor);
-
- BreakpointsWorkPlan.ANALYZE.finish(monitor);
-
- BreakpointsWorkPlan.REMOTE_CHANGES.start(monitor);
- callbackSemaphore.tryAcquireDefault(relayOk);
- BreakpointsWorkPlan.REMOTE_CHANGES.finish(monitor);
-
- } finally {
- monitor.done();
- }
- }
-
- private static void checkIsCanceled(MonitorWrapper monitor) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
-
- private static final RelayOk SYNCHRONIZER_MUST_RELAY_OK = new RelayOk() {};
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LaunchParams.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LaunchParams.java
deleted file mode 100644
index 02742f42..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LaunchParams.java
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.chromium.debug.core.ChromiumDebugPlugin;
-import org.chromium.debug.core.model.BreakpointSynchronizer.Direction;
-import org.chromium.debug.core.util.MementoFormat;
-import org.chromium.debug.core.util.MementoFormat.ParserException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunchConfiguration;
-
-public class LaunchParams {
-
- /** Launch configuration attribute (debug host). */
- public static final String CHROMIUM_DEBUG_HOST = "debug_host"; //$NON-NLS-1$
-
- /** Launch configuration attribute (debug port). */
- public static final String CHROMIUM_DEBUG_PORT = "debug_port"; //$NON-NLS-1$
-
- public static final String ADD_NETWORK_CONSOLE = "add_network_console"; //$NON-NLS-1$
-
- public static final String BREAKPOINT_SYNC_DIRECTION =
- "breakpoint_startup_sync_direction"; //$NON-NLS-1$
-
- public static final String SOURCE_LOOKUP_MODE = "source_lookup_mode"; //$NON-NLS-1$
-
- public static final String WIP_BACKEND_ID = "wip_backend_id"; //$NON-NLS-1$
-
- // PREDEFINED_SOURCE_WRAPPER_IDS see below.
-
- public enum LookupMode {
- EXACT_MATCH() {
- @Override public R accept(Visitor visitor) {
- return visitor.visitExactMatch();
- }
- },
- AUTO_DETECT() {
- @Override public R accept(Visitor visitor) {
- return visitor.visitAutoDetect();
- }
- };
-
- public abstract R accept(Visitor visitor);
-
- public interface Visitor {
- R visitExactMatch();
- R visitAutoDetect();
- }
-
- public static final LookupMode DEFAULT_VALUE = EXACT_MATCH;
-
- public static final ValueConverter STRING_CONVERTER =
- new ValueConverter() {
- @Override
- public
- String encode(LookupMode logical) {
- return logical.toString();
- }
-
- @Override
- public
- LookupMode decode(String persistent) throws CoreException {
- try {
- return LookupMode.valueOf(persistent);
- } catch (IllegalArgumentException e) {
- Status status = new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
- "Failed to parse lookup mode value", e);
- throw new CoreException(status);
- }
- }
- };
- }
-
- public static abstract class ValueConverter {
- public abstract P encode(L logical);
- public abstract L decode(P persistent) throws CoreException;
-
- @SuppressWarnings("unchecked")
- public
- static ValueConverter getTrivial() {
- return (Trivial) Trivial.INSTANCE;
- }
-
- private static class Trivial extends ValueConverter {
- @Override public T encode(T logical) {
- return logical;
- }
-
- @Override public T decode(T persistent) {
- return persistent;
- }
- private static final Trivial> INSTANCE = new Trivial();
- }
- }
-
-
- public static class BreakpointOption {
- private final String label;
- private final Direction direction;
-
- BreakpointOption(String label, Direction direction) {
- this.label = label;
- this.direction = direction;
- }
-
- public Direction getDirection() {
- return direction;
- }
-
- public String getDirectionStringValue() {
- if (direction == null) {
- return "";
- } else {
- return direction.toString();
- }
- }
-
- public String getLabel() {
- return label;
- }
- }
-
- public static Direction readBreakpointSyncDirection(ILaunchConfiguration launchConfiguration)
- throws CoreException {
- String breakpointOptionString =
- launchConfiguration.getAttribute(BREAKPOINT_SYNC_DIRECTION, (String)null);
- int optionIndex = findBreakpointOption(breakpointOptionString);
- return BREAKPOINT_OPTIONS.get(optionIndex).getDirection();
- }
-
- public final static List extends BreakpointOption> BREAKPOINT_OPTIONS = Arrays.asList(
- new BreakpointOption(Messages.LaunchParams_MERGE_OPTION, Direction.MERGE),
- new BreakpointOption(Messages.LaunchParams_RESET_REMOTE_OPTION,
- Direction.RESET_REMOTE),
- new BreakpointOption(Messages.LaunchParams_NONE_OPTION, null));
-
- public static int findBreakpointOption(String optionText) {
- int res;
- res = findBreakpointOptionRaw(optionText);
- if (res != -1) {
- return res;
- }
- res = findBreakpointOptionRaw(null);
- if (res != -1) {
- return res;
- }
- throw new RuntimeException("Failed to find breakpoint option"); //$NON-NLS-1$
- }
-
- private static int findBreakpointOptionRaw(String optionText) {
- Direction direction;
- if (optionText == null || optionText.length() == 0) {
- direction = null;
- } else {
- try {
- direction = Direction.valueOf(optionText);
- } catch (IllegalArgumentException e) {
- ChromiumDebugPlugin.log(
- new Exception("Failed to parse breakpoint synchronization option", e)); //$NON-NLS-1$
- return -1;
- }
- }
- for (int i = 0; i < BREAKPOINT_OPTIONS.size(); i++) {
- if (BREAKPOINT_OPTIONS.get(i).getDirection() == direction) {
- return i;
- }
- }
- return -1;
- }
-
- public static class PredefinedSourceWrapperIds {
- public static String CONFIG_PROPERTY = "predefined_source_wrapperd_ids"; //$NON-NLS-1$
-
- public static final ValueConverter> CONVERTER =
- new ValueConverter>() {
- @Override
- public String encode(List logical) {
- StringBuilder builder = new StringBuilder();
- List list = new ArrayList(logical);
- Collections.sort(list);
- for (String id : list) {
- MementoFormat.encodeComponent(id, builder);
- }
- return builder.toString();
- }
-
- @Override
- public List decode(String persistent) throws CoreException {
- List result = new ArrayList();
- MementoFormat.Parser parser = new MementoFormat.Parser(persistent);
- while (parser.hasMore()) {
- try {
- result.add(parser.nextComponent());
- } catch (ParserException e) {
- throw new RuntimeException("Failed to read config value '" + persistent + "'", e);
- }
- }
- return result;
- }
- };
-
- public static List resolveEntries(
- ILaunchConfiguration config) throws CoreException {
- String attributeValue = config.getAttribute(
- LaunchParams.PredefinedSourceWrapperIds.CONFIG_PROPERTY, "");
- List predefinedWrapperIds =
- LaunchParams.PredefinedSourceWrapperIds.CONVERTER.decode(attributeValue);
- Map entries =
- IPredefinedSourceWrapProvider.Access.getEntries();
- List result =
- new ArrayList(predefinedWrapperIds.size());
- for (String id : predefinedWrapperIds) {
- IPredefinedSourceWrapProvider.Entry entry = entries.get(id);
- if (entry == null) {
- throw new CoreException(new Status(IStatus.ERROR, ChromiumDebugPlugin.PLUGIN_ID,
- "Failed to find source wrapper by id '" + id + "'"));
- }
- result.add(entry);
- }
- return result;
- }
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LineBreakpointAdapter.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LineBreakpointAdapter.java
deleted file mode 100755
index b517aab5..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/LineBreakpointAdapter.java
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.chromium.debug.core.util.ChromiumDebugPluginUtil;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.ILineBreakpoint;
-import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-
-/**
- * Adapter to create breakpoints in JS files.
- */
-public abstract class LineBreakpointAdapter implements IToggleBreakpointsTarget {
-
- public static class ForVirtualProject extends LineBreakpointAdapter {
- @Override
- protected ITextEditor getEditor(IWorkbenchPart part) {
- return getEditorStatic(part);
- }
-
- public static ITextEditor getEditorStatic(IWorkbenchPart part) {
- if (part instanceof ITextEditor) {
- ITextEditor editorPart = (ITextEditor) part;
- IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
- if (resource != null &&
- ChromiumDebugPluginUtil.SUPPORTED_EXTENSIONS.contains(resource.getFileExtension())) {
- return editorPart;
- }
- }
- return null;
- }
-
- @Override
- protected String getDebugModelId() {
- return VProjectWorkspaceBridge.DEBUG_MODEL_ID;
- }
- }
-
- public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection)
- throws CoreException {
- ITextEditor textEditor = getEditor(part);
- if (textEditor != null) {
- IResource resource = (IResource) textEditor.getEditorInput().getAdapter(IResource.class);
- ITextSelection textSelection = (ITextSelection) selection;
- int lineNumber = textSelection.getStartLine();
- IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(
- getDebugModelId());
- for (int i = 0; i < breakpoints.length; i++) {
- IBreakpoint breakpoint = breakpoints[i];
- if (resource.equals(breakpoint.getMarker().getResource())) {
- if (((ILineBreakpoint) breakpoint).getLineNumber() == lineNumber + 1) {
- // remove
- breakpoint.delete();
- return;
- }
- }
- }
-
- // Line numbers start with 0 in V8, with 1 in Eclipse.
- ChromiumLineBreakpoint lineBreakpoint = new ChromiumLineBreakpoint(resource, lineNumber + 1,
- getDebugModelId());
- DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
- }
- }
-
- public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
- return getEditor(part) != null;
- }
-
- /**
- * Returns the editor being used to edit a PDA file, associated with the given
- * part, or null
if none.
- * @param part workbench part
- * @return the editor being used to edit a PDA file, associated with the given
- * part, or null
if none
- */
- protected abstract ITextEditor getEditor(IWorkbenchPart part);
-
- protected abstract String getDebugModelId();
-
- public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection)
- throws CoreException {
- // TODO(apavlov): Implement method breakpoints if feasible.
- }
-
- public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
- // TODO(apavlov): Implement method breakpoints if feasible.
- return true;
- }
-
- public void toggleWatchpoints(IWorkbenchPart part, ISelection selection)
- throws CoreException {
- // TODO(apavlov): Implement watchpoints if feasible.
- }
-
- public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
- // TODO(apavlov): Implement watchpoints if feasible.
- return false;
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/Messages.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/Messages.java
deleted file mode 100755
index 0dd83e3a..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/Messages.java
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * NLS messages for the package.
- */
-public class Messages extends NLS {
- private static final String BUNDLE_NAME =
- "org.chromium.debug.core.model.messages"; //$NON-NLS-1$
-
- public static String ChromiumExceptionBreakpoint_MessageMarkerFormat;
-
- public static String ChromiumTabSelectionDialog_DialogTitle;
-
- public static String ChromiumTabSelectionDialog_IdColumnName;
-
- public static String ChromiumTabSelectionDialog_TableTitle;
-
- public static String ChromiumTabSelectionDialog_UrlColumnName;
-
- public static String ConnectionLoggerImpl_MessageSeparator;
-
- public static String ConnectionLoggerImpl_ReceivedFromChrome;
-
- public static String ConnectionLoggerImpl_SentToChrome;
-
- public static String DebugTargetImpl_BadResultWhileDisconnecting;
-
- public static String DebugTargetImpl_BUSY_WITH;
-
- public static String DebugTargetImpl_CannotStartMultipleDebuggers;
-
- public static String DebugTargetImpl_Caught;
-
- public static String DebugTargetImpl_FailedToStartSocketConnection;
-
- public static String DebugTargetImpl_LogExceptionFormat;
-
- public static String DebugTargetImpl_TARGET_NAME_PATTERN;
-
- public static String DebugTargetImpl_TargetName;
-
- public static String DebugTargetImpl_Uncaught;
-
- public static String DebugTargetImpl_Unknown;
-
- public static String HardcodedSourceWrapProvider_DESCRIPTION;
-
- public static String HardcodedSourceWrapProvider_WITH_DEFINED;
-
- public static String HardcodedSourceWrapProvider_STANDARD;
-
- public static String HardcodedSourceWrapProvider_STANDARD_2;
-
- public static String HardcodedSourceWrapProvider_WITH_DEFINED_2;
-
- public static String JavascriptVmEmbedderFactory_TargetName0;
-
- public static String JavascriptVmEmbedderFactory_Terminated;
-
- public static String JavascriptVmEmbedderFactory_TerminatedWithReason;
-
- public static String JsLineBreakpoint_MessageMarkerFormat;
-
- public static String JsThread_ThreadLabelFormat;
-
- public static String JsThread_ThreadLabelRunning;
-
- public static String JsThread_ThreadLabelSuspended;
-
- public static String JsThread_ThreadLabelSuspendedExceptionFormat;
-
- public static String LaunchInitializationProcedure_JOB_NAME;
-
- public static String LaunchInitializationProcedure_LOAD_SCRIPTS;
-
- public static String LaunchInitializationProcedure_SET_OPTIONS;
-
- public static String LaunchInitializationProcedure_SYNCHRONIZE_BREAKPOINTS;
-
- public static String LaunchInitializationProcedure_UPDATE_DEBUGGER_STATE;
-
- public static String LaunchParams_MERGE_OPTION;
-
- public static String LaunchParams_NONE_OPTION;
-
- public static String LaunchParams_RESET_REMOTE_OPTION;
-
- public static String MockUpResourceWriter_NOT_A_JAVASCRIPT;
-
- public static String MockUpResourceWriter_SCRIPT_WITHOUT_TEXT;
-
- public static String MockUpResourceWriter_SCRIPTS_OVERLAPPED;
-
- public static String ResourceManager_UnnamedScriptName;
-
- public static String StackFrame_NameFormat;
-
- public static String StackFrame_UnknownScriptName;
-
- public static String TargetInitializeState_INITIALIZING;
-
- public static String TargetInitializeState_TERMINATED;
-
- public static String Variable_CANNOT_BUILD_EXPRESSION;
-
- public static String Variable_NotScalarOrObjectFormat;
-
- public static String Variable_NullTypeForAVariable;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/MockUpResourceWriter.java b/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/MockUpResourceWriter.java
deleted file mode 100644
index dc2e9c4c..00000000
--- a/chromedevtools/plugins/org.chromium.debug.core/src/org/chromium/debug/core/model/MockUpResourceWriter.java
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.debug.core.model;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-
-import org.chromium.sdk.Script;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Creates from a set of scripts a mock-up of full resource (scripts are positioned according
- * to their line numbers and the whitespace is filled with text pattern).
- */
-class MockUpResourceWriter {
- static String writeScriptSource(Collection
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Constant Field Values
-
-
-Contents
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-