Commit 3e5df272 authored by tzik's avatar tzik Committed by Commit Bot

Disable base::{Once,Repeating}Callback construction from nullptr

A constructor of base::{Once,Repeating}Callback takes a pointer to
BindStateBase, that is intended to be used by base::Bind*.
However, the constructor accidentally matches to nullptr parameter, and
that requires a null check of |bind_state| in the callback constructor.

This CL disables nullptr argument on the callback construction.

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ic74ca7ce94bc95922e122257d397ff5fbf1fa431
Reviewed-on: https://chromium-review.googlesource.com/1111179
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569782}
parent e59b611d
......@@ -8,6 +8,8 @@
#ifndef BASE_CALLBACK_H_
#define BASE_CALLBACK_H_
#include <stddef.h>
#include "base/callback_forward.h"
#include "base/callback_internal.h"
......@@ -58,6 +60,7 @@ class OnceCallback<R(Args...)> : public internal::CallbackBase {
internal::PassingTraitsType<Args>...);
constexpr OnceCallback() = default;
OnceCallback(std::nullptr_t) = delete;
explicit OnceCallback(internal::BindStateBase* bind_state)
: internal::CallbackBase(bind_state) {}
......@@ -105,6 +108,7 @@ class RepeatingCallback<R(Args...)> : public internal::CallbackBaseCopyable {
internal::PassingTraitsType<Args>...);
constexpr RepeatingCallback() = default;
RepeatingCallback(std::nullptr_t) = delete;
explicit RepeatingCallback(internal::BindStateBase* bind_state)
: internal::CallbackBaseCopyable(bind_state) {}
......
......@@ -355,7 +355,6 @@ ThreatDetails::ThreatDetails()
num_visits_(0),
ambiguous_dom_(false),
trim_to_ad_tags_(false),
done_callback_(nullptr),
all_done_expected_(false),
is_all_done_(false) {}
......
......@@ -16,7 +16,6 @@ WebMainParams::WebMainParams() : WebMainParams(nullptr) {}
WebMainParams::WebMainParams(WebMainDelegate* delegate)
: delegate(delegate),
register_exit_manager(true),
get_task_scheduler_init_params_callback(nullptr),
argc(0),
argv(nullptr) {}
......
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