本文整理汇总了Java中com.squareup.leakcanary.AnalysisResult类的典型用法代码示例。如果您正苦于以下问题:Java AnalysisResult类的具体用法?Java AnalysisResult怎么用?Java AnalysisResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnalysisResult类属于com.squareup.leakcanary包,在下文中一共展示了AnalysisResult类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: afterDefaultHandling
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
protected void afterDefaultHandling(@NonNull final HeapDump heapDump, @NonNull final AnalysisResult result,
@NonNull final String leakInfo) {
if (!result.leakFound || result.excludedLeak) {
return;
}
Crashlytics.log("*** Memory Leak ***");
for (final String s : leakInfo.split("\n")) {
Crashlytics.log(s);
}
Crashlytics.log("*** End Of Leak ***");
String name = classSimpleName(result.className);
if (!heapDump.referenceName.equals("")) {
name += "(" + heapDump.referenceName + ")";
}
Crashlytics.logException(new Exception(name + " has leaked"));
}
开发者ID:CruGlobal,项目名称:android-gto-support,代码行数:18,代码来源:CrashlyticsLeakService.java
示例2: onHandleIntent
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
@Override protected void onHandleIntent(Intent intent) {
if (intent == null) {
CanaryLog.d("HeapAnalyzerService received a null intent, ignoring.");
return;
}
String listenerClassName = intent.getStringExtra(LISTENER_CLASS_EXTRA);
HeapDump heapDump = (HeapDump) intent.getSerializableExtra(HEAPDUMP_EXTRA);
HeapAnalyzer heapAnalyzer = new HeapAnalyzer(heapDump.excludedRefs);
AnalysisResult result = heapAnalyzer.checkForLeak(heapDump.heapDumpFile, heapDump.referenceKey);
AbstractAnalysisResultService.sendResultToListener(this, listenerClassName, heapDump, result);
}
开发者ID:shengxiadeyu,项目名称:leakcannary,代码行数:14,代码来源:HeapAnalyzerService.java
示例3: afterDefaultHandling
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
@Override
protected void afterDefaultHandling(HeapDump heapDump, AnalysisResult result, String leakInfo) {
if (!result.leakFound || result.excludedLeak) {
return;
}
LoggerFactory.getLogger("LeakCanary").warn(leakInfo);
}
开发者ID:braintree,项目名称:braintree-android-drop-in,代码行数:9,代码来源:LeakLoggerService.java
示例4: onHandleIntent
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
@Override protected void onHandleIntent(Intent intent) {
String listenerClassName = intent.getStringExtra(LISTENER_CLASS_EXTRA);
HeapDump heapDump = (HeapDump) intent.getSerializableExtra(HEAPDUMP_EXTRA);
ExcludedRefs androidExcludedDefault = createAndroidDefaults().build();
HeapAnalyzer heapAnalyzer = new HeapAnalyzer(androidExcludedDefault, heapDump.excludedRefs);
AnalysisResult result = heapAnalyzer.checkForLeak(heapDump.heapDumpFile, heapDump.referenceKey);
AbstractAnalysisResultService.sendResultToListener(this, listenerClassName, heapDump, result);
}
开发者ID:hehonghui,项目名称:leakcanary-for-eclipse,代码行数:11,代码来源:HeapAnalyzerService.java
示例5: Leak
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
Leak(HeapDump heapDump, AnalysisResult result) {
this.heapDump = heapDump;
this.result = result;
}
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:5,代码来源:DisplayLeakActivity.java
示例6: Leak
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
Leak(HeapDump heapDump, AnalysisResult result, File resultFile) {
this.heapDump = heapDump;
this.result = result;
this.resultFile = resultFile;
}
开发者ID:shengxiadeyu,项目名称:leakcannary,代码行数:6,代码来源:DisplayLeakActivity.java
示例7: Leak
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
Leak(HeapDump heapDump, AnalysisResult result, File resultFile) {
this.heapDump = heapDump;
this.result = result;
this.resultFile = resultFile;
}
开发者ID:liangxiwei,项目名称:LeakCanary4Eclipse,代码行数:6,代码来源:DisplayLeakActivity.java
示例8: run
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
@Override
public void run() {
final List<Leak> leaks = new ArrayList<>();
File[] files = leakDirectory.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String filename) {
return filename.endsWith(".hprof");
}
});
if (files != null) {
for (File heapDumpFile : files) {
File resultFile = leakResultFile(heapDumpFile);
ObjectInputStream ois = null;
try {
ois = new ObjectInputStream(new FileInputStream(resultFile));
HeapDump heapDump = (HeapDump) ois.readObject();
AnalysisResult result = (AnalysisResult) ois.readObject();
leaks.add(new Leak(heapDump, result));
} catch (IOException | ClassNotFoundException e) {
// Likely a change in the serializable result class.
// Let's remove the files, we can't read them anymore.
heapDumpFile.delete();
resultFile.delete();
Log.e(TAG, "Could not read result file, deleted result and heap dump:"
+ heapDumpFile,
e);
} finally {
IOUtils.closeSilently(ois);
}
}
Collections.sort(leaks, new Comparator<Leak>() {
@Override
public int compare(Leak lhs, Leak rhs) {
return Long.valueOf(rhs.heapDump.heapDumpFile.lastModified())
.compareTo(lhs.heapDump.heapDumpFile.lastModified());
}
});
}
mainHandler.post(new Runnable() {
@Override
public void run() {
inFlight.remove(LoadLeaks.this);
if (activityOrNull != null) {
activityOrNull.leaks = leaks;
activityOrNull.updateUi();
}
}
});
}
开发者ID:hehonghui,项目名称:leakcanary-for-eclipse,代码行数:50,代码来源:DisplayLeakActivity.java
示例9: run
import com.squareup.leakcanary.AnalysisResult; //导入依赖的package包/类
@Override public void run() {
final List<Leak> leaks = new ArrayList<>();
List<File> files = leakDirectoryProvider.listFiles(new FilenameFilter() {
@Override public boolean accept(File dir, String filename) {
return filename.endsWith(".result");
}
});
for (File resultFile : files) {
FileInputStream fis = null;
try {
fis = new FileInputStream(resultFile);
ObjectInputStream ois = new ObjectInputStream(fis);
HeapDump heapDump = (HeapDump) ois.readObject();
AnalysisResult result = (AnalysisResult) ois.readObject();
leaks.add(new Leak(heapDump, result, resultFile));
} catch (IOException | ClassNotFoundException e) {
// Likely a change in the serializable result class.
// Let's remove the files, we can't read them anymore.
boolean deleted = resultFile.delete();
if (deleted) {
CanaryLog.d(e, "Could not read result file %s, deleted it.", resultFile);
} else {
CanaryLog.d(e, "Could not read result file %s, could not delete it either.",
resultFile);
}
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException ignored) {
}
}
}
}
Collections.sort(leaks, new Comparator<Leak>() {
@Override public int compare(Leak lhs, Leak rhs) {
return Long.valueOf(rhs.resultFile.lastModified())
.compareTo(lhs.resultFile.lastModified());
}
});
mainHandler.post(new Runnable() {
@Override public void run() {
inFlight.remove(LoadLeaks.this);
if (activityOrNull != null) {
activityOrNull.leaks = leaks;
activityOrNull.updateUi();
}
}
});
}
开发者ID:square,项目名称:leakcanary,代码行数:51,代码来源:DisplayLeakActivity.java
注:本文中的com.squareup.leakcanary.AnalysisResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论