Commit 1a9b490f authored by Kenichi Ishibashi's avatar Kenichi Ishibashi Committed by Commit Bot

Don't record end mark of traces for loading resource too early

Before this CL, we called ResourceLoadContinuesBeyondScope()
only after StartLoad() succeeded. This wasn't enough to cover
all loading cases and ResourceLoader::DidFinishLoading()
could be called when we already record END marks for tracing.

This CL changes to call ResourceLoadContinuesBeyondScope()
when resource still needs loading or is loading.

Bug: 900815
Change-Id: I478e1e36c41b0fdc50f43c7d99687ea615eaaf2a
Reviewed-on: https://chromium-review.googlesource.com/c/1312174Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604543}
parent 52296b88
...@@ -917,9 +917,7 @@ Resource* ResourceFetcher::RequestResource( ...@@ -917,9 +917,7 @@ Resource* ResourceFetcher::RequestResource(
// the resource was already initialized for the revalidation here, but won't // the resource was already initialized for the revalidation here, but won't
// start loading. // start loading.
if (ResourceNeedsLoad(resource, params, policy)) { if (ResourceNeedsLoad(resource, params, policy)) {
if (StartLoad(resource)) { if (!StartLoad(resource)) {
scoped_resource_load_tracker.ResourceLoadContinuesBeyondScope();
} else {
resource->FinishAsError(ResourceError::CancelledError(params.Url()), resource->FinishAsError(ResourceError::CancelledError(params.Url()),
Context().GetLoadingTaskRunner().get()); Context().GetLoadingTaskRunner().get());
} }
...@@ -928,6 +926,11 @@ Resource* ResourceFetcher::RequestResource( ...@@ -928,6 +926,11 @@ Resource* ResourceFetcher::RequestResource(
if (policy != kUse) if (policy != kUse)
InsertAsPreloadIfNecessary(resource, params, resource_type); InsertAsPreloadIfNecessary(resource, params, resource_type);
if (resource->Identifier() == identifier &&
(resource->StillNeedsLoad() || resource->IsLoading())) {
scoped_resource_load_tracker.ResourceLoadContinuesBeyondScope();
}
return resource; return resource;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment