getDataForRendering(drawer, tileToDraw) {
            const keepInternalCopy = drawer.options.usePrivateCache;

            // Test cache state
            if (!this.loaded) {
                $.console.error("Attempt to draw tile when not loaded main cache!");
                return undefined;
            }
            if (this._destroyed) {
                $.console.error("Attempt to draw tile with destroyed main cache!");
                tileToDraw._unload();  // try to restore the state so that the tile is later on fetched again
                return undefined;
            }

            // Ensure cache in a format suitable for the current drawer. If not it is an error, prepareForRendering
            // should be called at the end of invalidation routine instead. Since the processing is async, we are
            // unable to provide the rendering data immediatelly - return.
            const supportedTypes = drawer.getSupportedDataFormats();
            if (!supportedTypes.includes(this.type)) {
                $.console.error("Attempt to draw tile with unsupported target drawer type!");
                this.prepareForRendering(drawer);
                return undefined;
            }

            // If we support internal cache
            if (keepInternalCopy) {
                // let sync preparation handle data if no preloading desired
                if (!drawer.options.preloadCache) {
                    return this.prepareInternalCacheSync(drawer);
                }
                // or check internal cache state before returning
                const internalCache = this._getInternalCacheRef(drawer);
                if (!internalCache || !internalCache.loaded) {
                    $.console.error("Attempt to draw tile with internal cache non-ready state!");
                    return undefined;
                }
                return internalCache;
            }

            // else just return self reference
            return this;
        }
Access of the data by drawers, synchronous function. Should always access a valid main cache.
This is ensured by invalidation routine that executes data modification on a copy record, and
then synchronously swaps records (main caches) to the new data between render calls.

If a drawer decides to have internal cache with synchronous behavior, it is (if necessary)
performed during this phase.

@param {OpenSeadragon.DrawerBase} drawer drawer reference which requests the data: the drawer
  defines the supported formats this cache should return **synchronously**
@param {OpenSeadragon.Tile} tileToDraw reference to the tile that is in the process of drawing and
  for which we request the data; if we attempt to draw such tile while main cache target is destroyed,
  attempt to reset the tile state to force system to re-download it again
@returns {OpenSeadragon.CacheRecord|OpenSeadragon.InternalCacheRecord|undefined} desired data if available,
  wrapped in the cache container. This data is guaranteed to be loaded & in the type supported by the drawer.
  Returns undefined if the data is not ready for rendering.
@private