package com.tencent.mm.plugin.topstory.ui.video;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.al.f;
import com.tencent.mm.plugin.topstory.a.g;
import com.tencent.mm.protocal.protobuf.chx;
import com.tencent.mm.sdk.g.d;
import com.tencent.mm.sdk.platformtools.ab;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public final class m {
    b sDo;
    String sES;
    Map<String, chx> sET = Collections.synchronizedMap(new HashMap());
    Set<String> sEU = Collections.synchronizedSet(new HashSet());
    private int sEV = 0;

    public m() {
        AppMethodBeat.i(1751);
        AppMethodBeat.o(1751);
    }

    public final void d(b bVar) {
        AppMethodBeat.i(1752);
        this.sEV++;
        ab.i("MicroMsg.TopStory.TopStoryPreloadMgr", "onUICreate %d", new Object[]{Integer.valueOf(this.sEV)});
        this.sDo = bVar;
        this.sES = g.abz(bVar.cFT().xgj);
        AppMethodBeat.o(1752);
    }

    public final void aEX() {
        AppMethodBeat.i(1753);
        this.sEV--;
        ab.i("MicroMsg.TopStory.TopStoryPreloadMgr", "onUIDestroy %d", new Object[]{Integer.valueOf(this.sEV)});
        if (this.sEV <= 0) {
            cGP();
            this.sEU.clear();
            d.post(new b(this, this.sES), "TopStory.DeleteVideoFolderTask");
            this.sDo = null;
        }
        AppMethodBeat.o(1753);
    }

    public final void cGP() {
        AppMethodBeat.i(1754);
        for (String rO : this.sEU) {
            f.afx().rO(rO);
        }
        AppMethodBeat.o(1754);
    }

    static long aa(long j, long j2) {
        if (j2 != 0) {
            return (100 * j) / j2;
        }
        return 0;
    }
}
