読者です 読者をやめる 読者になる 読者になる

のねのBlog

パソコンやソフト開発で起きた問題など書きます。よろしくお願いします。

HbFontCache

Cross Reference: /frameworks/minikin/libs/minikin/HbFontCache.cpp

     89 void purgeHbFontCacheLocked() {
     90     assertMinikinLocked();
     91     getFontCacheLocked()->clear();
     92 }
     80 HbFontCache* getFontCacheLocked() {
     81     assertMinikinLocked();
     82     static HbFontCache* cache = nullptr;
     83     if (cache == nullptr) {
     84         cache = new HbFontCache();
     85     }
     86     return cache;
     87 }
     88 


Cross Reference: /frameworks/minikin/libs/minikin/Layout.cpp

    967 void Layout::purgeCaches() {
    968     AutoMutex _l(gMinikinLock);
    969     LayoutCache& layoutCache = LayoutEngine::getInstance().layoutCache;
    970     layoutCache.clear();
    971     purgeHbFontCacheLocked();
    972 }

Cross Reference: /frameworks/base/core/jni/android_graphics_Canvas.cpp

    569 static void freeTextLayoutCaches(JNIEnv* env, jobject) {
    570     Layout::purgeCaches();
    571 }

こっちはなんだろ?

    565 static void freeCaches(JNIEnv* env, jobject) {
    566     SkGraphics::PurgeFontCache();
    567 }


Cross Reference: /frameworks/base/core/jni/android_graphics_Canvas.cpp

 630     {"freeTextLayoutCaches", "()V", (void*) CanvasJNI::freeTextLayoutCaches}

Cross Reference: /frameworks/base/core/java/android/app/ActivityThread.java

   4762     static void freeTextLayoutCachesIfNeeded(int configDiff) {
   4763         if (configDiff != 0) {
   4764             // Ask text layout engine to free its caches if there is a locale change
   4765             boolean hasLocaleConfigChange = ((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
   4766             if (hasLocaleConfigChange) {
   4767                 Canvas.freeTextLayoutCaches();
   4768                 if (DEBUG_CONFIGURATION) Slog.v(TAG, "Cleared TextLayout Caches");
   4769             }
   4770         }
   4771     }
   4935     final void handleLowMemory() {
   4936         ArrayList<ComponentCallbacks2> callbacks = collectComponentCallbacks(true, null);
   4937 
   4938         final int N = callbacks.size();
   4939         for (int i=0; i<N; i++) {
   4940             callbacks.get(i).onLowMemory();
   4941         }
   4942 
   4943         // Ask SQLite to free up as much memory as it can, mostly from its page caches.
   4944         if (Process.myUid() != Process.SYSTEM_UID) {
   4945             int sqliteReleased = SQLiteDatabase.releaseMemory();
   4946             EventLog.writeEvent(SQLITE_MEM_RELEASED_EVENT_LOG_TAG, sqliteReleased);
   4947         }
   4948 
   4949         // Ask graphics to free up as much as possible (font/image caches)
   4950         Canvas.freeCaches();
   4951 
   4952         // Ask text layout engine to free also as much as possible
   4953         Canvas.freeTextLayoutCaches();
   4954 
   4955         BinderInternal.forceGc("mem");
   4956     }