Commit 247de386 authored by Varun Khaneja's avatar Varun Khaneja Committed by Commit Bot

Add CHECKs before calling RunCallbackOnIOThread.

This will help identify which case has a null callback.
See: crash/b2f5fa086babf323

Bug: 889972
Change-Id: Ife0279dbb07fc0c2201981b70796c365d49ea36e
Reviewed-on: https://chromium-review.googlesource.com/c/1334547Reviewed-by: default avatarNathan Parker <nparker@chromium.org>
Commit-Queue: Varun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608135}
parent 900cb480
......@@ -124,6 +124,9 @@ void JNI_SafeBrowsingApiBridge_OnUrlCheckDone(
callback_id));
if (result_status != RESULT_STATUS_SUCCESS) {
CHECK(callback); // Remove after fixing crbug.com/889972
CHECK(!callback->is_null()); // Remove after fixing crbug.com/889972
if (result_status == RESULT_STATUS_TIMEOUT) {
ReportUmaResult(UMA_STATUS_TIMEOUT);
VLOG(1) << "Safe browsing API call timed-out";
......@@ -138,10 +141,16 @@ void JNI_SafeBrowsingApiBridge_OnUrlCheckDone(
// Shortcut for safe, so we don't have to parse JSON.
if (metadata_str == "{}") {
CHECK(callback); // Remove after fixing crbug.com/889972
CHECK(!callback->is_null()); // Remove after fixing crbug.com/889972
ReportUmaResult(UMA_STATUS_SAFE);
RunCallbackOnIOThread(std::move(callback), SB_THREAT_TYPE_SAFE,
ThreatMetadata());
} else {
CHECK(callback); // Remove after fixing crbug.com/889972
CHECK(!callback->is_null()); // Remove after fixing crbug.com/889972
// Unsafe, assuming we can parse the JSON.
SBThreatType worst_threat;
ThreatMetadata threat_metadata;
......
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