mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-25 21:05:40 +08:00
Reduced work done on main thread by RCTImageLoader
Summary: public Removed redundant calls to [RCTNetwork canHandleRequest] in release mode when loading images, and improved perf for handler lookups when running in debug mode. Reviewed By: tadeuzagallo Differential Revision: D2663307 fb-gh-sync-id: 13285154c1c3773b32dba7894d86d14992e2fd7d
This commit is contained in:
committed by
facebook-github-bot-0
parent
c043c68e7e
commit
5b796cec34
@@ -165,8 +165,11 @@ RCT_EXPORT_MODULE()
|
||||
float previousPriority = 0;
|
||||
id<RCTURLRequestHandler> previousHandler = nil;
|
||||
for (id<RCTURLRequestHandler> handler in _handlers) {
|
||||
float priority = [handler respondsToSelector:@selector(handlerPriority)] ? [handler handlerPriority] : 0;
|
||||
if (previousHandler && priority < previousPriority) {
|
||||
return previousHandler;
|
||||
}
|
||||
if ([handler canHandleRequest:request]) {
|
||||
float priority = [handler respondsToSelector:@selector(handlerPriority)] ? [handler handlerPriority] : 0;
|
||||
if (previousHandler) {
|
||||
if (priority == previousPriority) {
|
||||
RCTLogError(@"The RCTURLRequestHandlers %@ and %@ both reported that"
|
||||
@@ -180,6 +183,7 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
}
|
||||
}
|
||||
return previousHandler;
|
||||
}
|
||||
|
||||
// Normal code path
|
||||
|
||||
Reference in New Issue
Block a user