@@ -11,6 +11,8 @@ class V8Config
1111 private static final String AndroidKey = "android" ;
1212 private static final String V8FlagsKey = "v8Flags" ;
1313 private static final String CodeCacheKey = "codeCache" ;
14+ // TODO: EnableHeapSnapshotKey is subject to approval and change
15+ private static final String EnableHeapSnapshotKey = "heapSnapshotEnable" ;
1416 private static final String HeapSnapshotScriptKey = "heapSnapshotScript" ;
1517 private static final String HeapSnapshotBlobKey = "heapSnapshotBlob" ;
1618 private static final String SnapshotFile = "snapshot.blob" ;
@@ -22,6 +24,7 @@ public static Object[] fromPackageJSON(File appDir)
2224 File packageInfo = new File (appDir , "/app/package.json" );
2325 if (!packageInfo .exists ())
2426 {
27+ android .util .Log .d ("~~~~~~~~" , "A PACKAGE INFO DOES NOT EXIST" );
2528 return result ;
2629 }
2730
@@ -31,6 +34,8 @@ public static Object[] fromPackageJSON(File appDir)
3134 rootObject = FileSystem .readJSONFile (packageInfo );
3235 if (rootObject != null && rootObject .has (AndroidKey ))
3336 {
37+ android .util .Log .d ("~~~~~~~~" , "Getting keys inside android" );
38+
3439 JSONObject androidObject = rootObject .getJSONObject (AndroidKey );
3540 if (androidObject .has (V8FlagsKey ))
3641 {
@@ -61,6 +66,12 @@ public static Object[] fromPackageJSON(File appDir)
6166 {
6267 result [4 ] = androidObject .getString (ProfilerOutputDirKey );
6368 }
69+ if (androidObject .has (EnableHeapSnapshotKey ))
70+ {
71+
72+ android .util .Log .d ("~~~~~~~~" , "Found thy key" );
73+ result [5 ] = androidObject .getBoolean (EnableHeapSnapshotKey );
74+ }
6475 }
6576 }
6677 catch (Exception e )
@@ -83,7 +94,9 @@ private static Object[] makeDefaultOptions()
8394 // a binary file containing an already saved snapshot
8495 "" ,
8596 // V8 profiler output directory
86- ""
97+ "" ,
98+ // enable heapsnapshots extraction, false by default
99+ false
87100 };
88101
89102 return result ;
0 commit comments