Add logging to debug nullptr in TabWebContentsDelegateAndroid.addNewContents

Adds logging which verifies that the |delegate_| used by WebContentsImpl for
WebContentsCreated is the same used for AddNewContents. A failure will result
in a crash on Android.

Helps debug by providing the following info:
- If delegate is null at WebContentsCreated and non-null at AddNewContents,
there is a race between WebContentsCreated and delegate assignment.
- If delegate is non-null in both cases, but different, it means we're
updating the delegate between the two, which is also not safe.
- If no log messages are fired and we still crash, it means AddNewContents
was called twice.

Bug: 758186
Change-Id: I103cd77c148af25adb1c7002354bb3b853c913b5
Commit-Queue: Eric Karl <>
Reviewed-by: Bo <>
Cr-Commit-Position: refs/heads/master@{#622232}
2 files changed