# HG changeset patch
# User TasneemS@US-TASNEEMS
# Date 1261617198 28800
# Node ID e4420d2515f19d6bc150c2b02aa0614fb9176f7d
# Parent ef76fc2ac88c5ccae8c16dc3776db48d2b3aedfa
Initial version of WRT Debugger.
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/.classpath
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/.classpath Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/.options
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/.options Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,3 @@
+org.chromium.debug.core/debug=true
+org.chromium.debug.core/debug/transport=true
+org.chromium.debug.core/debug/v8DebuggerTool=true
\ No newline at end of file
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/.project
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/.project Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,28 @@
+
+
+ org.chromium.debug.core
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/LICENSE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/LICENSE Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,27 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/META-INF/MANIFEST.MF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/META-INF/MANIFEST.MF Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.chromium.debug.core;singleton:=true
+Bundle-Version: 0.1.3.qualifier
+Bundle-Activator: org.chromium.debug.core.ChromiumDebugPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.filesystem;bundle-version="1.2.0",
+ org.eclipse.debug.ui;bundle-version="3.4.1",
+ org.eclipse.ui;bundle-version="3.4.1",
+ org.eclipse.jface.text;bundle-version="3.4.1",
+ org.eclipse.ui.workbench.texteditor;bundle-version="3.4.1",
+ org.chromium.sdk;bundle-version="0.1.3"
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: bin/,
+ .
+Export-Package: org.chromium.debug.core,
+ org.chromium.debug.core.model,
+ org.chromium.debug.core.util
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/ChromiumDebugPlugin.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/ChromiumDebugPlugin.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/Messages.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/Messages.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptFileStore.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptFileStore.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptFileSystem.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptFileSystem.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$CommonNode.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$CommonNode.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$FileNode$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$FileNode$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$FileNode.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$FileNode.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$FolderNode.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$FolderNode.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$RootNode.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage$RootNode.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/efs/ChromiumScriptStorage.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/messages.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/bin/org/chromium/debug/core/messages.properties Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,5 @@
+# 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
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ArrayValue.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ArrayValue.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointAdapterFactory.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointAdapterFactory.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry$BreakpointEntry.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry$BreakpointEntry.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry$BreakpointLocation.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry$BreakpointLocation.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry$ScriptIdentifier.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry$ScriptIdentifier.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/BreakpointRegistry.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumLineBreakpoint$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumLineBreakpoint$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumLineBreakpoint.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ChromiumLineBreakpoint.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$2.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$2.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$3.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$3.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$LogLifecycleListener.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl$LogLifecycleListener.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConnectionLoggerImpl.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess$NullStreamMonitor.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess$NullStreamMonitor.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess$Retransmitter.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess$Retransmitter.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ConsolePseudoProcess.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugElementImpl.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugElementImpl.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$2.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$2.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$3.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$3.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$4.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$4.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$5.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$5.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$6$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$6$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$6.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$6.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$7$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$7$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$7.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$7.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$8.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$8.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$DebugEventListenerImpl.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl$DebugEventListenerImpl.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DebugTargetImpl.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/Destructable.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/Destructable.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/DestructingGuard.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/DestructingGuard.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/IChromiumDebugTarget.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/IChromiumDebugTarget.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/IResourceManager.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/IResourceManager.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptThread.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptThread.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder$ConnectionToRemote.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder$ConnectionToRemote.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder$Listener.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder$Listener.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder$VmConnector.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder$VmConnector.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedder.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$2$1$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$2$1$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$2$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$2$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$2.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$2.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$BrowserCache$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$BrowserCache$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$BrowserCache.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$BrowserCache.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$EmbeddingTabConnector$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$EmbeddingTabConnector$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$EmbeddingTabConnector$2.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$EmbeddingTabConnector$2.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$EmbeddingTabConnector.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory$EmbeddingTabConnector.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/JavascriptVmEmbedderFactory.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/LineBreakpointAdapter.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/LineBreakpointAdapter.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/Messages.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/Messages.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/NamedConnectionLoggerFactory.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/NamedConnectionLoggerFactory.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/ResourceManager.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/ResourceManager.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/StackFrame$1ScopeObjectVariable.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/StackFrame$1ScopeObjectVariable.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/StackFrame.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/StackFrame.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/TabSelector.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/TabSelector.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/Value.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/Value.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/Variable$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/Variable$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/Variable.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/model/Variable.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/model/messages.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/bin/org/chromium/debug/core/model/messages.properties Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,29 @@
+# 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.
+
+ChromiumTabSelectionDialog_DialogTitle=Select Tab to Debug
+ChromiumTabSelectionDialog_IdColumnName=ID
+ChromiumTabSelectionDialog_TableTitle=Available Tabs
+ChromiumTabSelectionDialog_UrlColumnName=Tab URL
+ConnectionLoggerImpl_ReceivedFromChrome=Received from Chrome:
+ConnectionLoggerImpl_SentToChrome=Sent to Chrome:
+DebugTargetImpl_BadResultWhileDisconnecting=Received bad result from browser while disconnecting
+DebugTargetImpl_CannotStartMultipleDebuggers=Cannot start more than one instance of debugger
+DebugTargetImpl_Caught=Caught
+DebugTargetImpl_FailedToStartSocketConnection=Failed to start socket transport
+DebugTargetImpl_LogExceptionFormat={0} {1} (in {2}:{3}): {4}
+DebugTargetImpl_TargetName=Chromium
+DebugTargetImpl_Uncaught=Uncaught
+JavascriptVmEmbedderFactory_TargetName0=Remote "{0}" embedding V8 {1}
+JavascriptVmEmbedderFactory_Terminated=terminated
+JavascriptVmEmbedderFactory_TerminatedWithReason=terminated: {0}
+JsLineBreakpoint_MessageMarkerFormat=Line Breakpoint: {0} [line: {1}]
+JsThread_ThreadLabelFormat=JavaScript Thread ({0}){1}
+JsThread_ThreadLabelRunning=Running
+JsThread_ThreadLabelSuspended=Suspended
+ResourceManager_UnnamedScriptName=(program)
+StackFrame_NameFormat={0} [{1}:{2}]
+StackFrame_UnknownScriptName=
+Variable_NotScalarOrObjectFormat=Not scalar or object: {0}
+Variable_NullTypeForAVariable=null type for a variable
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/util/ChromiumDebugPluginUtil$1.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/util/ChromiumDebugPluginUtil$1.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/util/ChromiumDebugPluginUtil$2.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/util/ChromiumDebugPluginUtil$2.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/util/ChromiumDebugPluginUtil.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/util/ChromiumDebugPluginUtil.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/util/JsValueStringifier$Config.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/util/JsValueStringifier$Config.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/bin/org/chromium/debug/core/util/JsValueStringifier.class
Binary file org.chromium.debug.core/bin/org/chromium/debug/core/util/JsValueStringifier.class has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/build.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/build.properties Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,8 @@
+bin.includes = META-INF/,\
+ plugin.xml,\
+ .,\
+ LICENSE,\
+ plugin.properties
+source.. = src/
+output.. = bin/
+src.includes = LICENSE
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/plugin.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/plugin.properties Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,7 @@
+# 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.
+
+providerName = The Chromium Authors
+
+pluginName = Chromium JavaScript Remote Debugger Core
\ No newline at end of file
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/plugin.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/plugin.xml Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/ChromiumDebugPlugin.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/ChromiumDebugPlugin.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,112 @@
+// 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;
+
+import java.text.MessageFormat;
+
+import org.chromium.debug.core.model.ChromiumBreakpointWBAFactory;
+import org.chromium.debug.core.model.ChromiumLineBreakpoint;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class that controls the plug-in life cycle.
+ */
+public class ChromiumDebugPlugin extends Plugin {
+
+ /** The plug-in ID. */
+ public static final String PLUGIN_ID = "org.chromium.debug.core"; //$NON-NLS-1$
+
+ /** The debug model ID. */
+ public static final String DEBUG_MODEL_ID = "org.chromium.debug"; //$NON-NLS-1$
+
+ /** The JavaScript line breakpoint marker. */
+ public static final String BP_MARKER = PLUGIN_ID + ".LineBP"; //$NON-NLS-1$
+
+ /** The shared instance. */
+ private static ChromiumDebugPlugin plugin;
+
+ private ChromiumBreakpointWBAFactory breakpointWorkbenchAdapterFactory;
+
+ public ChromiumDebugPlugin() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ IAdapterManager manager = Platform.getAdapterManager();
+ breakpointWorkbenchAdapterFactory = new ChromiumBreakpointWBAFactory();
+ manager.registerAdapters(breakpointWorkbenchAdapterFactory, ChromiumLineBreakpoint.class);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ IAdapterManager manager = Platform.getAdapterManager();
+ manager.unregisterAdapters(breakpointWorkbenchAdapterFactory);
+ super.stop(context);
+ }
+
+ /**
+ * @return the shared instance
+ */
+ public static ChromiumDebugPlugin getDefault() {
+ return plugin;
+ }
+
+ public static boolean isDebug() {
+ ChromiumDebugPlugin thePlugin = getDefault();
+ return thePlugin != null && thePlugin.isDebugging();
+ }
+
+ public static boolean isTransportDebug() {
+ return isDebug() &&
+ Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug/transport")); //$NON-NLS-1$
+ }
+
+ public static boolean isV8DebuggerToolDebug() {
+ return isDebug() &&
+ Boolean.valueOf(Platform.getDebugOption(PLUGIN_ID + "/debug/v8DebuggerTool")); //$NON-NLS-1$
+ }
+
+ public static void log(IStatus status) {
+ ChromiumDebugPlugin plugin = getDefault();
+ if (plugin != null) {
+ plugin.getLog().log(status);
+ } else {
+ System.err.println(status.getPlugin() + ": " + status.getMessage()); //$NON-NLS-1$
+ }
+ }
+
+ public static void log(Throwable e) {
+ if (e instanceof CoreException) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID,
+ ((CoreException) e).getStatus().getSeverity(), e.getMessage(), e.getCause()));
+ } else {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, Messages.ChromiumDebugPlugin_InternalError, e));
+ }
+ }
+
+ public static void logError(String message, Object... arguments) {
+ log(new Status(Status.ERROR, PLUGIN_ID, getPossiblyFormattedString(message, arguments)));
+ }
+
+ public static void logWarning(String message, Object... arguments) {
+ log(new Status(Status.WARNING, PLUGIN_ID, getPossiblyFormattedString(message, arguments)));
+ }
+
+ private static String getPossiblyFormattedString(String message, Object... arguments) {
+ return arguments.length > 0
+ ? MessageFormat.format(message, arguments)
+ : message;
+ }
+
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/Messages.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/Messages.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,25 @@
+// 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;
+
+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.messages"; //$NON-NLS-1$
+
+ public static String ChromiumDebugPlugin_InternalError;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileStore.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileStore.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,106 @@
+// 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 -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileSystem.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptFileSystem.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,69 @@
+// 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));
+ }
+
+ /**
+ * 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;
+ }
+ }
+
+ /**
+ * 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 -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptStorage.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/efs/ChromiumScriptStorage.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,328 @@
+// 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 -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/messages.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/messages.properties Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,5 @@
+# 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
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/ArrayValue.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/ArrayValue.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,67 @@
+// 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 java.util.SortedMap;
+
+import org.chromium.sdk.JsArray;
+import org.chromium.sdk.JsVariable;
+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 IVariable[] elements;
+
+ public ArrayValue(IChromiumDebugTarget debugTarget, JsArray array) {
+ super(debugTarget, array);
+ this.elements = createElements();
+ }
+
+ private IVariable[] createElements() {
+ SortedMap elements = ((JsArray) getJsValue()).toSparseArray();
+ List variables = new ArrayList(elements.size());
+ for (JsVariable jsVar : elements.values()) {
+ variables.add(new Variable(getDebugTarget(), jsVar, false));
+ }
+ return variables.toArray(new IVariable[variables.size()]);
+ }
+
+ public int getInitialOffset() {
+ return 0;
+ }
+
+ public int getSize() throws DebugException {
+ return elements.length;
+ }
+
+ public IVariable getVariable(int offset) throws DebugException {
+ return elements[offset];
+ }
+
+ public IVariable[] getVariables(int offset, int length) throws DebugException {
+ IVariable[] result = new IVariable[length];
+ System.arraycopy(elements, offset, result, 0, length);
+ return result;
+ }
+
+ @Override
+ public IVariable[] getVariables() throws DebugException {
+ return elements;
+ }
+
+ @Override
+ public boolean hasVariables() throws DebugException {
+ return elements.length > 0;
+ }
+
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointAdapterFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointAdapterFactory.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,38 @@
+// 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.CHROMIUM_EXTENSION.equals(extension)) {
+ return new LineBreakpointAdapter();
+ }
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class[] getAdapterList() {
+ return new Class[] { IToggleBreakpointsTarget.class };
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointRegistry.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/BreakpointRegistry.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,227 @@
+// 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.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.chromium.sdk.Breakpoint;
+import org.chromium.sdk.Script;
+
+/**
+ * A registry of existing breakpoints associated with their script locations. It
+ * is used to restore
+ */
+public class BreakpointRegistry {
+
+ /**
+ * Script identifier for a breakpoint location.
+ */
+ public static class ScriptIdentifier {
+ private final String name;
+
+ private final long id;
+
+ private final int startLine;
+
+ private final int endLine;
+
+ public static ScriptIdentifier forScript(Script script) {
+ String name = script.getName();
+ return new ScriptIdentifier(
+ name,
+ name != null ? -1 : script.getId(),
+ script.getStartLine(),
+ script.getEndLine());
+ }
+
+ private ScriptIdentifier(String name, long id, int startLine, int endLine) {
+ this.name = name;
+ this.id = id;
+ this.startLine = startLine;
+ this.endLine = endLine;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (int) (id ^ (id >>> 32));
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + 17 * startLine + 19 * endLine;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof ScriptIdentifier)) {
+ return false;
+ }
+ ScriptIdentifier that = (ScriptIdentifier) obj;
+ if (this.startLine != that.startLine || this.endLine != that.endLine) {
+ return false;
+ }
+ if (name == null) {
+ // an unnamed script, only id is known
+ return that.name == null && this.id == that.id;
+ }
+ // a named script
+ return this.name.equals(that.name);
+ }
+ }
+
+ static class BreakpointLocation {
+ private final ScriptIdentifier scriptIdentifier;
+
+ private final int line;
+
+ public BreakpointLocation(ScriptIdentifier scriptIdentifier, int line) {
+ this.scriptIdentifier = scriptIdentifier;
+ this.line = line;
+ }
+
+ public ScriptIdentifier getScriptIdentifier() {
+ return scriptIdentifier;
+ }
+
+ public int getLine() {
+ return line;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + line;
+ result = prime * result + ((scriptIdentifier == null)
+ ? 0
+ : scriptIdentifier.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof BreakpointLocation)) {
+ return false;
+ }
+ BreakpointLocation that = (BreakpointLocation) obj;
+ return (this.line == that.line && eq(this.scriptIdentifier, that.scriptIdentifier));
+ }
+ }
+
+ /**
+ * A breakpoint accompanied by its line number in the corresponding enclosing
+ * resource.
+ */
+ public static class BreakpointEntry {
+ public final Breakpoint breakpoint;
+
+ public final int line;
+
+ private BreakpointEntry(Breakpoint breakpoint, int line) {
+ this.breakpoint = breakpoint;
+ this.line = line;
+ }
+
+ boolean isWithinScriptRange(Script script) {
+ return line >= script.getStartLine() && line <= script.getEndLine();
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 * line + 17 * breakpoint.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof BreakpointEntry)) {
+ return false;
+ }
+ BreakpointEntry that = (BreakpointEntry) obj;
+ return this.line == that.line && this.breakpoint.equals(that.breakpoint);
+ }
+ }
+
+ private final Map> scriptIdToBreakpointEntries =
+ new HashMap>();
+
+ /**
+ * Adds the given line breakpoint.
+ *
+ * @param script where the breakpoint is set
+ * @param line (0-based, like in V8) in the script
+ * @param breakpoint
+ */
+ public void add(Script script, int line, Breakpoint breakpoint) {
+ ScriptIdentifier scriptId = ScriptIdentifier.forScript(script);
+ Collection entries = scriptIdToBreakpointEntries.get(scriptId);
+ if (entries == null) {
+ entries = new HashSet();
+ scriptIdToBreakpointEntries.put(scriptId, entries);
+ }
+ entries.add(new BreakpointEntry(breakpoint, line));
+ }
+
+ /**
+ * Gets breakpoint entries for the given script. An empty collection for a
+ * {@code null} script.
+ *
+ * @param script to extract the breakpoints for
+ * @return the breakpoints that fall within the given script line range
+ */
+ public Collection extends BreakpointEntry> getBreakpointEntries(Script script) {
+ if (script == null) {
+ return Collections.emptySet();
+ }
+ Collection entries =
+ scriptIdToBreakpointEntries.get(ScriptIdentifier.forScript(script));
+ if (entries == null) {
+ return Collections.emptySet();
+ }
+ Collection scriptBreakpoints = new LinkedList();
+ // Linear search should work fairly well for a reasonable number of
+ // breakpoints per script
+ for (BreakpointEntry entry : entries) {
+ if (entry.isWithinScriptRange(script)) {
+ scriptBreakpoints.add(entry);
+ }
+ }
+ return scriptBreakpoints;
+ }
+
+ /**
+ * Removes the given line breakpoint in the given script. Does nothing for a
+ * {@code null} script (which may be the case after a navigation + disconnect
+ * when the resource referenced by the breakpoint marker is absent.)
+ *
+ * @param script where the breakpoint is set
+ * @param line (0-based, like in V8) in the script
+ * @param breakpoint
+ */
+ public void remove(Script script, int line, Breakpoint breakpoint) {
+ if (script == null) {
+ return;
+ }
+ ScriptIdentifier scriptId = ScriptIdentifier.forScript(script);
+ Collection entries = scriptIdToBreakpointEntries.get(scriptId);
+ if (entries == null) {
+ return;
+ }
+ if (entries.size() == 1) {
+ scriptIdToBreakpointEntries.remove(scriptId);
+ } else {
+ entries.remove(new BreakpointEntry(breakpoint, line));
+ }
+ }
+
+ protected static boolean eq(Object left, Object right) {
+ return left == right || (left != null && left.equals(right));
+ }
+
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumBreakpointWBAFactory.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,58 @@
+// 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 -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumLineBreakpoint.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/ChromiumLineBreakpoint.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,124 @@
+// 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.chromium.sdk.Breakpoint;
+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.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$
+
+ private Breakpoint browserBreakpoint;
+
+ /**
+ * 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.
+ */
+ // FIXME(apavlov): now this does not restore the browserBreakpoint value
+ public ChromiumLineBreakpoint() {
+ }
+
+ public void setBreakpoint(Breakpoint breakpoint) {
+ this.browserBreakpoint = breakpoint;
+ }
+
+ public Breakpoint getBrowserBreakpoint() {
+ return browserBreakpoint;
+ }
+
+ /**
+ * 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)
+ 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, getModelIdentifier());
+ 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;
+ }
+ }
+
+ public void setIgnoreCount(int ignoreCount) {
+ setMarkerAttribute(IGNORE_COUNT_ATTR, ignoreCount);
+ }
+
+ private void setMarkerAttribute(String attributeName, Object value) {
+ try {
+ setAttribute(attributeName, value);
+ } catch (CoreException e) {
+ ChromiumDebugPlugin.log(e);
+ }
+ }
+
+ public int getIgnoreCount() {
+ return getMarker().getAttribute(IGNORE_COUNT_ATTR, Breakpoint.EMPTY_VALUE);
+ }
+
+ public void setCondition(String condition) throws CoreException {
+ setMarkerAttribute(CONDITION_ATTR, condition);
+ }
+
+ public String getCondition() {
+ return getMarker().getAttribute(CONDITION_ATTR, null);
+ }
+
+ public String getModelIdentifier() {
+ return ChromiumDebugPlugin.DEBUG_MODEL_ID;
+ }
+
+ public void changed() {
+ if (browserBreakpoint != null) {
+ browserBreakpoint.setCondition(getCondition());
+ browserBreakpoint.setEnabled(isEnabled());
+ browserBreakpoint.setIgnoreCount(getIgnoreCount());
+ browserBreakpoint.flush(null);
+ }
+ }
+
+ public void clear() {
+ if (browserBreakpoint != null) {
+ browserBreakpoint.clear(null);
+ }
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectionLoggerImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/ConnectionLoggerImpl.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,154 @@
+// 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.Reader;
+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;
+ }
+
+ public Writer wrapWriter(final Writer streamWriter) {
+ return new Writer() {
+ @Override
+ public void close() throws IOException {
+ streamWriter.close();
+ flushLogWriter();
+ }
+ @Override
+ public void flush() throws IOException {
+ streamWriter.flush();
+ flushLogWriter();
+ }
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ streamWriter.write(cbuf, off, len);
+
+ writeToLog(cbuf, off, len, this,
+ Messages.ConnectionLoggerImpl_SentToChrome);
+ }
+ };
+ }
+ public Reader wrapReader(final Reader streamReader) {
+ return new Reader() {
+ @Override
+ public void close() throws IOException {
+ streamReader.close();
+ flushLogWriter();
+ }
+
+ @Override
+ public int read(char[] cbuf, int off, int len) throws IOException {
+ int res = streamReader.read(cbuf, off, len);
+ if (res > 0) {
+ writeToLog(cbuf, off, res, this,
+ Messages.ConnectionLoggerImpl_ReceivedFromChrome);
+ flushLogWriter();
+ }
+ return res;
+ }
+ };
+ }
+
+ 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(char[] cbuf, int off, int len, Object source,
+ String sourceName) {
+ try {
+ if (lastSource != source) {
+ if (lastSource != null) {
+ logWriter.append('\n');
+ }
+ logWriter.append("> ").append(sourceName).append('\n'); //$NON-NLS-1$
+ lastSource = source;
+ }
+ logWriter.write(cbuf, off, len);
+ } catch (IOException e) {
+ DebugPlugin.log(e);
+ }
+ }
+ private void flushLogWriter() {
+ try {
+ logWriter.flush();
+ } catch (IOException e) {
+ DebugPlugin.log(e);
+ }
+ }
+
+ private final Writer logWriter;
+ private final LogLifecycleListener lifecycleListener;
+ private Object 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();
+ }
+ };
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/ConsolePseudoProcess.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/ConsolePseudoProcess.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,260 @@
+// 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 -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/DebugElementImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugElementImpl.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,44 @@
+// 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.runtime.PlatformObject;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugElement;
+
+/**
+ * A generic IDebugElement implementation.
+ */
+public class DebugElementImpl extends PlatformObject implements IDebugElement {
+
+ private final IChromiumDebugTarget debugTarget;
+
+ public DebugElementImpl(IChromiumDebugTarget debugTarget) {
+ this.debugTarget = debugTarget;
+ }
+
+ public IChromiumDebugTarget getDebugTarget() {
+ return debugTarget;
+ }
+
+ public ILaunch getLaunch() {
+ return getDebugTarget().getLaunch();
+ }
+
+ public String getModelIdentifier() {
+ return ChromiumDebugPlugin.DEBUG_MODEL_ID;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ if (adapter == IDebugElement.class) {
+ return this;
+ }
+ return super.getAdapter(adapter);
+ }
+
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.chromium.debug.core/src/org/chromium/debug/core/model/DebugTargetImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.chromium.debug.core/src/org/chromium/debug/core/model/DebugTargetImpl.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,657 @@
+// 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.Collection;
+
+import org.chromium.debug.core.ChromiumDebugPlugin;
+import org.chromium.debug.core.util.ChromiumDebugPluginUtil;
+import org.chromium.sdk.Breakpoint;
+import org.chromium.sdk.CallFrame;
+import org.chromium.sdk.DebugContext;
+import org.chromium.sdk.DebugEventListener;
+import org.chromium.sdk.ExceptionData;
+import org.chromium.sdk.JavascriptVm;
+import org.chromium.sdk.Script;
+import org.chromium.sdk.DebugContext.State;
+import org.chromium.sdk.DebugContext.StepAction;
+import org.chromium.sdk.JavascriptVm.BreakpointCallback;
+import org.chromium.sdk.JavascriptVm.ScriptsCallback;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+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.IMemoryBlock;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+
+/**
+ * An IDebugTarget implementation for remote JavaScript debugging.
+ * Can debug any target that supports the ChromeDevTools protocol.
+ */
+public class DebugTargetImpl extends DebugElementImpl implements IChromiumDebugTarget {
+
+ private static final IThread[] EMPTY_THREADS = new IThread[0];
+
+ private static final long OPERATION_TIMEOUT_MS = 15000L;
+
+ private final ILaunch launch;
+
+ private final JavascriptThread[] threads;
+
+ private JavascriptVmEmbedder vmEmbedder = STUB_VM_EMBEDDER;
+
+ private ResourceManager resourceManager;
+
+ private BreakpointRegistry breakpointRegistry;
+
+ private IProject debugProject = null;
+
+ private DebugContext debugContext;
+
+ private boolean isSuspended = false;
+
+ private boolean isDisconnected = false;
+
+
+ public DebugTargetImpl(ILaunch launch) {
+ super(null);
+ this.launch = launch;
+ this.threads = new JavascriptThread[] { new JavascriptThread(this) };
+ }
+
+
+ /**
+ * 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 projectNameBase to create for the browser scripts
+ * @param remoteServer embedding application we are connected with
+ * @param attachCallback to invoke on successful attachment
+ * @param monitor to report the progress to
+ * @return whether the target has attached to a tab
+ * @throws CoreException
+ */
+ public boolean attach(String projectNameBase,
+ 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);
+ return performAttach(projectNameBase, connector, destructingGuard, attachCallback);
+ }
+
+ private boolean performAttach(String projectNameBase, JavascriptVmEmbedder.VmConnector connector,
+ DestructingGuard destructingGuard, Runnable attachCallback) throws CoreException {
+ final JavascriptVmEmbedder embedder = connector.attach(embedderListener, debugEventListener);
+
+ Destructable embedderDestructor = new Destructable() {
+ public void destruct() {
+ embedder.getJavascriptVm().detach();
+ }
+ };
+
+ destructingGuard.addValue(embedderDestructor);
+
+ vmEmbedder = embedder;
+
+ // We might want to add some url-specific suffix here
+ String projectName = projectNameBase;
+ // We'd like to know when launch is removed to remove our project.
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(launchListener);
+ this.debugProject = ChromiumDebugPluginUtil.createEmptyProject(projectName);
+ this.breakpointRegistry = new BreakpointRegistry();
+ this.resourceManager = new ResourceManager(debugProject, breakpointRegistry);
+ onAttach(projectName, attachCallback);
+ return true;
+ }
+
+ private void onAttach(String projectName, Runnable attachCallback) {
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
+ reloadScriptsAndPossiblyResume(attachCallback);
+ }
+
+ private void reloadScriptsAndPossiblyResume(final Runnable attachCallback) {
+ reloadScripts(true, new Runnable() {
+ public void run() {
+ try {
+ if (attachCallback != null) {
+ attachCallback.run();
+ }
+ } finally {
+ fireCreationEvent();
+ }
+ Job job = new Job("Update debugger state") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ debugEventListener.resumedByDefault();
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ });
+ }
+
+ private void reloadScripts(boolean isSync, final Runnable runnable) {
+ Runnable command = new Runnable() {
+ public void run() {
+ vmEmbedder.getJavascriptVm().getScripts(new ScriptsCallback() {
+ public void failure(String errorMessage) {
+ ChromiumDebugPlugin.logError(errorMessage);
+ }
+
+ public void success(Collection
+
+
+Establishing debug connection...
+
\ No newline at end of file
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/deploy_settings.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/deploy_settings.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/deploy_widget.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/deploy_widget.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/error_over.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/error_over.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/error_ovr.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/error_ovr.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/exclude_archive.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/exclude_archive.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/icon.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/icon.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/icon32.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/icon32.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/include_archive.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/include_archive.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/main16.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/main16.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/package_widget.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/package_widget.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/upgrade-project-over.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/upgrade-project-over.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/upgrade_project.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/upgrade_project.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/upgrade_red.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/upgrade_red.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/icons/validate_widget.gif
Binary file org.symbian.tools.wrttools.debug.core/icons/validate_widget.gif has changed
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/launch/WRT Debugger.launch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/launch/WRT Debugger.launch Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/plugin.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/plugin.xml Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/Activator.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/Activator.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.symbian.tools.wrttools.debug.core";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static void log(Throwable e) {
+ log(e.getLocalizedMessage(), e);
+ }
+
+ private static void log(String message, Throwable exception) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
+ }
+
+ @Override
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ Images.initImageRegistry(reg);
+ }
+
+ public static void log(String message) {
+ log(message, null);
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/BreakpointAdapterFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/BreakpointAdapterFactory.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.ui.IEditorPart;
+
+public class BreakpointAdapterFactory implements IAdapterFactory {
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof IEditorPart) {
+ IResource resource = (IResource) ((IEditorPart) adaptableObject)
+ .getEditorInput().getAdapter(IResource.class);
+ if (resource != null) {
+ return new WorkspaceLineBreakpointAdapter();
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class[] getAdapterList() {
+ return new Class[] { IToggleBreakpointsTarget.class };
+ }
+
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/ChromeDebugUtils.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/ChromeDebugUtils.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Platform;
+
+public final class ChromeDebugUtils {
+ public static String getExecutablePath(String folder) {
+ File file = new File(folder);
+ if (file.isDirectory()) {
+ File chromeExecutable = new File(file, getExecutable());
+ if (chromeExecutable.isFile()) {
+ return chromeExecutable.getAbsolutePath();
+ }
+ }
+ return null;
+ }
+
+ private static String getExecutable() {
+ // Add more ifs as we add support for new platforms
+ if (isMac()) {
+ return "Google Chrome.app/Contents/MacOS/Google Chrome";
+ } else {
+ return "chrome.exe";
+ }
+ }
+
+ private ChromeDebugUtils() {
+ // No instantiating
+ }
+
+ public static String getChromeExecutible() {
+ return getExecutablePath(Activator.getDefault().getPreferenceStore().getString(IConstants.PREF_NAME_CHROME_LOCATION));
+ }
+
+ public static boolean isWidgetProject(IProject project) {
+ return project.findMember(IConstants.WRT_PREVIEW_HTML) != null;
+ }
+
+ public static boolean isWindows() {
+ return "windows".equals(Platform.getOS());
+ }
+
+ public static boolean isMac() {
+ return "macosx".equals(Platform.getOS());
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/IConstants.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/IConstants.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal;
+
+public interface IConstants {
+ String PREF_NAME_CHROME_LOCATION="chrome.location";
+ String PREF_NAME_CHROME_PORT="chrome.port";
+
+ String PROP_PROJECT_NAME = "projectName";
+ public static final String WRT_PREVIEW_HTML = "wrt_preview_frame.html";
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/Images.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/Images.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+public class Images {
+ private static final String WRT16 = "main16.gif";
+
+ public static void initImageRegistry(ImageRegistry registry) {
+ setImage(registry, WRT16);
+ }
+
+ private static void setImage(ImageRegistry registry, String image) {
+ ImageDescriptor img = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/" + image);
+ registry.put(image, img);
+ }
+
+ public static ImageDescriptor getWrtIcon() {
+ return getImageDescriptor(WRT16);
+ }
+
+ private static ImageDescriptor getImageDescriptor(String image) {
+ return Activator.getDefault().getImageRegistry().getDescriptor(image);
+ }
+
+ public static Image getWrtIconImage() {
+ return getImage(WRT16);
+ }
+
+ private static Image getImage(String image) {
+ return Activator.getDefault().getImageRegistry().get(image);
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/PreferenceInitializer.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/PreferenceInitializer.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+ private final static String DEFAULT_CHROME_LOCATION = "Local Settings/Application Data/Google/Chrome/Application";
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ File folder = getDefaultFolder();
+ if (ChromeDebugUtils.getExecutablePath(folder.getAbsolutePath()) != null) {
+ store.setDefault(IConstants.PREF_NAME_CHROME_LOCATION, folder
+ .getAbsolutePath());
+ }
+ store.setDefault(IConstants.PREF_NAME_CHROME_PORT, 19222);
+ }
+
+ private File getDefaultFolder() {
+ if (ChromeDebugUtils.isMac()) {
+ return new File("/Applications");
+ }
+ String property = System.getProperty("user.home");
+ File folder = new File(property, DEFAULT_CHROME_LOCATION);
+ return folder;
+ }
+
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/WorkspaceLineBreakpointAdapter.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/WorkspaceLineBreakpointAdapter.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal;
+
+import org.chromium.debug.core.model.LineBreakpointAdapter;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.jsdt.internal.ui.javaeditor.JavaEditor;
+
+public class WorkspaceLineBreakpointAdapter extends LineBreakpointAdapter {
+ @SuppressWarnings("restriction")
+ @Override
+ protected ITextEditor getEditor(IWorkbenchPart part) {
+ if (part instanceof JavaEditor) {
+ return (ITextEditor) part;
+ } else {
+ return null;
+ }
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/DebugConnectionJob.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal.launch;
+
+import java.net.URI;
+
+import org.chromium.debug.core.model.Destructable;
+import org.chromium.debug.core.model.DestructingGuard;
+import org.chromium.debug.core.model.JavascriptVmEmbedder;
+import org.chromium.debug.core.model.JavascriptVmEmbedderFactory;
+import org.chromium.debug.core.model.NamedConnectionLoggerFactory;
+import org.chromium.debug.core.model.JavascriptVmEmbedder.ConnectionToRemote;
+import org.chromium.sdk.ConnectionLogger;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.symbian.tools.wrttools.debug.internal.Activator;
+import org.symbian.tools.wrttools.debug.internal.model.DebugTargetImpl;
+
+public class DebugConnectionJob extends Job {
+ static final NamedConnectionLoggerFactory NO_CONNECTION_LOGGER_FACTORY = new NamedConnectionLoggerFactory() {
+ public ConnectionLogger createLogger(String title) {
+ return null;
+ }
+ };
+ private URI uri;
+ private final int port;
+ private final ILaunch launch;
+ private final IProject project;
+ private boolean connected = false;
+
+ public DebugConnectionJob(IProject project, final int port, final ILaunch launch) {
+ super("Establish debug connection");
+ this.project = project;
+ this.port = port;
+ this.launch = launch;
+ setUser(false);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ connect(monitor);
+ } catch (CoreException e) {
+ return e.getStatus();
+ }
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, "");
+ }
+
+ private void connect(IProgressMonitor monitor) throws CoreException {
+ final DebugTargetImpl target = new DebugTargetImpl(launch, project);
+ final JavascriptVmEmbedder.ConnectionToRemote remoteServer = createConnectionToRemote(
+ port, launch, uri);
+ try {
+
+ DestructingGuard destructingGuard = new DestructingGuard();
+ try {
+ Destructable lauchDestructor = new Destructable() {
+ public void destruct() {
+ if (!launch.hasChildren()) {
+ DebugPlugin.getDefault().getLaunchManager()
+ .removeLaunch(launch);
+ }
+ }
+ };
+
+ destructingGuard.addValue(lauchDestructor);
+
+ Destructable targetDestructor = new Destructable() {
+ public void destruct() {
+ terminateTarget(target);
+ }
+ };
+ destructingGuard.addValue(targetDestructor);
+ boolean attached = target.attach(project.getName(), remoteServer,
+ destructingGuard, new Runnable() {
+ public void run() {
+ openProjectExplorerView(target);
+ }
+ }, monitor);
+ if (!attached) {
+ // Error
+ return;
+ }
+
+ launch.setSourceLocator(target.getSourceLocator());
+
+ launch.addDebugTarget(target);
+ monitor.done();
+
+ // All OK
+ destructingGuard.discharge();
+ } finally {
+ destructingGuard.doFinally();
+ }
+
+ } finally {
+ remoteServer.disposeConnection();
+ }
+ }
+
+ protected ConnectionToRemote createConnectionToRemote(int port,
+ ILaunch launch, URI uri) throws CoreException {
+ return JavascriptVmEmbedderFactory.connectToChromeDevTools(port,
+ NO_CONNECTION_LOGGER_FACTORY, new WidgetTabSelector(uri));
+ }
+
+ protected void openProjectExplorerView(final DebugTargetImpl target) {
+ target.setupBreakpointsFromResources();
+ connected = true;
+ }
+
+ public boolean isConnected() {
+ return connected;
+ }
+
+ private static void terminateTarget(DebugTargetImpl target) {
+ target.setDisconnected(true);
+ target.fireTerminateEvent();
+ }
+
+ public void setTabUri(URI uri) {
+ this.uri = uri;
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetLaunchDelegate.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal.launch;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.symbian.tools.wrttools.debug.internal.Activator;
+import org.symbian.tools.wrttools.debug.internal.ChromeDebugUtils;
+import org.symbian.tools.wrttools.debug.internal.IConstants;
+import org.symbian.tools.wrttools.debug.internal.web.WebAppInterface;
+
+public class WidgetLaunchDelegate implements
+ ILaunchConfigurationDelegate {
+ public static final String ID = "org.symbian.tools.wrttools.debug.widget";
+ private static final String[] CHROME_ARGS = {
+ "executable-placeholder", // Chrome executable. Configurable in preferences
+ "port-placeholder", // Here we will set port
+ "profile-placeholder", // Here we will set profile folder so user settings have no effect
+ "--disable-web-security", // Widgets can use network now
+ "--disable-extenions", // Use standard UI, should also re
+ "--disable-plugins", // Run faster!
+ "--no-default-browser-check", // Our users don't need this nagging
+ "--no-first-run", // We don't care
+ "widget-placeholder" // Here we will have widget URI as --app argument
+ };
+ private static final int EXECUTABLE_ARG_NUM = 0;
+ private static final int PORT_ARG_NUM = 1;
+ private static final int PROFILE_ARG_NUM = 2;
+ private static final int APP_ARG_NUM = CHROME_ARGS.length - 1;
+
+ public void launch(ILaunchConfiguration configuration, String mode,
+ final ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+ monitor.beginTask("Preparing WRT Debugger", IProgressMonitor.UNKNOWN);
+ // 1. Load all parameters
+ IProject project = getProject(configuration);
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+
+ if (isProjectDebugged(project, launchManager, launch)) {
+ showProjectIsDebugged();
+ launchManager.removeLaunch(launch);
+ throw createCoreException(MessageFormat.format("Project {0} is already running.", project.getName()), null);
+ }
+
+ final int port = Activator.getDefault().getPreferenceStore().getInt(
+ IConstants.PREF_NAME_CHROME_PORT);
+ boolean debug = mode.equals(ILaunchManager.DEBUG_MODE);
+ final URI uri = prepareDebugger(project, debug, launch, port);
+ final String browserExecutable = ChromeDebugUtils.getChromeExecutible();
+ if (browserExecutable == null) {
+ launchManager.removeLaunch(launch);
+ throw createCoreException("No Chrome browser available", null);
+ }
+
+ // 2. Start Chrome
+ synchronized (CHROME_ARGS) { // No chances for collision. Still, better safe then spend several days looking for hard-to-reproduce problem
+ CHROME_ARGS[EXECUTABLE_ARG_NUM] = browserExecutable;
+ CHROME_ARGS[PROFILE_ARG_NUM] = "--user-data-dir=\"" + Activator.getDefault().getStateLocation().append("chromeprofile").toOSString() + "\"";
+ CHROME_ARGS[PORT_ARG_NUM] = "--remote-shell-port=" + port;
+ CHROME_ARGS[APP_ARG_NUM] = MessageFormat.format("--app={0}", uri.toASCIIString());
+ try {
+ Runtime.getRuntime().exec(CHROME_ARGS, null,
+ new File(browserExecutable).getParentFile());
+ } catch (IOException e) {
+ launchManager.removeLaunch(launch);
+ StringBuffer commandLine = new StringBuffer(CHROME_ARGS[0]);
+ for (int i = 1; i < CHROME_ARGS.length; i++) {
+ commandLine.append(" ").append(CHROME_ARGS[i]);
+ }
+ throw createCoreException("Cannot execute: {0}", commandLine
+ .toString(), e);
+ }
+ }
+
+ if (!debug) {
+ launchManager.removeLaunch(launch);
+ }
+ monitor.done();
+ }
+
+
+ private void showProjectIsDebugged() {
+ }
+
+
+ private boolean isProjectDebugged(IProject project, ILaunchManager launchManager, ILaunch l) throws CoreException {
+ ILaunch[] launches = launchManager.getLaunches();
+ for (ILaunch launch : launches) {
+ ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
+ if (!l.equals(launch) && ID.equals(launchConfiguration.getType().getIdentifier())) {
+ IProject p2 = getProject(launchConfiguration);
+ return project.equals(p2);
+ }
+ }
+ return false;
+ }
+
+
+ private URI prepareDebugger(IProject project, boolean debug,
+ final ILaunch launch, final int port) {
+ final DebugConnectionJob job;
+ if (debug) {
+ job = new DebugConnectionJob(project, port, launch);
+ } else {
+ job = null;
+ }
+ final URI uri = WebAppInterface.getInstance().prepareDebugger(project,
+ job);
+ return uri;
+ }
+
+
+ private IProject getProject(ILaunchConfiguration configuration)
+ throws CoreException {
+ String projectName = configuration.getAttribute(
+ IConstants.PROP_PROJECT_NAME, (String) null);
+ if (projectName == null) {
+ throw createCoreException("Project is not selected", null);
+ }
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ projectName);
+ if (!project.isAccessible()) {
+ throw createCoreException(MessageFormat.format(
+ "Project {0} is not opened", projectName), null);
+ }
+ return project;
+ }
+
+ private CoreException createCoreException(String message, String arg,
+ Throwable exeption) {
+ return createCoreException(MessageFormat.format(message, arg), exeption);
+ }
+
+ private CoreException createCoreException(String message, Throwable exeption) {
+ return new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ message, exeption));
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetTabSelector.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/launch/WidgetTabSelector.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ *******************************************************************************/
+package org.symbian.tools.wrttools.debug.internal.launch;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.chromium.debug.core.model.TabSelector;
+import org.chromium.sdk.Browser.TabConnector;
+import org.chromium.sdk.Browser.TabFetcher;
+
+public class WidgetTabSelector implements TabSelector {
+ private final URI uri;
+ private TabConnector connector;
+
+ public WidgetTabSelector(URI uri) {
+ this.uri = uri;
+ }
+
+ public TabConnector selectTab(TabFetcher tabFetcher) throws IOException {
+ // Give it time to start the process/tab. 5 retries, 500 ms inbetween.
+ for (int i = 0; i < 5; i++) {
+ List extends TabConnector> tabs = tabFetcher.getTabs();
+ for (TabConnector tabConnector : tabs) {
+ String url = tabConnector.getUrl();
+ try {
+ if (uri.toURL().equals(new URL(url))) {
+ connector = tabConnector;
+ return tabConnector;
+ }
+ } catch (MalformedURLException e) {
+ // Ignore - fails because of "chrome" protocol, we should ignore these tabs anyways
+ }
+ }
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ // Ignore
+ }
+ }
+ return null;
+ }
+
+ public TabConnector getConnector() {
+ return connector;
+ }
+}
diff -r ef76fc2ac88c -r e4420d2515f1 org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/model/DebugTargetImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools.debug.core/src/org/symbian/tools/wrttools/debug/internal/model/DebugTargetImpl.java Wed Dec 23 17:13:18 2009 -0800
@@ -0,0 +1,674 @@
+// 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.symbian.tools.wrttools.debug.internal.model;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.chromium.debug.core.ChromiumDebugPlugin;
+import org.chromium.debug.core.model.ChromiumLineBreakpoint;
+import org.chromium.debug.core.model.DebugElementImpl;
+import org.chromium.debug.core.model.Destructable;
+import org.chromium.debug.core.model.DestructingGuard;
+import org.chromium.debug.core.model.IChromiumDebugTarget;
+import org.chromium.debug.core.model.IResourceManager;
+import org.chromium.debug.core.model.JavascriptVmEmbedder;
+import org.chromium.sdk.Breakpoint;
+import org.chromium.sdk.CallFrame;
+import org.chromium.sdk.DebugContext;
+import org.chromium.sdk.DebugEventListener;
+import org.chromium.sdk.ExceptionData;
+import org.chromium.sdk.JavascriptVm;
+import org.chromium.sdk.Script;
+import org.chromium.sdk.DebugContext.State;
+import org.chromium.sdk.DebugContext.StepAction;
+import org.chromium.sdk.JavascriptVm.BreakpointCallback;
+import org.chromium.sdk.JavascriptVm.ScriptsCallback;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+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.ILaunchListener;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IMemoryBlock;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.symbian.tools.wrttools.debug.internal.Activator;
+
+/**
+ * An IDebugTarget implementation for remote JavaScript debugging. Can debug any
+ * target that supports the ChromeDevTools protocol.
+ *
+ * Symbian branch is based on Revision 290
+ */
+public class DebugTargetImpl extends DebugElementImpl implements IChromiumDebugTarget {
+
+ private static final IThread[] EMPTY_THREADS = new IThread[0];
+
+ private static final long OPERATION_TIMEOUT_MS = 15000L;
+
+ private final ILaunch launch;
+
+ private final JavascriptThread[] threads;
+
+ private JavascriptVmEmbedder vmEmbedder = STUB_VM_EMBEDDER;
+
+ private ResourceManager resourceManager;
+
+ private DebugContext debugContext;
+
+ private boolean isSuspended = false;
+
+ private boolean isDisconnected = false;
+
+ private final IProject debugProject;
+
+ public DebugTargetImpl(ILaunch launch, IProject project) {
+ super(null);
+ this.launch = launch;
+ this.debugProject = project;
+ this.threads = new JavascriptThread[] { new JavascriptThread(this) };
+ }
+
+ /**
+ * 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 projectNameBase
+ * to create for the browser scripts
+ * @param remoteServer
+ * embedding application we are connected with
+ * @param attachCallback
+ * to invoke on successful attachment
+ * @param monitor
+ * to report the progress to
+ * @return whether the target has attached to a tab
+ * @throws CoreException
+ */
+ public boolean attach(String projectNameBase,
+ 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);
+ return performAttach(projectNameBase, connector, destructingGuard,
+ attachCallback);
+ }
+
+ private boolean performAttach(String projectNameBase,
+ JavascriptVmEmbedder.VmConnector connector,
+ DestructingGuard destructingGuard, Runnable attachCallback)
+ throws CoreException {
+ final JavascriptVmEmbedder embedder = connector.attach(
+ embedderListener, debugEventListener);
+
+ Destructable embedderDestructor = new Destructable() {
+ public void destruct() {
+ embedder.getJavascriptVm().detach();
+ }
+ };
+
+ destructingGuard.addValue(embedderDestructor);
+
+ vmEmbedder = embedder;
+
+ // We might want to add some url-specific suffix here
+ String projectName = projectNameBase;
+ // We'd like to know when launch is removed to remove our project.
+ DebugPlugin.getDefault().getLaunchManager().addLaunchListener(
+ launchListener);
+ this.resourceManager = createResourceManager();
+ onAttach(projectName, attachCallback);
+ return true;
+ }
+
+ protected ResourceManager createResourceManager() {
+ return new ResourceManager();
+ }
+
+ private void onAttach(String projectName, Runnable attachCallback) {
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(
+ this);
+ reloadScriptsAndPossiblyResume(attachCallback);
+ }
+
+ public void setupBreakpointsFromResources() {
+ try {
+ IMarker[] markers = debugProject.findMarkers(ChromiumLineBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
+ Collection breakpoints = new ArrayList(markers.length);
+ for (IMarker marker : markers) {
+ // If it is not ChromiumLineBreakpoint -
+ // something's gone horribly wrong. Better get
+ // ClassCastException
+ ChromiumLineBreakpoint breakpoint = (ChromiumLineBreakpoint) DebugPlugin
+ .getDefault().getBreakpointManager().getBreakpoint(
+ marker);
+ registerBreakpoint(breakpoint, resourceManager
+ .translateResourceToScript(marker.getResource()));
+ breakpoints.add(breakpoint);
+ }
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+
+ private void reloadScriptsAndPossiblyResume(final Runnable attachCallback) {
+ reloadScripts(true, new Runnable() {
+ public void run() {
+ try {
+ if (attachCallback != null) {
+ attachCallback.run();
+ }
+ } finally {
+ fireCreationEvent();
+ }
+ Job job = new Job("Update debugger state") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ debugEventListener.resumedByDefault();
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+ });
+ }
+
+ private void reloadScripts(boolean isSync, final Runnable runnable) {
+ Runnable command = new Runnable() {
+ public void run() {
+ vmEmbedder.getJavascriptVm().getScripts(new ScriptsCallback() {
+ public void failure(String errorMessage) {
+ Activator.log(errorMessage);
+ }
+
+ public void success(Collection