Commit 158ee138 authored by Ella Ge's avatar Ella Ge Committed by Chromium LUCI CQ

Convert ready_callbacks_ to OnceClosureList

Bug: 1152282
Change-Id: Ifc9b2fdbb7bed906a2e89d611051ce76f4626ffc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600029Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839112}
parent 4d025b08
......@@ -756,9 +756,7 @@ void OobeUI::InitializeHandlers() {
js_calls_container_->ExecuteDeferredJSCalls(web_ui());
ready_ = true;
for (size_t i = 0; i < ready_callbacks_.size(); ++i)
ready_callbacks_[i].Run();
ready_callbacks_.clear();
ready_callbacks_.Notify();
for (BaseWebUIHandler* handler : webui_only_handlers_)
handler->InitializeBase();
......@@ -784,9 +782,9 @@ bool OobeUI::IsScreenInitialized(OobeScreenId screen) {
return false;
}
bool OobeUI::IsJSReady(const base::Closure& display_is_ready_callback) {
bool OobeUI::IsJSReady(base::OnceClosure display_is_ready_callback) {
if (!ready_)
ready_callbacks_.push_back(display_is_ready_callback);
ready_callbacks_.AddUnsafe(std::move(display_is_ready_callback));
return ready_;
}
......
......@@ -83,7 +83,7 @@ class OobeUI : public ui::MojoWebUIController {
bool IsScreenInitialized(OobeScreenId screen);
bool IsJSReady(const base::Closure& display_is_ready_callback);
bool IsJSReady(base::OnceClosure display_is_ready_callback);
// Shows or hides OOBE UI elements.
void ShowOobeUI(bool show);
......@@ -204,7 +204,7 @@ class OobeUI : public ui::MojoWebUIController {
bool ready_ = false;
// Callbacks to notify when JS part is fully loaded and ready to accept calls.
std::vector<base::Closure> ready_callbacks_;
base::OnceClosureList ready_callbacks_;
// List of registered observers.
base::ObserverList<Observer>::Unchecked observer_list_;
......
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