-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
2,632 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...t/src/main/java/com/google/wear/watchface/dfx/memory/ActiveMemoryFootprintCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.google.wear.watchface.dfx.memory; | ||
|
||
import static com.google.wear.watchface.dfx.memory.WatchFaceDocuments.findSceneNode; | ||
|
||
import org.w3c.dom.Document; | ||
|
||
import java.util.Map; | ||
|
||
/** Computes the memory footprint of a watch face in active. */ | ||
public class ActiveMemoryFootprintCalculator { | ||
private final VariantConfigValue activeConfigValue; | ||
private final Document document; | ||
private final Map<String, DrawableResourceDetails> resourceMemoryMap; | ||
private final EvaluationSettings evaluationSettings; | ||
|
||
ActiveMemoryFootprintCalculator( | ||
Document document, | ||
Map<String, DrawableResourceDetails> resourceMemoryMap, | ||
EvaluationSettings evaluationSettings) { | ||
this.activeConfigValue = VariantConfigValue.active(evaluationSettings); | ||
this.document = document; | ||
this.resourceMemoryMap = resourceMemoryMap; | ||
this.evaluationSettings = evaluationSettings; | ||
} | ||
|
||
long computeAmbientMemoryFootprint() { | ||
DrawableNodeConfigTable drawableNodeConfigTable = | ||
DrawableNodeConfigTable.create(findSceneNode(document), activeConfigValue); | ||
WatchFaceResourceCollector resourceCollector = | ||
new WatchFaceResourceCollector(document, resourceMemoryMap, evaluationSettings); | ||
return new DynamicNodePerConfigurationFootprintCalculator( | ||
document, | ||
resourceMemoryMap, | ||
evaluationSettings, | ||
activeConfigValue, | ||
resourceCollector, | ||
drawableNodeConfigTable) | ||
.calculateMaxFootprintBytes(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.