Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
沉迷打码的小凳子
glide
提交
7427a493
G
glide
项目概览
沉迷打码的小凳子
/
glide
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
glide
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7427a493
编写于
3月 12, 2018
作者:
S
Sam Judd
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid expensive synchronization in MultiModelLoader and work around caching bug.
上级
c28837be
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
17 deletion
+8
-17
library/src/main/java/com/bumptech/glide/load/engine/ResourceCacheGenerator.java
...om/bumptech/glide/load/engine/ResourceCacheGenerator.java
+8
-3
library/src/main/java/com/bumptech/glide/load/model/MultiModelLoader.java
.../java/com/bumptech/glide/load/model/MultiModelLoader.java
+0
-14
未找到文件。
library/src/main/java/com/bumptech/glide/load/engine/ResourceCacheGenerator.java
浏览文件 @
7427a493
...
...
@@ -37,6 +37,8 @@ class ResourceCacheGenerator implements DataFetcherGenerator,
this
.
cb
=
cb
;
}
// See TODO below.
@SuppressWarnings
(
"PMD.CollapsibleIfStatements"
)
@Override
public
boolean
startNext
()
{
List
<
Key
>
sourceIds
=
helper
.
getCacheKeys
();
...
...
@@ -48,9 +50,12 @@ class ResourceCacheGenerator implements DataFetcherGenerator,
if
(
File
.
class
.
equals
(
helper
.
getTranscodeClass
()))
{
return
false
;
}
throw
new
IllegalStateException
(
"Failed to find any load path from "
+
helper
.
getModelClass
()
+
" to "
+
helper
.
getTranscodeClass
());
// TODO(b/73882030): This case gets triggered when it shouldn't. With this assertion it causes
// all loads to fail. Without this assertion it causes loads to miss the disk cache
// unnecessarily
// throw new IllegalStateException(
// "Failed to find any load path from " + helper.getModelClass() + " to "
// + helper.getTranscodeClass());
}
while
(
modelLoaders
==
null
||
!
hasNextModelLoader
())
{
resourceClassIndex
++;
...
...
library/src/main/java/com/bumptech/glide/load/model/MultiModelLoader.java
浏览文件 @
7427a493
...
...
@@ -80,7 +80,6 @@ class MultiModelLoader<Model, Data> implements ModelLoader<Model, Data> {
private
DataCallback
<?
super
Data
>
callback
;
@Nullable
private
List
<
Throwable
>
exceptions
;
private
boolean
isCancelled
;
MultiFetcher
(
@NonNull
List
<
DataFetcher
<
Data
>>
fetchers
,
...
...
@@ -113,7 +112,6 @@ class MultiModelLoader<Model, Data> implements ModelLoader<Model, Data> {
@Override
public
void
cancel
()
{
isCancelled
=
true
;
for
(
DataFetcher
<
Data
>
fetcher
:
fetchers
)
{
fetcher
.
cancel
();
}
...
...
@@ -133,10 +131,6 @@ class MultiModelLoader<Model, Data> implements ModelLoader<Model, Data> {
@Override
public
void
onDataReady
(
@Nullable
Data
data
)
{
if
(
isCancelled
)
{
return
;
}
if
(
data
!=
null
)
{
callback
.
onDataReady
(
data
);
}
else
{
...
...
@@ -146,19 +140,11 @@ class MultiModelLoader<Model, Data> implements ModelLoader<Model, Data> {
@Override
public
void
onLoadFailed
(
@NonNull
Exception
e
)
{
if
(
isCancelled
)
{
return
;
}
Preconditions
.
checkNotNull
(
exceptions
).
add
(
e
);
startNextOrFail
();
}
private
void
startNextOrFail
()
{
if
(
isCancelled
)
{
return
;
}
if
(
currentIndex
<
fetchers
.
size
()
-
1
)
{
currentIndex
++;
loadData
(
priority
,
callback
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录