Commit 31aa16cc authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[ScriptStreaming] Fix incorrect DCHECK.

ready_state_ could be kErrorOccured as well as kReadyStreaming. Update the
logic to check for this and add a new NotStreamingReason to log it.

BUG=chromium:865098,chromium:871276

Change-Id: I7f4e17c843b74632d4cf167664f26fdb92f30a8c
Reviewed-on: https://chromium-review.googlesource.com/1164943
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581882}
parent 89e76f8b
...@@ -51,6 +51,7 @@ class CORE_EXPORT ScriptStreamer final ...@@ -51,6 +51,7 @@ class CORE_EXPORT ScriptStreamer final
kStreamerNotReadyOnGetSource, kStreamerNotReadyOnGetSource,
kInlineScript, kInlineScript,
kDidntTryToStartStreaming, kDidntTryToStartStreaming,
kErrorOccurred,
// Pseudo values that should never be seen in reported metrics // Pseudo values that should never be seen in reported metrics
kCount, kCount,
......
...@@ -384,6 +384,8 @@ const char* NotStreamedReasonString(ScriptStreamer::NotStreamingReason reason) { ...@@ -384,6 +384,8 @@ const char* NotStreamedReasonString(ScriptStreamer::NotStreamingReason reason) {
return "inline script"; return "inline script";
case ScriptStreamer::kDidntTryToStartStreaming: case ScriptStreamer::kDidntTryToStartStreaming:
return "start streaming not called"; return "start streaming not called";
case ScriptStreamer::kErrorOccurred:
return "an error occurred";
case ScriptStreamer::kAlreadyLoaded: case ScriptStreamer::kAlreadyLoaded:
case ScriptStreamer::kCount: case ScriptStreamer::kCount:
case ScriptStreamer::kInvalid: case ScriptStreamer::kInvalid:
......
...@@ -380,11 +380,13 @@ ClassicScript* ClassicPendingScript::GetSource(const KURL& document_url, ...@@ -380,11 +380,13 @@ ClassicScript* ClassicPendingScript::GetSource(const KURL& document_url,
DCHECK_EQ(not_streamed_reason, ScriptStreamer::kInvalid); DCHECK_EQ(not_streamed_reason, ScriptStreamer::kInvalid);
if (streamer_->StreamingSuppressed()) { if (streamer_->StreamingSuppressed()) {
not_streamed_reason = streamer_->StreamingSuppressedReason(); not_streamed_reason = streamer_->StreamingSuppressedReason();
} else if (ready_state_ != kReady) { } else if (ready_state_ == kErrorOccurred) {
DCHECK_EQ(ready_state_, kReadyStreaming); not_streamed_reason = ScriptStreamer::kErrorOccurred;
} else if (ready_state_ == kReadyStreaming) {
not_streamed_reason = ScriptStreamer::kStreamerNotReadyOnGetSource; not_streamed_reason = ScriptStreamer::kStreamerNotReadyOnGetSource;
} else { } else {
// Streamer can be used to compile script. // Streamer can be used to compile script.
DCHECK_EQ(ready_state_, kReady);
streamer_ready = true; streamer_ready = true;
} }
} }
......
...@@ -34595,6 +34595,7 @@ Called by update_net_trust_anchors.py.--> ...@@ -34595,6 +34595,7 @@ Called by update_net_trust_anchors.py.-->
<int value="10" label="Streamer not ready when GetSource called"/> <int value="10" label="Streamer not ready when GetSource called"/>
<int value="11" label="Internal script"/> <int value="11" label="Internal script"/>
<int value="12" label="Streaming was never started"/> <int value="12" label="Streaming was never started"/>
<int value="13" label="An error had occurred before GetSource was called"/>
</enum> </enum>
<enum name="NPAPIPluginStatus"> <enum name="NPAPIPluginStatus">
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