1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

AK: Rename adopt() to adopt_ref()

This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
This commit is contained in:
Andreas Kling 2021-04-23 16:46:57 +02:00
parent b3db01e20e
commit b91c49364d
228 changed files with 461 additions and 461 deletions

View file

@ -158,42 +158,42 @@ NonnullRefPtr<Action> make_properties_action(Function<void(Action&)> callback, C
NonnullRefPtr<Action> Action::create(String text, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), move(callback), parent));
return adopt_ref(*new Action(move(text), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), move(icon), move(callback), parent));
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), shortcut, move(callback), parent));
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent));
}
NonnullRefPtr<Action> Action::create(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), shortcut, move(icon), move(callback), parent));
return adopt_ref(*new Action(move(text), shortcut, move(icon), move(callback), parent));
}
NonnullRefPtr<Action> Action::create_checkable(String text, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), move(callback), parent, true));
return adopt_ref(*new Action(move(text), move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(String text, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), move(icon), move(callback), parent, true));
return adopt_ref(*new Action(move(text), move(icon), move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(String text, const Shortcut& shortcut, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), shortcut, move(callback), parent, true));
return adopt_ref(*new Action(move(text), shortcut, move(callback), parent, true));
}
NonnullRefPtr<Action> Action::create_checkable(String text, const Shortcut& shortcut, RefPtr<Gfx::Bitmap> icon, Function<void(Action&)> callback, Core::Object* parent)
{
return adopt(*new Action(move(text), shortcut, move(icon), move(callback), parent, true));
return adopt_ref(*new Action(move(text), shortcut, move(icon), move(callback), parent, true));
}
Action::Action(String text, Function<void(Action&)> on_activation_callback, Core::Object* parent, bool checkable)

View file

@ -98,7 +98,7 @@ void AutocompleteBox::update_suggestions(Vector<AutocompleteProvider::Entry>&& s
auto& model = *static_cast<AutocompleteSuggestionModel*>(m_suggestion_view->model());
model.set_suggestions(move(suggestions));
} else {
m_suggestion_view->set_model(adopt(*new AutocompleteSuggestionModel(move(suggestions))));
m_suggestion_view->set_model(adopt_ref(*new AutocompleteSuggestionModel(move(suggestions))));
m_suggestion_view->update();
if (has_suggestions)
m_suggestion_view->set_cursor(m_suggestion_view->model()->index(0), GUI::AbstractView::SelectionUpdate::Set);

View file

@ -46,7 +46,7 @@ i32 DisplayLink::register_callback(Function<void(i32)> callback)
WindowServerConnection::the().post_message(Messages::WindowServer::EnableDisplayLink());
i32 callback_id = s_next_callback_id++;
callbacks().set(callback_id, adopt(*new DisplayLinkCallback(callback_id, move(callback))));
callbacks().set(callback_id, adopt_ref(*new DisplayLinkCallback(callback_id, move(callback))));
return callback_id;
}

View file

@ -100,7 +100,7 @@ public:
static NonnullRefPtr<FileSystemModel> create(String root_path = "/", Mode mode = Mode::FilesAndDirectories)
{
return adopt(*new FileSystemModel(root_path, mode));
return adopt_ref(*new FileSystemModel(root_path, mode));
}
virtual ~FileSystemModel() override;

View file

@ -18,7 +18,7 @@ class FilteringProxyModel final : public Model {
public:
static NonnullRefPtr<FilteringProxyModel> construct(Model& model)
{
return adopt(*new FilteringProxyModel(model));
return adopt_ref(*new FilteringProxyModel(model));
}
virtual ~FilteringProxyModel() override {};

View file

@ -35,7 +35,7 @@ FontPicker::FontPicker(Window* parent_window, const Gfx::Font* current_font, boo
m_family_list_view->horizontal_scrollbar().set_visible(false);
m_weight_list_view = *widget.find_descendant_of_type_named<ListView>("weight_list_view");
m_weight_list_view->set_model(adopt(*new FontWeightListModel(m_weights)));
m_weight_list_view->set_model(adopt_ref(*new FontWeightListModel(m_weights)));
m_weight_list_view->horizontal_scrollbar().set_visible(false);
m_size_spin_box = *widget.find_descendant_of_type_named<SpinBox>("size_spin_box");

View file

@ -15,7 +15,7 @@ namespace GUI {
class IconImpl : public RefCounted<IconImpl> {
public:
static NonnullRefPtr<IconImpl> create() { return adopt(*new IconImpl); }
static NonnullRefPtr<IconImpl> create() { return adopt_ref(*new IconImpl); }
~IconImpl() { }
const Gfx::Bitmap* bitmap_for_size(int) const;

View file

@ -27,11 +27,11 @@ public:
static NonnullRefPtr<ItemListModel> create(const Container& data, const ColumnNamesT& column_names, const Optional<size_t>& row_count = {}) requires(IsTwoDimensional)
{
return adopt(*new ItemListModel<T, Container, ColumnNameListType>(data, column_names, row_count));
return adopt_ref(*new ItemListModel<T, Container, ColumnNameListType>(data, column_names, row_count));
}
static NonnullRefPtr<ItemListModel> create(const Container& data, const Optional<size_t>& row_count = {}) requires(!IsTwoDimensional)
{
return adopt(*new ItemListModel<T, Container>(data, row_count));
return adopt_ref(*new ItemListModel<T, Container>(data, row_count));
}
virtual ~ItemListModel() override { }

View file

@ -41,7 +41,7 @@ public:
static NonnullRefPtr<JsonArrayModel> create(const String& json_path, Vector<FieldSpec>&& fields)
{
return adopt(*new JsonArrayModel(json_path, move(fields)));
return adopt_ref(*new JsonArrayModel(json_path, move(fields)));
}
virtual ~JsonArrayModel() override { }

View file

@ -12,7 +12,7 @@ namespace GUI {
NonnullRefPtr<RunningProcessesModel> RunningProcessesModel::create()
{
return adopt(*new RunningProcessesModel);
return adopt_ref(*new RunningProcessesModel);
}
RunningProcessesModel::RunningProcessesModel()

View file

@ -14,7 +14,7 @@ class SortingProxyModel
: public Model
, private ModelClient {
public:
static NonnullRefPtr<SortingProxyModel> create(NonnullRefPtr<Model> source) { return adopt(*new SortingProxyModel(move(source))); }
static NonnullRefPtr<SortingProxyModel> create(NonnullRefPtr<Model> source) { return adopt_ref(*new SortingProxyModel(move(source))); }
virtual ~SortingProxyModel() override;
virtual int row_count(const ModelIndex& = ModelIndex()) const override;

View file

@ -18,7 +18,7 @@ namespace GUI {
NonnullRefPtr<TextDocument> TextDocument::create(Client* client)
{
return adopt(*new TextDocument(client));
return adopt_ref(*new TextDocument(client));
}
TextDocument::TextDocument(Client* client)