IKImageBrowserView message not to schedule preload

For our redesigned open source iMedia framework project (currently used by dozens of developers), we go to IKImageBrowserView and have an alarming time with caching.

It seems that IKImageBrowserView likes to preload / pre-cache images as a low priority background task, like many of them, but not yet visible. This can be useful, except that we do not want to load the CPU (and the network for remote images) if we can help it.

Moreover, we have our own FIFO caching mechanism (so that we can share our sketches with other views into the same data), all this does is filling the cache to capacity, and then dumping the old elements.

Is there any way to disable scheduling of this preloader? (Even if there is an undocumented API that we can use now, I will certainly open a request to turn it into an open API, since it is really important to disable this dangerous feature.)

This will really affect many applications. Any work that you can offer will be greatly appreciated.

BTW Some related discussions: http://lists.apple.com/archives/cocoa-dev/2007/Nov/msg02011.html

+3
source share
1 answer

I started using IKImageBrowserView myself, and I hadn’t noticed this before, but really, I tried it and see the same behavior with my own application.

There seems to be a private method in IKImageBrowserView called _shouldProcessLongTasks. I tried overriding it to just return NO, and this apparently prevents preload behavior for images that are not yet visible in the view (at least under Snow Leopard, I would have to test under Leopard to see if the behavior is the same ), It looks like using a private low-risk API, because if this method changes, it will no longer be called. When you report an error with Apple about this, post the radar number so that other affected individuals can cheat on it and try to get a public API and / or behavior change for that.

For the record, it seems that the current behavior is that it will preload the material in the background while the application is in the foreground and the window containing the view is the key. If you switch to another application or window, it will stop preloading.

+4
source

Source: https://habr.com/ru/post/907085/


All Articles