59
59
import java .util .Map ;
60
60
import java .util .Set ;
61
61
62
+ import static com .qihoo360 .replugin .helper .LogDebug .LOADER_TAG ;
62
63
import static com .qihoo360 .replugin .helper .LogDebug .LOG ;
63
64
import static com .qihoo360 .replugin .helper .LogDebug .PLUGIN_TAG ;
64
65
import static com .qihoo360 .replugin .helper .LogRelease .LOGR ;
@@ -314,6 +315,18 @@ final boolean loadDex(ClassLoader parent, int load) {
314
315
parent = getClass ().getClassLoader ().getParent (); // TODO: 这里直接用父类加载器
315
316
}
316
317
String soDir = mPackageInfo .applicationInfo .nativeLibraryDir ;
318
+
319
+ long begin = 0 ;
320
+ boolean isDexExist = false ;
321
+
322
+ if (LOG ) {
323
+ begin = System .currentTimeMillis ();
324
+ File dexFile = mPluginObj .mInfo .getDexFile ();
325
+ if (dexFile .exists () && dexFile .length () > 0 ) {
326
+ isDexExist = true ;
327
+ }
328
+ }
329
+
317
330
mClassLoader = RePlugin .getConfig ().getCallbacks ().createPluginClassLoader (mPluginObj .mInfo , mPath , out , soDir , parent );
318
331
Log .i ("dex" , "load " + mPath + " = " + mClassLoader );
319
332
@@ -324,6 +337,18 @@ final boolean loadDex(ClassLoader parent, int load) {
324
337
return false ;
325
338
}
326
339
340
+ if (LOG ) {
341
+ if (!isDexExist ) {
342
+ Log .d (LOADER_TAG , " --释放DEX, " + "(plugin=" + mPluginName + ", version=" + mPluginObj .mInfo .getVersion () + ")"
343
+ + ", use:" + (System .currentTimeMillis () - begin )
344
+ + ", process:" + IPC .getCurrentProcessName ());
345
+ } else {
346
+ Log .d (LOADER_TAG , " --无需释放DEX, " + "(plugin=" + mPluginName + ", version=" + mPluginObj .mInfo .getVersion () + ")"
347
+ + ", use:" + (System .currentTimeMillis () - begin )
348
+ + ", process:" + IPC .getCurrentProcessName ());
349
+ }
350
+ }
351
+
327
352
// 缓存表:ClassLoader
328
353
synchronized (Plugin .FILENAME_2_DEX ) {
329
354
Plugin .FILENAME_2_DEX .put (mPath , new WeakReference <>(mClassLoader ));
0 commit comments