| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |