public void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
synchronized (cacheLock) {
Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML);
for (Map.Entry<Source, LibraryElement> entry : elementMap.entrySet()) {
Source librarySource = entry.getKey();
LibraryElement library = entry.getValue();
//
// Cache the element in the library's info.
//
DartEntry dartEntry = getReadableDartEntry(librarySource);
if (dartEntry != null) {
DartEntryImpl dartCopy = dartEntry.getWritableCopy();
recordElementData(dartCopy, library, library.getSource(), htmlSource);
dartCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED);
dartCopy.setValue(SourceEntry.LINE_INFO, new LineInfo(new int[] {0}));
dartCopy.setValue(DartEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS);
// DartEntry.ELEMENT - set in recordElementData
dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY);