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

Side by Side Diff: plugins/org.chromium.sdk/src/org/chromium/sdk/internal/v8native/ScriptImpl.java

Issue 12323002: In LiveEdit API expose important control-flow parameter (fixing TODO) (Closed) Base URL: https://chromedevtools.googlecode.com/svn/trunk
Patch Set: 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
« no previous file with comments | « plugins/org.chromium.sdk/src/org/chromium/sdk/UpdatableScript.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 package org.chromium.sdk.internal.v8native; 1 package org.chromium.sdk.internal.v8native;
2 2
3 import java.util.Collections; 3 import java.util.Collections;
4 import java.util.logging.Level; 4 import java.util.logging.Level;
5 import java.util.logging.Logger; 5 import java.util.logging.Logger;
6 6
7 import org.chromium.sdk.DebugContext; 7 import org.chromium.sdk.DebugContext;
8 import org.chromium.sdk.DebugEventListener; 8 import org.chromium.sdk.DebugEventListener;
9 import org.chromium.sdk.RelayOk; 9 import org.chromium.sdk.RelayOk;
10 import org.chromium.sdk.SyncCallback; 10 import org.chromium.sdk.SyncCallback;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 @Override 55 @Override
56 public void success(SuccessCommandResponse successResponse) { 56 public void success(SuccessCommandResponse successResponse) {
57 ChangeLiveBody body; 57 ChangeLiveBody body;
58 try { 58 try {
59 body = successResponse.body().asChangeLiveBody(); 59 body = successResponse.body().asChangeLiveBody();
60 } catch (JsonProtocolParseException e) { 60 } catch (JsonProtocolParseException e) {
61 throw new RuntimeException(e); 61 throw new RuntimeException(e);
62 } 62 }
63 63
64 LiveEditResult resultDescription = body.getResultDescription(); 64 LiveEditResult resultDescription = body.getResultDescription();
65 boolean resumed = false;
65 if (!previewOnly) { 66 if (!previewOnly) {
66 ScriptLoadCallback scriptCallback = new ScriptLoadCallback() { 67 ScriptLoadCallback scriptCallback = new ScriptLoadCallback() {
67 @Override 68 @Override
68 public void failure(String message) { 69 public void failure(String message) {
69 LOGGER.log(Level.SEVERE, 70 LOGGER.log(Level.SEVERE,
70 "Failed to reload script after LiveEdit script update; " + mes sage); 71 "Failed to reload script after LiveEdit script update; " + mes sage);
71 } 72 }
72 73
73 @Override 74 @Override
74 public void success() { 75 public void success() {
75 DebugEventListener listener = debugSession.getDebugEventListener() ; 76 DebugEventListener listener = debugSession.getDebugEventListener() ;
76 if (listener != null) { 77 if (listener != null) {
77 listener.scriptContentChanged(ScriptImpl.this); 78 listener.scriptContentChanged(ScriptImpl.this);
78 } 79 }
79 } 80 }
80 }; 81 };
81 V8Helper.reloadScriptAsync(debugSession, Collections.singletonList(get Id()), 82 V8Helper.reloadScriptAsync(debugSession, Collections.singletonList(get Id()),
82 scriptCallback, null); 83 scriptCallback, null);
83 84
84 if (body.stepin_recommended() == Boolean.TRUE) { 85 if (body.stepin_recommended() == Boolean.TRUE) {
85 DebugContext debugContext = debugSession.getContextBuilder().getCurr entDebugContext(); 86 DebugContext debugContext = debugSession.getContextBuilder().getCurr entDebugContext();
86 if (debugContext == null) { 87 if (debugContext == null) {
87 // We may have already issued 'continue' since the moment that cha nge live command 88 // We may have already issued 'continue' since the moment that cha nge live command
88 // was sent so the context was dropped. Ignore this case. 89 // was sent so the context was dropped. Ignore this case.
89 } else { 90 } else {
90 debugContext.continueVm(DebugContext.StepAction.IN, 0, null); 91 debugContext.continueVm(DebugContext.StepAction.IN, 0, null);
92 resumed = true;
91 } 93 }
92 } else { 94 } else {
93 if (resultDescription != null && resultDescription.stack_modified()) { 95 if (resultDescription != null && resultDescription.stack_modified()) {
94 debugSession.recreateCurrentContext(); 96 debugSession.recreateCurrentContext();
95 } 97 }
96 } 98 }
97 } 99 }
98 100
99 if (callback != null) { 101 if (callback != null) {
100 callback.success(body.getChangeLog(), 102 callback.success(resumed, body.getChangeLog(),
101 UpdateResultParser.wrapChangeDescription(resultDescription)); 103 UpdateResultParser.wrapChangeDescription(resultDescription));
102 } 104 }
103 } 105 }
104 106
105 @Override 107 @Override
106 public void failure(String message, ErrorDetails errorDetails) { 108 public void failure(String message, ErrorDetails errorDetails) {
107 UpdatableScript.Failure failure; 109 UpdatableScript.Failure failure;
108 if (errorDetails == null) { 110 if (errorDetails == null) {
109 failure = UpdatableScript.Failure.UNSPECIFIED; 111 failure = UpdatableScript.Failure.UNSPECIFIED;
110 } else if (errorDetails.asChangeLiveCompileError() != null) { 112 } else if (errorDetails.asChangeLiveCompileError() != null) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 172 }
171 ScriptHandle scriptHandle; 173 ScriptHandle scriptHandle;
172 try { 174 try {
173 scriptHandle = handle.asScriptHandle(); 175 scriptHandle = handle.asScriptHandle();
174 } catch (JsonProtocolParseException e) { 176 } catch (JsonProtocolParseException e) {
175 throw new RuntimeException(e); 177 throw new RuntimeException(e);
176 } 178 }
177 return scriptHandle.id(); 179 return scriptHandle.id();
178 } 180 }
179 } 181 }
OLDNEW
« no previous file with comments | « plugins/org.chromium.sdk/src/org/chromium/sdk/UpdatableScript.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698