Commit 4c45ee07 authored by Dan Harrington's avatar Dan Harrington Committed by Commit Bot

DCHECK for null pointers

This should help mmke it clear that you can't pass null
for keys_to_remove.

Change-Id: I63a86d6253cdd3b0e609942edf306ccd88b47a9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148058Reviewed-by: default avatarssid <ssid@chromium.org>
Commit-Queue: Dan H <harringtond@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761022}
parent 03653b02
......@@ -109,6 +109,8 @@ bool UpdateEntriesFromTaskRunner(
std::unique_ptr<KeyValueVector> entries_to_save,
std::unique_ptr<KeyVector> keys_to_remove,
const std::string& client_id) {
DCHECK(entries_to_save);
DCHECK(keys_to_remove);
leveldb::Status status;
bool success = database->Save(*entries_to_save, *keys_to_remove, &status);
ProtoLevelDBWrapperMetrics::RecordUpdate(client_id, success, status);
......@@ -121,6 +123,7 @@ bool UpdateEntriesWithRemoveFilterFromTaskRunner(
const KeyFilter& delete_key_filter,
const std::string& target_prefix,
const std::string& client_id) {
DCHECK(entries_to_save);
leveldb::Status status;
bool success = database->UpdateWithRemoveFilter(
*entries_to_save, delete_key_filter, target_prefix, &status);
......
......@@ -123,7 +123,8 @@ class ProtoDatabase {
// Asynchronously saves |entries_to_save| and deletes entries from
// |keys_to_remove| from the database. |callback| will be invoked on the
// calling thread when complete.
// calling thread when complete. |entries_to_save| and |keys_to_remove| must
// be non-null.
virtual void UpdateEntries(
std::unique_ptr<typename Util::Internal<T>::KeyEntryVector>
entries_to_save,
......@@ -133,7 +134,7 @@ class ProtoDatabase {
// Asynchronously saves |entries_to_save| and deletes entries that satisfies
// the |delete_key_filter| from the database. |callback| will be invoked on
// the calling thread when complete. The filter will be called on
// ProtoDatabase's taskrunner.
// ProtoDatabase's taskrunner. |entries_to_save| must be non-null.
virtual void UpdateEntriesWithRemoveFilter(
std::unique_ptr<typename Util::Internal<T>::KeyEntryVector>
entries_to_save,
......
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