Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: plugins/org.chromium.sdk/src/org/chromium/sdk/JsVariable.java

Issue 12300043: Move setValue operation into a separate JsDeclarativeVariable interface (Closed) Base URL: https://chromedevtools.googlecode.com/svn/trunk
Patch Set: fcr Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.sdk; 5 package org.chromium.sdk;
6 6
7 /** 7 /**
8 * An object that represents a variable in a browser JavaScript VM call frame. 8 * An object that represents a variable in a browser JavaScript VM, a call frame
9 * variable and/or an object property.
9 */ 10 */
10 public interface JsVariable { 11 public interface JsVariable {
11
12 /**
13 * @return whether it is possible to read this variable
14 */
15 boolean isReadable();
16
17 /** 12 /**
18 * Returns the value of this variable. 13 * Returns the value of this variable.
19 * 14 *
20 * @return a [probably compound] JsValue corresponding to this variable. 15 * @return a [probably compound] JsValue corresponding to this variable.
21 * {@code null} if there was an error reading the value data 16 * {@code null} if there was an error reading the value data
22 * or the property has accessor descriptor 17 * or the property has accessor descriptor
23 * @see #isReadable() 18 * @see #isReadable()
24 * @throws UnsupportedOperationException if this variable is not readable 19 * @throws UnsupportedOperationException if this variable is not readable
25 */ 20 */
26 JsValue getValue() throws UnsupportedOperationException; 21 JsValue getValue() throws UnsupportedOperationException;
27 22
28 /** 23 /**
29 * Returns variable name. If the variable is an object property, in some imple mentations 24 * Returns variable name. If the variable is an object property, in some imple mentations
30 * (namely V8 Standalone protocol) the numeric property name may be decorated 25 * (namely V8 Standalone protocol) the numeric property name may be decorated
31 * with square brackets. 26 * with square brackets.
32 * @return the name of this variable 27 * @return the name of this variable
33 * TODO: do not decorate property name with square brackets, 28 * TODO: do not decorate property name with square brackets,
34 * http://code.google.com/p/chromedevtools/issues/detail?id=77 29 * http://code.google.com/p/chromedevtools/issues/detail?id=77
35 */ 30 */
36 String getName(); 31 String getName();
37 32
38 /** 33 /**
39 * @return whether it is possible to modify this variable
40 */
41 boolean isMutable();
42
43 /**
44 * Sets a new value for this variable.
45 *
46 * @param newValue to set
47 * @param callback to report the operation result to
48 * @param syncCallback to report the end of any processing
49 * @see #isMutable()
50 * @throws UnsupportedOperationException if this variable is not mutable
51 */
52 RelayOk setValue(JsValue newValue, SetValueCallback callback, SyncCallback syn cCallback)
53 throws UnsupportedOperationException;
54
55 /**
56 * A callback to use while setting a variable value.
57 */
58 interface SetValueCallback {
59 /**
60 * Variable is successfully updated. New value is available in {@link JsVari able#getValue()}.
61 */
62 void success();
63
64 /**
65 * Variable hasn't been updated because exception was thrown. Most probably this exception was
66 * thrown from setter function.
67 */
68 void exceptionThrown(JsValue exception);
69
70 /**
71 * Variable hasn't been updated for unknown reason.
72 */
73 void failure(Exception cause);
74 }
75
76 /**
77 * Returns object property data if variable is an object property and its desc riptor 34 * Returns object property data if variable is an object property and its desc riptor
78 * is available. 35 * is available.
79 */ 36 */
80 JsObjectProperty asObjectProperty(); 37 JsObjectProperty asObjectProperty();
38
39 /**
40 * Casts this to declarative variable type if available or returns null.
41 */
42 JsDeclarativeVariable asDeclarativeVariable();
81 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698