author | Eugene Ostroukhov <eugeneo@symbian.org> |
Mon, 07 Jun 2010 13:48:20 -0700 | |
changeset 351 | e317b108976d |
parent 276 | f2f4a1259de8 |
child 355 | 8726e95bcbba |
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.sdk; |
|
6 |
||
7 |
import java.util.Collection; |
|
8 |
||
9 |
import org.chromium.sdk.internal.tools.v8.MethodIsBlockingException; |
|
10 |
||
11 |
/** |
|
12 |
* Abstraction of a remote Javascript virtual machine. Clients can use it to |
|
13 |
* conduct debugging process. This interface does not specify attach method, |
|
14 |
* because it cannot be polymorphous. |
|
15 |
*/ |
|
16 |
public interface JavascriptVm { |
|
17 |
||
18 |
/** |
|
19 |
* A callback for breakpoint-related requests. |
|
20 |
*/ |
|
21 |
public interface BreakpointCallback { |
|
22 |
||
23 |
void success(Breakpoint breakpoint); |
|
24 |
||
25 |
void failure(String errorMessage); |
|
26 |
} |
|
27 |
||
28 |
/** |
|
29 |
* A callback for retrieving scripts. |
|
30 |
*/ |
|
31 |
public interface ScriptsCallback { |
|
32 |
||
33 |
void success(Collection<Script> scripts); |
|
34 |
||
35 |
void failure(String errorMessage); |
|
36 |
} |
|
37 |
||
38 |
/** |
|
39 |
* A callback for suspend request. |
|
40 |
*/ |
|
41 |
public interface SuspendCallback { |
|
42 |
||
43 |
/** |
|
44 |
* Signals that command successfully finished. After this DebugContext should be built |
|
45 |
* and unless there are some problems, |
|
46 |
* {@link DebugEventListener#suspended(DebugContext)} will be called soon. |
|
47 |
*/ |
|
48 |
void success(); |
|
49 |
||
50 |
void failure(Exception reason); |
|
51 |
} |
|
52 |
||
53 |
/** |
|
54 |
* Detaches from the related tab debugger. |
|
55 |
* |
|
56 |
* @return whether the operation succeeded |
|
57 |
*/ |
|
58 |
boolean detach(); |
|
59 |
||
60 |
/** |
|
61 |
* @return whether the tab is currently attached |
|
62 |
*/ |
|
63 |
boolean isAttached(); |
|
64 |
||
65 |
/** |
|
66 |
* Retrieves user scripts loaded into the tab. |
|
67 |
* Blocks until the result is ready. |
|
68 |
* |
|
69 |
* @param callback to invoke once the operation result is available, |
|
70 |
* may be {@code null} |
|
71 |
* @throws MethodIsBlockingException if called from a callback because it |
|
72 |
* blocks until scripts are received |
|
276
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
73 |
* TODO(peter.rybin): get rid of callback (return result explicitly) |
f2f4a1259de8
Bug 2065 - Pull updated Chrome Developer Tools into the workspace
Eugene Ostroukhov <eugeneo@symbian.org>
parents:
2
diff
changeset
|
74 |
* TODO(peter.rybin): support notification about collected scripts |
2 | 75 |
*/ |
76 |
void getScripts(ScriptsCallback callback) throws MethodIsBlockingException; |
|
77 |
||
78 |
/** |
|
79 |
* Sets a breakpoint with the specified parameters. |
|
80 |
* |
|
81 |
* @param type of the breakpoint |
|
82 |
* @param target of the breakpoint, depends on the {@code type} value: |
|
83 |
* <table border=1> |
|
84 |
* <tr><td>type value</td><td>target value</td></tr> |
|
85 |
* <tr><td>FUNCTION</td><td>a function expression</td></tr> |
|
86 |
* <tr><td>SCRIPT_NAME</td><td>a script name (as reported by Script#getName())</td></tr> |
|
87 |
* <tr><td>SCRIPT_ID</td><td>a stringified script ID (as reported by Script#getId())</td></tr> |
|
88 |
* </table> |
|
89 |
* @param line in the script or function. If none, use |
|
90 |
* {@link Breakpoint#EMPTY_VALUE} |
|
91 |
* @param position of the target start within the line. If none, use |
|
92 |
* {@link Breakpoint#EMPTY_VALUE} |
|
93 |
* @param enabled whether the breakpoint is enabled initially |
|
94 |
* @param condition nullable string with breakpoint condition |
|
95 |
* @param ignoreCount number specifying the amount of breakpoint hits to |
|
96 |
* ignore. If none, use {@link Breakpoint#EMPTY_VALUE} |
|
97 |
* @param callback to invoke when the evaluation result is ready, |
|
98 |
* may be {@code null} |
|
99 |
*/ |
|
100 |
void setBreakpoint(Breakpoint.Type type, String target, int line, int position, boolean enabled, |
|
101 |
String condition, int ignoreCount, BreakpointCallback callback); |
|
102 |
||
103 |
/** |
|
104 |
* Tries to suspend VM. If successful, {@link DebugEventListener#suspended(DebugContext)} |
|
105 |
* will be called. |
|
106 |
* @param callback to invoke once the operation result is available, |
|
107 |
* may be {@code null} |
|
108 |
*/ |
|
109 |
void suspend(SuspendCallback callback); |
|
110 |
} |