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.internal;
|
|
6 |
|
|
7 |
import java.util.List;
|
|
8 |
|
|
9 |
import org.chromium.sdk.Script;
|
|
10 |
import org.chromium.sdk.internal.protocol.FrameObject;
|
|
11 |
import org.chromium.sdk.internal.tools.v8.V8Helper;
|
|
12 |
|
|
13 |
/**
|
|
14 |
* A representation of a remote JavaScript VM call frame.
|
|
15 |
*/
|
|
16 |
public class FrameMirror {
|
|
17 |
|
|
18 |
/**
|
|
19 |
* A name of the script associated with the frame.
|
|
20 |
*/
|
|
21 |
private final String scriptName;
|
|
22 |
|
|
23 |
/**
|
|
24 |
* 0-based line number in the entire script resource.
|
|
25 |
*/
|
|
26 |
private final int lineNumber;
|
|
27 |
|
|
28 |
/**
|
|
29 |
* Function name associated with the frame.
|
|
30 |
*/
|
|
31 |
private final String frameFunction;
|
|
32 |
|
|
33 |
/**
|
|
34 |
* The associated script id value.
|
|
35 |
*/
|
|
36 |
private final long scriptId;
|
|
37 |
|
|
38 |
/**
|
|
39 |
* A script associated with the frame.
|
|
40 |
*/
|
|
41 |
private Script script;
|
|
42 |
|
|
43 |
/**
|
|
44 |
* The JSON descriptor of the frame.
|
|
45 |
*/
|
|
46 |
private final FrameObject frameObject;
|
|
47 |
|
|
48 |
public FrameMirror(FrameObject frameObject,
|
|
49 |
String scriptName, int line, long scriptId, String frameFunction) {
|
|
50 |
this.frameObject = frameObject;
|
|
51 |
this.scriptName = scriptName;
|
|
52 |
this.lineNumber = line;
|
|
53 |
this.scriptId = scriptId;
|
|
54 |
this.frameFunction = frameFunction;
|
|
55 |
}
|
|
56 |
|
|
57 |
public String getScriptName() {
|
|
58 |
return scriptName;
|
|
59 |
}
|
|
60 |
|
|
61 |
public long getScriptId() {
|
|
62 |
return scriptId;
|
|
63 |
}
|
|
64 |
|
|
65 |
/**
|
|
66 |
* @return the 0-based line number in the resource
|
|
67 |
*/
|
|
68 |
public int getLine() {
|
|
69 |
return lineNumber;
|
|
70 |
}
|
|
71 |
|
|
72 |
public String getFunctionName() {
|
|
73 |
return frameFunction;
|
|
74 |
}
|
|
75 |
|
|
76 |
public List<PropertyReference> getLocals() {
|
|
77 |
return V8Helper.computeLocals(frameObject);
|
|
78 |
}
|
|
79 |
|
|
80 |
public List<ScopeMirror> getScopes() {
|
|
81 |
return V8Helper.computeScopes(frameObject);
|
|
82 |
}
|
|
83 |
|
|
84 |
public PropertyReference getReceiverRef() {
|
|
85 |
return V8Helper.computeReceiverRef(frameObject);
|
|
86 |
}
|
|
87 |
|
|
88 |
public synchronized void setScript(Script script) {
|
|
89 |
this.script = script;
|
|
90 |
}
|
|
91 |
|
|
92 |
public synchronized Script getScript() {
|
|
93 |
return script;
|
|
94 |
}
|
|
95 |
}
|