}
private void serviceRequest(PendingRequest request) {
assert manifestLoaded : "Manifest should be loaded";
final ResourceSymbolInfo resourceSymbolInfo = lookupEntryInManifest(request.resourceUrl);
final Callback callback = request.callback;
if (resourceSymbolInfo == null) {
if (ClientConfig.isDebugMode()) {
Logging.getLogger().logText(
"Resymbolization failed: No symbol info for " + request.resourceUrl);
}
callback.onSymbolsFetchFailed(ERROR_SYMBOL_FETCH_FAIL);
return;
}
final String symbolMapUrl = resourceSymbolInfo.getSymbolMapUrl();
JsSymbolMap symbolMap = get(symbolMapUrl);
// We only want to request and parse for symbolMaps we havn't already
// parsed.
if (symbolMap == null) {
// Create the XhrCallback to service this request.
XhrCallback xhrCallback = new XhrCallback() {
public void onFail(XMLHttpRequest xhr) {
callback.onSymbolsFetchFailed(ERROR_SYMBOL_FETCH_FAIL);
dequeuePendingXhrs(symbolMapUrl, xhr, false);
if (ClientConfig.isDebugMode()) {
Logging.getLogger().logText(
"Fetching symbol map: " + symbolMapUrl + " failed.");
}
}
public void onSuccess(XMLHttpRequest xhr) {
// Double check that another XHR didnt pull it down and parse it.
JsSymbolMap fetchedSymbolMap = get(symbolMapUrl);
if (fetchedSymbolMap == null) {
fetchedSymbolMap = JsSymbolMap.parse(
resourceSymbolInfo.getSourceServer(),
resourceSymbolInfo.getSourceViewerServer(),
resourceSymbolInfo.getType(), xhr.getResponseText());
put(symbolMapUrl, fetchedSymbolMap);
}
callback.onSymbolsReady(fetchedSymbolMap);
dequeuePendingXhrs(symbolMapUrl, xhr, true);
if (ClientConfig.isDebugMode()) {