fix reload on non ui thread
This commit is contained in:
parent
2d5d24ac40
commit
1a84a3d7bb
@ -233,13 +233,14 @@ public class DoricDev {
|
|||||||
DoricLog.d("Context source %s in debugging,skip reload", source);
|
DoricLog.d("Context source %s in debugging,skip reload", source);
|
||||||
} else {
|
} else {
|
||||||
DoricLog.d("Context reload :id %s,source %s ", context.getContextId(), source);
|
DoricLog.d("Context reload :id %s,source %s ", context.getContextId(), source);
|
||||||
|
uiHandler.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
context.reload(script);
|
context.reload(script);
|
||||||
if (reloadingContexts.get(context.getContextId()) == null) {
|
if (reloadingContexts.get(context.getContextId()) == null) {
|
||||||
reloadingContexts.put(context.getContextId(), context);
|
reloadingContexts.put(context.getContextId(), context);
|
||||||
}
|
}
|
||||||
uiHandler.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
for (StatusCallback callback : callbacks) {
|
for (StatusCallback callback : callbacks) {
|
||||||
callback.onReload(context, script);
|
callback.onReload(context, script);
|
||||||
}
|
}
|
||||||
|
@ -185,9 +185,10 @@ - (void)reload:(NSString *)source script:(NSString *)script {
|
|||||||
DoricLog(@"Context source %@ in debugging,skip reload", source);
|
DoricLog(@"Context source %@ in debugging,skip reload", source);
|
||||||
} else {
|
} else {
|
||||||
DoricLog(@"Context reload :id %@,source %@", context.contextId, source);
|
DoricLog(@"Context reload :id %@,source %@", context.contextId, source);
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[context reload:script];
|
[context reload:script];
|
||||||
[self.reloadingContexts addObject:context];
|
[self.reloadingContexts addObject:context];
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
for (id <DoricDevStatusCallback> callback in self.callbacks) {
|
for (id <DoricDevStatusCallback> callback in self.callbacks) {
|
||||||
[callback onReload:context script:script];
|
[callback onReload:context script:script];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user