author | Eugene Ostroukhov <eugeneo@symbian.org> |
Mon, 07 Jun 2010 16:51:19 -0700 | |
changeset 355 | 8726e95bcbba |
parent 276 | f2f4a1259de8 |
permissions | -rw-r--r-- |
2 | 1 |
// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 |
// Use of this source code is governed by a BSD-style license that can be |
|
3 |
// found in the LICENSE file. |
|
4 |
||
5 |
package org.chromium.debug.core.model; |
|
6 |
||
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
7 |
import java.util.ArrayList; |
214
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
8 |
import java.util.List; |
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
9 |
|
2 | 10 |
import org.chromium.debug.core.ChromiumDebugPlugin; |
11 |
import org.chromium.sdk.CallFrame; |
|
12 |
import org.chromium.sdk.DebugContext; |
|
13 |
import org.chromium.sdk.DebugEventListener; |
|
14 |
import org.chromium.sdk.ExceptionData; |
|
15 |
import org.chromium.sdk.JavascriptVm; |
|
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
16 |
import org.chromium.sdk.LiveEditDebugEventListener; |
2 | 17 |
import org.chromium.sdk.Script; |
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
18 |
import org.chromium.sdk.UpdatableScript; |
2 | 19 |
import org.chromium.sdk.DebugContext.State; |
20 |
import org.chromium.sdk.DebugContext.StepAction; |
|
21 |
import org.eclipse.core.resources.IFile; |
|
22 |
import org.eclipse.core.resources.IMarkerDelta; |
|
23 |
import org.eclipse.core.runtime.CoreException; |
|
24 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
25 |
import org.eclipse.core.runtime.IStatus; |
|
26 |
import org.eclipse.core.runtime.Status; |
|
27 |
import org.eclipse.core.runtime.jobs.Job; |
|
28 |
import org.eclipse.debug.core.DebugEvent; |
|
29 |
import org.eclipse.debug.core.DebugException; |
|
30 |
import org.eclipse.debug.core.DebugPlugin; |
|
31 |
import org.eclipse.debug.core.ILaunch; |
|
32 |
import org.eclipse.debug.core.ILaunchListener; |
|
33 |
import org.eclipse.debug.core.model.IBreakpoint; |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
34 |
import org.eclipse.debug.core.model.IDebugTarget; |
2 | 35 |
import org.eclipse.debug.core.model.IMemoryBlock; |
36 |
import org.eclipse.debug.core.model.IProcess; |
|
37 |
import org.eclipse.debug.core.model.IThread; |
|
38 |
||
39 |
/** |
|
40 |
* An IDebugTarget implementation for remote JavaScript debugging. |
|
41 |
* Can debug any target that supports the ChromeDevTools protocol. |
|
42 |
*/ |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
43 |
public class DebugTargetImpl extends DebugElementImpl implements IDebugTarget { |
2 | 44 |
|
45 |
private static final IThread[] EMPTY_THREADS = new IThread[0]; |
|
46 |
||
47 |
private final ILaunch launch; |
|
48 |
||
49 |
private final JavascriptThread[] threads; |
|
50 |
||
51 |
private JavascriptVmEmbedder vmEmbedder = STUB_VM_EMBEDDER; |
|
52 |
||
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
53 |
private volatile DebugContext debugContext; |
2 | 54 |
|
55 |
private boolean isSuspended = false; |
|
56 |
||
57 |
private boolean isDisconnected = false; |
|
58 |
||
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
59 |
private final WorkspaceBridge.Factory workspaceBridgeFactory; |
2 | 60 |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
61 |
private WorkspaceBridge workspaceRelations = null; |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
62 |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
63 |
private ListenerBlock listenerBlock = null; |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
64 |
|
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
65 |
public DebugTargetImpl(ILaunch launch, WorkspaceBridge.Factory workspaceBridgeFactory) { |
2 | 66 |
super(null); |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
67 |
this.workspaceBridgeFactory = workspaceBridgeFactory; |
2 | 68 |
this.launch = launch; |
69 |
this.threads = new JavascriptThread[] { new JavascriptThread(this) }; |
|
70 |
} |
|
71 |
||
72 |
||
73 |
/** |
|
74 |
* Loads browser tabs, consults the {@code selector} which of the tabs to |
|
75 |
* attach to, and if any has been selected, requests an attachment to the tab. |
|
76 |
* |
|
77 |
* @param remoteServer embedding application we are connected with |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
78 |
* @param attachCallback to invoke on successful attachment, can fail to be called |
2 | 79 |
* @param monitor to report the progress to |
80 |
* @return whether the target has attached to a tab |
|
81 |
* @throws CoreException |
|
82 |
*/ |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
83 |
public boolean attach(JavascriptVmEmbedder.ConnectionToRemote remoteServer, |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
84 |
DestructingGuard destructingGuard, Runnable attachCallback, |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
85 |
IProgressMonitor monitor) throws CoreException { |
2 | 86 |
monitor.beginTask("", 2); //$NON-NLS-1$ |
87 |
JavascriptVmEmbedder.VmConnector connector = remoteServer.selectVm(); |
|
88 |
if (connector == null) { |
|
89 |
return false; |
|
90 |
} |
|
91 |
monitor.worked(1); |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
92 |
this.listenerBlock = new ListenerBlock(); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
93 |
try { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
94 |
final JavascriptVmEmbedder embedder = connector.attach(embedderListener, debugEventListener); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
95 |
// From this moment V8 may call our listeners. We block them by listenerBlock for a while. |
2 | 96 |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
97 |
Destructable embedderDestructor = new Destructable() { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
98 |
public void destruct() { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
99 |
embedder.getJavascriptVm().detach(); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
100 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
101 |
}; |
2 | 102 |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
103 |
destructingGuard.addValue(embedderDestructor); |
2 | 104 |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
105 |
this.vmEmbedder = embedder; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
106 |
|
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
107 |
// We'd like to know when launch is removed to remove our project. |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
108 |
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(launchListener); |
2 | 109 |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
110 |
this.workspaceRelations = workspaceBridgeFactory.attachedToVm(this, |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
111 |
vmEmbedder.getJavascriptVm()); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
112 |
listenerBlock.setProperlyInitialized(); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
113 |
} finally { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
114 |
listenerBlock.unblock(); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
115 |
} |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
116 |
|
2 | 117 |
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this); |
118 |
reloadScriptsAndPossiblyResume(attachCallback); |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
119 |
|
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
120 |
return true; |
2 | 121 |
} |
122 |
||
123 |
private void reloadScriptsAndPossiblyResume(final Runnable attachCallback) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
124 |
workspaceRelations.reloadScriptsAtStart(); |
2 | 125 |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
126 |
try { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
127 |
if (attachCallback != null) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
128 |
attachCallback.run(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
129 |
} |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
130 |
} finally { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
131 |
fireCreationEvent(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
132 |
} |
2 | 133 |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
134 |
Job job = new Job("Update debugger state") { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
135 |
@Override |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
136 |
protected IStatus run(IProgressMonitor monitor) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
137 |
debugEventListener.resumedByDefault(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
138 |
return Status.OK_STATUS; |
2 | 139 |
} |
140 |
}; |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
141 |
job.schedule(); |
2 | 142 |
} |
143 |
||
144 |
public String getName() throws DebugException { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
145 |
return workspaceBridgeFactory.getLabelProvider().getTargetLabel(this); |
2 | 146 |
} |
147 |
||
148 |
public IProcess getProcess() { |
|
149 |
return null; |
|
150 |
} |
|
151 |
||
152 |
public JavascriptVmEmbedder getJavascriptEmbedder() { |
|
153 |
return vmEmbedder; |
|
154 |
} |
|
155 |
||
156 |
public IThread[] getThreads() throws DebugException { |
|
157 |
return isDisconnected() |
|
158 |
? EMPTY_THREADS |
|
159 |
: threads; |
|
160 |
} |
|
161 |
||
162 |
public boolean hasThreads() throws DebugException { |
|
163 |
return getThreads().length > 0; |
|
164 |
} |
|
165 |
||
166 |
public boolean supportsBreakpoint(IBreakpoint breakpoint) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
167 |
return workspaceRelations.getBreakpointHandler().supportsBreakpoint(breakpoint); |
2 | 168 |
} |
169 |
||
170 |
@Override |
|
171 |
public DebugTargetImpl getDebugTarget() { |
|
172 |
return this; |
|
173 |
} |
|
174 |
||
175 |
@Override |
|
176 |
public ILaunch getLaunch() { |
|
177 |
return launch; |
|
178 |
} |
|
179 |
||
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
180 |
public String getChromiumModelIdentifier() { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
181 |
return workspaceBridgeFactory.getDebugModelIdentifier(); |
2 | 182 |
} |
183 |
||
184 |
public boolean canTerminate() { |
|
185 |
return !isTerminated(); |
|
186 |
} |
|
187 |
||
188 |
public boolean isTerminated() { |
|
189 |
return isDisconnected(); |
|
190 |
} |
|
191 |
||
192 |
public void terminate() throws DebugException { |
|
193 |
disconnect(); |
|
194 |
} |
|
195 |
||
196 |
public boolean canResume() { |
|
197 |
return !isDisconnected() && isSuspended(); |
|
198 |
} |
|
199 |
||
200 |
public synchronized boolean isSuspended() { |
|
201 |
return isSuspended; |
|
202 |
} |
|
203 |
||
204 |
private synchronized void setSuspended(boolean isSuspended) { |
|
205 |
this.isSuspended = isSuspended; |
|
206 |
} |
|
207 |
||
208 |
public void suspended(int detail) { |
|
209 |
setSuspended(true); |
|
210 |
getThread().reset(); |
|
211 |
fireSuspendEvent(detail); |
|
212 |
} |
|
213 |
||
214 |
public void resume() throws DebugException { |
|
215 |
debugContext.continueVm(StepAction.CONTINUE, 1, null); |
|
216 |
// Let's pretend Chromium does respond to the "continue" request immediately |
|
217 |
resumed(DebugEvent.CLIENT_REQUEST); |
|
218 |
} |
|
219 |
||
220 |
public void resumed(int detail) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
221 |
debugContext = null; |
2 | 222 |
fireResumeEvent(detail); |
223 |
} |
|
224 |
||
225 |
public boolean canSuspend() { |
|
226 |
return !isDisconnected() && !isSuspended(); |
|
227 |
} |
|
228 |
||
229 |
public void suspend() throws DebugException { |
|
230 |
vmEmbedder.getJavascriptVm().suspend(null); |
|
231 |
} |
|
232 |
||
233 |
public boolean canDisconnect() { |
|
234 |
return !isDisconnected(); |
|
235 |
} |
|
236 |
||
237 |
public void disconnect() throws DebugException { |
|
238 |
if (!canDisconnect()) { |
|
239 |
return; |
|
240 |
} |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
241 |
workspaceRelations.beforeDetach(); |
2 | 242 |
if (!vmEmbedder.getJavascriptVm().detach()) { |
243 |
ChromiumDebugPlugin.logWarning(Messages.DebugTargetImpl_BadResultWhileDisconnecting); |
|
244 |
} |
|
245 |
// This is a duplicated call to disconnected(). |
|
246 |
// The primary one comes from V8DebuggerToolHandler#onDebuggerDetached |
|
247 |
// but we want to make sure the target becomes disconnected even if |
|
248 |
// there is a browser failure and it does not respond. |
|
249 |
debugEventListener.disconnected(); |
|
250 |
} |
|
251 |
||
252 |
public synchronized boolean isDisconnected() { |
|
253 |
return isDisconnected; |
|
254 |
} |
|
255 |
||
256 |
public IMemoryBlock getMemoryBlock(long startAddress, long length) throws DebugException { |
|
257 |
return null; |
|
258 |
} |
|
259 |
||
260 |
public boolean supportsStorageRetrieval() { |
|
261 |
return false; |
|
262 |
} |
|
263 |
||
264 |
/** |
|
265 |
* Fires a debug event |
|
266 |
* |
|
267 |
* @param event to be fired |
|
268 |
*/ |
|
269 |
public void fireEvent(DebugEvent event) { |
|
270 |
DebugPlugin debugPlugin = DebugPlugin.getDefault(); |
|
271 |
if (debugPlugin != null) { |
|
272 |
debugPlugin.fireDebugEventSet(new DebugEvent[] { event }); |
|
273 |
} |
|
274 |
} |
|
275 |
||
276 |
public void fireEventForThread(int kind, int detail) { |
|
277 |
try { |
|
278 |
IThread[] threads = getThreads(); |
|
279 |
if (threads.length > 0) { |
|
280 |
fireEvent(new DebugEvent(threads[0], kind, detail)); |
|
281 |
} |
|
282 |
} catch (DebugException e) { |
|
283 |
// Actually, this is not thrown in our getThreads() |
|
284 |
return; |
|
285 |
} |
|
286 |
} |
|
287 |
||
288 |
public void fireCreationEvent() { |
|
289 |
setDisconnected(false); |
|
290 |
fireEventForThread(DebugEvent.CREATE, DebugEvent.UNSPECIFIED); |
|
291 |
} |
|
292 |
||
293 |
public synchronized void setDisconnected(boolean disconnected) { |
|
294 |
isDisconnected = disconnected; |
|
295 |
} |
|
296 |
||
297 |
public void fireResumeEvent(int detail) { |
|
298 |
setSuspended(false); |
|
299 |
fireEventForThread(DebugEvent.RESUME, detail); |
|
300 |
fireEvent(new DebugEvent(this, DebugEvent.RESUME, detail)); |
|
301 |
} |
|
302 |
||
303 |
public void fireSuspendEvent(int detail) { |
|
304 |
setSuspended(true); |
|
305 |
fireEventForThread(DebugEvent.SUSPEND, detail); |
|
306 |
fireEvent(new DebugEvent(this, DebugEvent.SUSPEND, detail)); |
|
307 |
} |
|
308 |
||
309 |
public void fireTerminateEvent() { |
|
310 |
// TODO(peter.rybin): from Alexander Pavlov: I think you need to fire a terminate event after |
|
311 |
// this line, for consolePseudoProcess if one is not null. |
|
312 |
fireEventForThread(DebugEvent.TERMINATE, DebugEvent.UNSPECIFIED); |
|
313 |
fireEvent(new DebugEvent(this, DebugEvent.TERMINATE, DebugEvent.UNSPECIFIED)); |
|
314 |
fireEvent(new DebugEvent(getLaunch(), DebugEvent.TERMINATE, DebugEvent.UNSPECIFIED)); |
|
315 |
} |
|
316 |
||
317 |
public void breakpointAdded(IBreakpoint breakpoint) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
318 |
workspaceRelations.getBreakpointHandler().breakpointAdded(breakpoint); |
2 | 319 |
} |
320 |
||
321 |
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
322 |
workspaceRelations.getBreakpointHandler().breakpointChanged(breakpoint, delta); |
2 | 323 |
} |
324 |
||
325 |
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
326 |
workspaceRelations.getBreakpointHandler().breakpointRemoved(breakpoint, delta); |
2 | 327 |
} |
328 |
||
329 |
@SuppressWarnings("unchecked") |
|
330 |
@Override |
|
331 |
public Object getAdapter(Class adapter) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
332 |
if (adapter == EvaluateContext.class) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
333 |
JavascriptThread thread = getThread(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
334 |
if (thread == null) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
335 |
return null; |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
336 |
} |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
337 |
return thread.getAdapter(adapter); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
338 |
} else if (adapter == ILaunch.class) { |
2 | 339 |
return this.launch; |
340 |
} |
|
341 |
return super.getAdapter(adapter); |
|
342 |
} |
|
343 |
||
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
344 |
public VmResource getVmResource(IFile resource) throws CoreException { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
345 |
return workspaceRelations.findVmResourceFromWorkspaceFile(resource); |
2 | 346 |
} |
347 |
||
348 |
public JavascriptThread getThread() { |
|
349 |
return isDisconnected() |
|
350 |
? null |
|
351 |
: threads[0]; |
|
352 |
} |
|
353 |
||
354 |
private static String trim(String text, int maxLength) { |
|
355 |
if (text == null || text.length() <= maxLength) { |
|
356 |
return text; |
|
357 |
} |
|
358 |
return text.substring(0, maxLength - 3) + "..."; //$NON-NLS-1$ |
|
359 |
} |
|
360 |
||
361 |
public DebugContext getDebugContext() { |
|
362 |
return debugContext; |
|
363 |
} |
|
364 |
||
365 |
private final DebugEventListenerImpl debugEventListener = new DebugEventListenerImpl(); |
|
366 |
||
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
367 |
class DebugEventListenerImpl implements DebugEventListener, LiveEditDebugEventListener { |
2 | 368 |
// Synchronizes calls from ReaderThread of Connection and one call from some worker thread |
369 |
private final Object suspendResumeMonitor = new Object(); |
|
370 |
private boolean alreadyResumedOrSuspended = false; |
|
371 |
||
372 |
public void disconnected() { |
|
373 |
if (!isDisconnected()) { |
|
374 |
setDisconnected(true); |
|
375 |
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( |
|
376 |
DebugTargetImpl.this); |
|
377 |
fireTerminateEvent(); |
|
378 |
} |
|
379 |
} |
|
380 |
||
381 |
public void resumedByDefault() { |
|
382 |
synchronized (suspendResumeMonitor) { |
|
383 |
if (!alreadyResumedOrSuspended) { |
|
384 |
resumed(); |
|
385 |
} |
|
386 |
} |
|
387 |
} |
|
388 |
||
389 |
public void resumed() { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
390 |
listenerBlock.waitUntilReady(); |
2 | 391 |
synchronized (suspendResumeMonitor) { |
392 |
DebugTargetImpl.this.resumed(DebugEvent.CLIENT_REQUEST); |
|
393 |
alreadyResumedOrSuspended = true; |
|
394 |
} |
|
395 |
} |
|
396 |
||
397 |
public void scriptLoaded(Script newScript) { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
398 |
listenerBlock.waitUntilReady(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
399 |
workspaceRelations.scriptLoaded(newScript); |
2 | 400 |
} |
401 |
||
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
402 |
public void scriptContentChanged(UpdatableScript newScript) { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
403 |
listenerBlock.waitUntilReady(); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
404 |
workspaceRelations.reloadScript(newScript); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
405 |
} |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
406 |
|
2 | 407 |
public void suspended(DebugContext context) { |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
408 |
listenerBlock.waitUntilReady(); |
2 | 409 |
synchronized (suspendResumeMonitor) { |
410 |
DebugTargetImpl.this.debugContext = context; |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
411 |
workspaceRelations.getBreakpointHandler().breakpointsHit(context.getBreakpointsHit()); |
2 | 412 |
int suspendedDetail; |
413 |
if (context.getState() == State.EXCEPTION) { |
|
414 |
logExceptionFromContext(context); |
|
415 |
suspendedDetail = DebugEvent.BREAKPOINT; |
|
416 |
} else { |
|
417 |
if (context.getBreakpointsHit().isEmpty()) { |
|
418 |
suspendedDetail = DebugEvent.STEP_END; |
|
419 |
} else { |
|
420 |
suspendedDetail = DebugEvent.BREAKPOINT; |
|
421 |
} |
|
422 |
} |
|
423 |
DebugTargetImpl.this.suspended(suspendedDetail); |
|
424 |
||
425 |
alreadyResumedOrSuspended = true; |
|
426 |
} |
|
427 |
} |
|
428 |
} |
|
429 |
||
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
430 |
public void synchronizeBreakpoints(BreakpointSynchronizer.Direction direction, |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
431 |
BreakpointSynchronizer.Callback callback) { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
432 |
workspaceRelations.synchronizeBreakpoints(direction, callback); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
433 |
} |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
434 |
|
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
435 |
|
2 | 436 |
private void logExceptionFromContext(DebugContext context) { |
437 |
ExceptionData exceptionData = context.getExceptionData(); |
|
214
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
438 |
List<? extends CallFrame> callFrames = context.getCallFrames(); |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
439 |
String scriptName; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
440 |
Object lineNumber; |
214
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
441 |
if (callFrames.size() > 0) { |
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
442 |
CallFrame topFrame = callFrames.get(0); |
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
443 |
Script script = topFrame.getScript(); |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
444 |
scriptName = script != null ? script.getName() : Messages.DebugTargetImpl_Unknown; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
445 |
lineNumber = topFrame.getLineNumber(); |
214
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
446 |
} else { |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
447 |
scriptName = Messages.DebugTargetImpl_Unknown; |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
448 |
lineNumber = Messages.DebugTargetImpl_Unknown; |
214
3a649437adec
Bug 2122 - Debugger hangs when debugging Wikipedia widget
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
115
diff
changeset
|
449 |
} |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
450 |
ChromiumDebugPlugin.logError( |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
451 |
Messages.DebugTargetImpl_LogExceptionFormat, |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
452 |
exceptionData.isUncaught() |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
453 |
? Messages.DebugTargetImpl_Uncaught |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
454 |
: Messages.DebugTargetImpl_Caught, |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
455 |
exceptionData.getExceptionMessage(), |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
456 |
scriptName, |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
457 |
lineNumber, |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
458 |
trim(exceptionData.getSourceText(), 80)); |
2 | 459 |
} |
460 |
||
461 |
private final JavascriptVmEmbedder.Listener embedderListener = |
|
462 |
new JavascriptVmEmbedder.Listener() { |
|
463 |
public void reset() { |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
464 |
listenerBlock.waitUntilReady(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
465 |
workspaceRelations.handleVmResetEvent(); |
2 | 466 |
fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.STATE)); |
467 |
} |
|
468 |
public void closed() { |
|
469 |
debugEventListener.disconnected(); |
|
470 |
} |
|
471 |
}; |
|
472 |
||
473 |
private final ILaunchListener launchListener = new ILaunchListener() { |
|
474 |
public void launchAdded(ILaunch launch) { |
|
475 |
} |
|
476 |
public void launchChanged(ILaunch launch) { |
|
477 |
} |
|
478 |
// TODO(peter.rybin): maybe have one instance of listener for all targets? |
|
479 |
public void launchRemoved(ILaunch launch) { |
|
480 |
if (launch != DebugTargetImpl.this.launch) { |
|
481 |
return; |
|
482 |
} |
|
483 |
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(this); |
|
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
484 |
workspaceRelations.launchRemoved(); |
2 | 485 |
} |
486 |
}; |
|
487 |
||
488 |
private final static JavascriptVmEmbedder STUB_VM_EMBEDDER = new JavascriptVmEmbedder() { |
|
489 |
public JavascriptVm getJavascriptVm() { |
|
490 |
//TODO(peter.rybin): decide and redo this exception |
|
491 |
throw new UnsupportedOperationException(); |
|
492 |
} |
|
493 |
||
494 |
public String getTargetName() { |
|
495 |
//TODO(peter.rybin): decide and redo this exception |
|
496 |
throw new UnsupportedOperationException(); |
|
497 |
} |
|
498 |
||
499 |
public String getThreadName() { |
|
500 |
//TODO(peter.rybin): decide and redo this exception |
|
501 |
throw new UnsupportedOperationException(); |
|
502 |
} |
|
503 |
}; |
|
504 |
||
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
505 |
public WorkspaceBridge.JsLabelProvider getLabelProvider() { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
506 |
return workspaceBridgeFactory.getLabelProvider(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
507 |
} |
355
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
508 |
|
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
509 |
public static List<DebugTargetImpl> getAllDebugTargetImpls() { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
510 |
IDebugTarget[] array = DebugPlugin.getDefault().getLaunchManager().getDebugTargets(); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
511 |
List<DebugTargetImpl> result = new ArrayList<DebugTargetImpl>(array.length); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
512 |
for (IDebugTarget target : array) { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
513 |
if (target instanceof DebugTargetImpl == false) { |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
514 |
continue; |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
515 |
} |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
516 |
DebugTargetImpl debugTargetImpl = (DebugTargetImpl) target; |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
517 |
result.add(debugTargetImpl); |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
518 |
} |
8726e95bcbba
Initial commit of updated Chrome Java SDK
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
276
diff
changeset
|
519 |
return result; |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
520 |
} |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
521 |
|
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
522 |
private static class ListenerBlock { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
523 |
private volatile boolean isBlocked = true; |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
524 |
private volatile boolean hasBeenProperlyInitialized = false; |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
525 |
private final Object monitor = new Object(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
526 |
void waitUntilReady() { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
527 |
if (isBlocked) { |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
528 |
synchronized (monitor) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
529 |
while (isBlocked) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
530 |
try { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
531 |
monitor.wait(); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
532 |
} catch (InterruptedException e) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
533 |
throw new RuntimeException(e); |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
534 |
} |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
535 |
} |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
536 |
} |
2 | 537 |
} |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
538 |
if (!hasBeenProperlyInitialized) { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
539 |
throw new RuntimeException("DebugTarget has not been properly initialized"); //$NON-NLS-1$ |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
540 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
541 |
} |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
542 |
void setProperlyInitialized() { |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
543 |
hasBeenProperlyInitialized = true; |
2 | 544 |
} |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
545 |
void unblock() { |
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
214
diff
changeset
|
546 |
isBlocked = false; |
52
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
547 |
synchronized (monitor) { |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
548 |
monitor.notifyAll(); |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
549 |
} |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
550 |
} |
f577ea64429e
Migrated to unmodified Chromium Development Tools version
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
551 |
} |
2 | 552 |
} |