Commit 2ffccdc8 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Init ModelTypeController's delegate to nullptr

The initial value of ModelTypeController::delegate_ is never read
because the delegate is only used once the controller starts running.
However, let's make sure it's initially null to detect CHECK failures if
there is a violation of the API.

Bug: 885019
Change-Id: I4a5623986b2bbd6c96a02f218438367d8e78a7fc
Reviewed-on: https://chromium-review.googlesource.com/1238729
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593529}
parent 6b4b7b85
......@@ -50,7 +50,7 @@ SyncStopMetadataFate TakeStrictestMetadataFate(SyncStopMetadataFate fate1,
ModelTypeController::ModelTypeController(
ModelType type,
std::unique_ptr<ModelTypeControllerDelegate> delegate_on_disk)
: DataTypeController(type), state_(NOT_RUNNING) {
: DataTypeController(type) {
delegate_map_.emplace(ConfigureContext::STORAGE_ON_DISK,
std::move(delegate_on_disk));
}
......
......@@ -76,10 +76,10 @@ class ModelTypeController : public DataTypeController {
delegate_map_;
// State of this datatype controller.
State state_;
State state_ = NOT_RUNNING;
// Owned by |delegate_map_|. Null while NOT_RUNNING.
ModelTypeControllerDelegate* delegate_;
ModelTypeControllerDelegate* delegate_ = nullptr;
// Callback for use when starting the datatype (usually MODEL_STARTING, but
// STOPPING if abort requested while starting).
......
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