Commit 7671698c authored by japhet's avatar japhet Committed by Commit bot

For more aggressive progress bar completion strategies, only count high priority resources

BUG=513459

Review-Url: https://codereview.chromium.org/2340603002
Cr-Commit-Position: refs/heads/master@{#418656}
parent 4197b467
...@@ -414,7 +414,7 @@ static std::unique_ptr<TracedValue> loadResourceTraceData(unsigned long identifi ...@@ -414,7 +414,7 @@ static std::unique_ptr<TracedValue> loadResourceTraceData(unsigned long identifi
void FrameFetchContext::willStartLoadingResource(unsigned long identifier, ResourceRequest& request, Resource::Type type) void FrameFetchContext::willStartLoadingResource(unsigned long identifier, ResourceRequest& request, Resource::Type type)
{ {
TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadResourceTraceData(identifier, request.url(), request.priority())); TRACE_EVENT_ASYNC_BEGIN1("blink.net", "Resource", identifier, "data", loadResourceTraceData(identifier, request.url(), request.priority()));
frame()->loader().progress().willStartLoading(identifier); frame()->loader().progress().willStartLoading(identifier, request.priority());
prepareRequest(request); prepareRequest(request);
if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request.url().isValid()) if (!m_documentLoader || m_documentLoader->fetcher()->archive() || !request.url().isValid())
......
...@@ -142,14 +142,14 @@ void ProgressTracker::sendFinalProgress() ...@@ -142,14 +142,14 @@ void ProgressTracker::sendFinalProgress()
m_frame->loader().client()->progressEstimateChanged(m_progressValue); m_frame->loader().client()->progressEstimateChanged(m_progressValue);
} }
void ProgressTracker::willStartLoading(unsigned long identifier) void ProgressTracker::willStartLoading(unsigned long identifier, ResourceLoadPriority priority)
{ {
if (!m_frame->isLoading()) if (!m_frame->isLoading())
return; return;
// All of the progress bar completion policies besides LoadEvent instead block on parsing // All of the progress bar completion policies besides LoadEvent instead block on parsing
// completion, which corresponds to finishing parsing. For those policies, don't consider // completion, which corresponds to finishing parsing. For those policies, don't consider
// resource load that start after DOMContentLoaded finishes. // resource load that start after DOMContentLoaded finishes.
if (m_frame->settings()->progressBarCompletion() != ProgressBarCompletion::LoadEvent && m_finishedParsing) if (m_frame->settings()->progressBarCompletion() != ProgressBarCompletion::LoadEvent && (m_finishedParsing || priority < ResourceLoadPriorityHigh))
return; return;
DCHECK(!m_progressItems.get(identifier)); DCHECK(!m_progressItems.get(identifier));
m_progressItems.set(identifier, wrapUnique(new ProgressItem(progressItemDefaultEstimatedLength))); m_progressItems.set(identifier, wrapUnique(new ProgressItem(progressItemDefaultEstimatedLength)));
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
#include "platform/network/ResourceLoadPriority.h"
#include "wtf/Allocator.h" #include "wtf/Allocator.h"
#include "wtf/Forward.h" #include "wtf/Forward.h"
#include "wtf/HashMap.h" #include "wtf/HashMap.h"
...@@ -60,7 +61,7 @@ public: ...@@ -60,7 +61,7 @@ public:
void finishedParsing(); void finishedParsing();
void willStartLoading(unsigned long identifier); void willStartLoading(unsigned long identifier, ResourceLoadPriority);
void incrementProgress(unsigned long identifier, const ResourceResponse&); void incrementProgress(unsigned long identifier, const ResourceResponse&);
void incrementProgress(unsigned long identifier, int); void incrementProgress(unsigned long identifier, int);
void completeProgress(unsigned long identifier); void completeProgress(unsigned long identifier);
......
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