mirror of
https://github.com/RGBCube/serenity
synced 2025-08-23 10:17:51 +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:
parent
b3db01e20e
commit
b91c49364d
228 changed files with 461 additions and 461 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
NonnullRefPtr<ClipboardHistoryModel> ClipboardHistoryModel::create()
|
||||
{
|
||||
return adopt(*new ClipboardHistoryModel());
|
||||
return adopt_ref(*new ClipboardHistoryModel());
|
||||
}
|
||||
|
||||
ClipboardHistoryModel::~ClipboardHistoryModel()
|
||||
|
|
|
@ -30,7 +30,7 @@ ConsoleWidget::ConsoleWidget()
|
|||
set_fill_with_background_color(true);
|
||||
|
||||
auto base_document = Web::DOM::Document::create();
|
||||
base_document->append_child(adopt(*new Web::DOM::DocumentType(base_document)));
|
||||
base_document->append_child(adopt_ref(*new Web::DOM::DocumentType(base_document)));
|
||||
auto html_element = base_document->create_element("html");
|
||||
base_document->append_child(html_element);
|
||||
auto head_element = base_document->create_element("head");
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
__Count,
|
||||
};
|
||||
|
||||
static NonnullRefPtr<MonthListModel> create() { return adopt(*new MonthListModel); }
|
||||
static NonnullRefPtr<MonthListModel> create() { return adopt_ref(*new MonthListModel); }
|
||||
virtual ~MonthListModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
|
|
|
@ -118,7 +118,7 @@ NonnullRefPtrVector<LauncherHandler> DirectoryView::get_launch_handlers(const UR
|
|||
{
|
||||
NonnullRefPtrVector<LauncherHandler> handlers;
|
||||
for (auto& h : Desktop::Launcher::get_handlers_with_details_for_url(url)) {
|
||||
handlers.append(adopt(*new LauncherHandler(h)));
|
||||
handlers.append(adopt_ref(*new LauncherHandler(h)));
|
||||
}
|
||||
return handlers;
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@ void FontEditorWidget::initialize(const String& path, RefPtr<Gfx::BitmapFont>&&
|
|||
});
|
||||
|
||||
m_undo_stack = make<GUI::UndoStack>();
|
||||
m_undo_glyph = adopt(*new UndoGlyph(m_glyph_map_widget->selected_glyph(), *m_edited_font));
|
||||
m_undo_glyph = adopt_ref(*new UndoGlyph(m_glyph_map_widget->selected_glyph(), *m_edited_font));
|
||||
did_change_undo_stack();
|
||||
|
||||
if (on_initialize)
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
}
|
||||
RefPtr<UndoGlyph> save_state() const
|
||||
{
|
||||
auto state = adopt(*new UndoGlyph(m_code_point, *m_font));
|
||||
auto state = adopt_ref(*new UndoGlyph(m_code_point, *m_font));
|
||||
auto glyph = font().glyph(m_code_point).glyph_bitmap();
|
||||
for (int x = 0; x < glyph.width(); x++)
|
||||
for (int y = 0; y < glyph.height(); y++)
|
||||
|
|
|
@ -16,7 +16,7 @@ class ManualModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<ManualModel> create()
|
||||
{
|
||||
return adopt(*new ManualModel);
|
||||
return adopt_ref(*new ManualModel);
|
||||
}
|
||||
|
||||
virtual ~ManualModel() override {};
|
||||
|
|
|
@ -25,7 +25,7 @@ IRCChannel::~IRCChannel()
|
|||
|
||||
NonnullRefPtr<IRCChannel> IRCChannel::create(IRCClient& client, const String& name)
|
||||
{
|
||||
return adopt(*new IRCChannel(client, name));
|
||||
return adopt_ref(*new IRCChannel(client, name));
|
||||
}
|
||||
|
||||
void IRCChannel::add_member(const String& name, char prefix)
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
enum Column {
|
||||
Name
|
||||
};
|
||||
static NonnullRefPtr<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); }
|
||||
static NonnullRefPtr<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt_ref(*new IRCChannelMemberListModel(channel)); }
|
||||
virtual ~IRCChannelMemberListModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
|
||||
NonnullRefPtr<IRCLogBuffer> IRCLogBuffer::create()
|
||||
{
|
||||
return adopt(*new IRCLogBuffer);
|
||||
return adopt_ref(*new IRCLogBuffer);
|
||||
}
|
||||
|
||||
IRCLogBuffer::IRCLogBuffer()
|
||||
{
|
||||
m_document = Web::DOM::Document::create();
|
||||
m_document->append_child(adopt(*new Web::DOM::DocumentType(document())));
|
||||
m_document->append_child(adopt_ref(*new Web::DOM::DocumentType(document())));
|
||||
auto html_element = m_document->create_element("html");
|
||||
m_document->append_child(html_element);
|
||||
auto head_element = m_document->create_element("head");
|
||||
html_element->append_child(head_element);
|
||||
auto style_element = m_document->create_element("style");
|
||||
style_element->append_child(adopt(*new Web::DOM::Text(document(), "div { font-family: Csilla; font-weight: lighter; }")));
|
||||
style_element->append_child(adopt_ref(*new Web::DOM::Text(document(), "div { font-family: Csilla; font-weight: lighter; }")));
|
||||
head_element->append_child(style_element);
|
||||
auto body_element = m_document->create_element("body");
|
||||
html_element->append_child(body_element);
|
||||
|
|
|
@ -23,7 +23,7 @@ IRCQuery::~IRCQuery()
|
|||
|
||||
NonnullRefPtr<IRCQuery> IRCQuery::create(IRCClient& client, const String& name)
|
||||
{
|
||||
return adopt(*new IRCQuery(client, name));
|
||||
return adopt_ref(*new IRCQuery(client, name));
|
||||
}
|
||||
|
||||
void IRCQuery::add_message(char prefix, const String& name, const String& text, Color color)
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
Name,
|
||||
};
|
||||
|
||||
static NonnullRefPtr<IRCWindowListModel> create(IRCClient& client) { return adopt(*new IRCWindowListModel(client)); }
|
||||
static NonnullRefPtr<IRCWindowListModel> create(IRCClient& client) { return adopt_ref(*new IRCWindowListModel(client)); }
|
||||
virtual ~IRCWindowListModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
|
|
|
@ -13,7 +13,7 @@ class CharacterMapFileListModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<CharacterMapFileListModel> create(Vector<String>& file_names)
|
||||
{
|
||||
return adopt(*new CharacterMapFileListModel(file_names));
|
||||
return adopt_ref(*new CharacterMapFileListModel(file_names));
|
||||
}
|
||||
|
||||
virtual ~CharacterMapFileListModel() override { }
|
||||
|
|
|
@ -27,7 +27,7 @@ RefPtr<Image> Image::create_with_size(const Gfx::IntSize& size)
|
|||
if (size.width() > 16384 || size.height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt(*new Image(size));
|
||||
return adopt_ref(*new Image(size));
|
||||
}
|
||||
|
||||
Image::Image(const Gfx::IntSize& size)
|
||||
|
|
|
@ -18,7 +18,7 @@ RefPtr<Layer> Layer::create_with_size(Image& image, const Gfx::IntSize& size, co
|
|||
if (size.width() > 16384 || size.height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt(*new Layer(image, size, name));
|
||||
return adopt_ref(*new Layer(image, size, name));
|
||||
}
|
||||
|
||||
RefPtr<Layer> Layer::create_with_bitmap(Image& image, const Gfx::Bitmap& bitmap, const String& name)
|
||||
|
@ -29,7 +29,7 @@ RefPtr<Layer> Layer::create_with_bitmap(Image& image, const Gfx::Bitmap& bitmap,
|
|||
if (bitmap.size().width() > 16384 || bitmap.size().height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt(*new Layer(image, bitmap, name));
|
||||
return adopt_ref(*new Layer(image, bitmap, name));
|
||||
}
|
||||
|
||||
RefPtr<Layer> Layer::create_snapshot(Image& image, const Layer& layer)
|
||||
|
|
|
@ -35,7 +35,7 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window
|
|||
set_layout<GUI::VerticalBoxLayout>();
|
||||
m_splitter = add<GUI::HorizontalSplitter>();
|
||||
m_player_view = m_splitter->add<GUI::Widget>();
|
||||
m_playlist_model = adopt(*new PlaylistModel());
|
||||
m_playlist_model = adopt_ref(*new PlaylistModel());
|
||||
|
||||
m_player_view->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
|
||||
RefPtr<Tree> tree = adopt(*new Tree(""));
|
||||
RefPtr<Tree> tree = adopt_ref(*new Tree(""));
|
||||
|
||||
// Configure application window.
|
||||
auto app_icon = GUI::Icon::default_icon("app-space-analyzer");
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Spreadsheet {
|
|||
|
||||
class HelpListModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<HelpListModel> create() { return adopt(*new HelpListModel); }
|
||||
static NonnullRefPtr<HelpListModel> create() { return adopt_ref(*new HelpListModel); }
|
||||
|
||||
virtual ~HelpListModel() override { }
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
if (s_the)
|
||||
return *s_the;
|
||||
|
||||
return *(s_the = adopt(*new HelpWindow(window)));
|
||||
return *(s_the = adopt_ref(*new HelpWindow(window)));
|
||||
}
|
||||
|
||||
virtual ~HelpWindow() override;
|
||||
|
|
|
@ -359,7 +359,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi
|
|||
|
||||
RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
||||
{
|
||||
auto sheet = adopt(*new Sheet(workbook));
|
||||
auto sheet = adopt_ref(*new Sheet(workbook));
|
||||
auto rows = object.get("rows").to_u32(default_row_count);
|
||||
auto columns = object.get("columns");
|
||||
auto name = object.get("name").as_string_or("Sheet");
|
||||
|
@ -617,7 +617,7 @@ RefPtr<Sheet> Sheet::from_xsv(const Reader::XSV& xsv, Workbook& workbook)
|
|||
auto cols = xsv.headers();
|
||||
auto rows = xsv.size();
|
||||
|
||||
auto sheet = adopt(*new Sheet(workbook));
|
||||
auto sheet = adopt_ref(*new Sheet(workbook));
|
||||
if (xsv.has_explicit_headers()) {
|
||||
sheet->m_columns = cols;
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Spreadsheet {
|
|||
|
||||
class SheetModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<SheetModel> create(Sheet& sheet) { return adopt(*new SheetModel(sheet)); }
|
||||
static NonnullRefPtr<SheetModel> create(Sheet& sheet) { return adopt_ref(*new SheetModel(sheet)); }
|
||||
virtual ~SheetModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->row_count(); }
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
NonnullRefPtr<DevicesModel> DevicesModel::create()
|
||||
{
|
||||
return adopt(*new DevicesModel);
|
||||
return adopt_ref(*new DevicesModel);
|
||||
}
|
||||
|
||||
DevicesModel::DevicesModel()
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
static ProcessModel& the();
|
||||
|
||||
static NonnullRefPtr<ProcessModel> create() { return adopt(*new ProcessModel); }
|
||||
static NonnullRefPtr<ProcessModel> create() { return adopt_ref(*new ProcessModel); }
|
||||
virtual ~ProcessModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
|
|
|
@ -88,7 +88,7 @@ ProcessStateWidget::ProcessStateWidget(pid_t pid)
|
|||
m_table_view = add<GUI::TableView>();
|
||||
m_table_view->column_header().set_visible(false);
|
||||
m_table_view->column_header().set_section_size(0, 90);
|
||||
m_table_view->set_model(adopt(*new ProcessStateModel(ProcessModel::the(), pid)));
|
||||
m_table_view->set_model(adopt_ref(*new ProcessStateModel(ProcessModel::the(), pid)));
|
||||
}
|
||||
|
||||
ProcessStateWidget::~ProcessStateWidget()
|
||||
|
|
|
@ -95,7 +95,7 @@ int main(int argc, char** argv)
|
|||
#undef __ENUMERATE_COLOR_ROLE
|
||||
|
||||
combo_box.set_only_allow_values_from_model(true);
|
||||
combo_box.set_model(adopt(*new ColorRoleModel(color_roles)));
|
||||
combo_box.set_model(adopt_ref(*new ColorRoleModel(color_roles)));
|
||||
combo_box.on_change = [&](auto&, auto& index) {
|
||||
auto role = static_cast<const ColorRoleModel*>(index.model())->color_role(index);
|
||||
color_input.set_color(preview_palette.color(role));
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
class MouseCursorModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<MouseCursorModel> create() { return adopt(*new MouseCursorModel); }
|
||||
static NonnullRefPtr<MouseCursorModel> create() { return adopt_ref(*new MouseCursorModel); }
|
||||
virtual ~MouseCursorModel() override { }
|
||||
|
||||
enum Column {
|
||||
|
@ -86,7 +86,7 @@ private:
|
|||
|
||||
class FileIconsModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<FileIconsModel> create() { return adopt(*new FileIconsModel); }
|
||||
static NonnullRefPtr<FileIconsModel> create() { return adopt_ref(*new FileIconsModel); }
|
||||
virtual ~FileIconsModel() override { }
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -33,7 +33,7 @@ ClassViewWidget::ClassViewWidget()
|
|||
|
||||
RefPtr<ClassViewModel> ClassViewModel::create()
|
||||
{
|
||||
return adopt(*new ClassViewModel());
|
||||
return adopt_ref(*new ClassViewModel());
|
||||
}
|
||||
|
||||
int ClassViewModel::row_count(const GUI::ModelIndex& index) const
|
||||
|
|
|
@ -10,12 +10,12 @@ namespace HackStudio {
|
|||
|
||||
NonnullRefPtr<CodeDocument> CodeDocument::create(const String& file_path, Client* client)
|
||||
{
|
||||
return adopt(*new CodeDocument(file_path, client));
|
||||
return adopt_ref(*new CodeDocument(file_path, client));
|
||||
}
|
||||
|
||||
NonnullRefPtr<CodeDocument> CodeDocument::create(Client* client)
|
||||
{
|
||||
return adopt(*new CodeDocument(client));
|
||||
return adopt_ref(*new CodeDocument(client));
|
||||
}
|
||||
|
||||
CodeDocument::CodeDocument(const String& file_path, Client* client)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace HackStudio {
|
|||
|
||||
NonnullRefPtr<BacktraceModel> BacktraceModel::create(const Debug::DebugSession& debug_session, const PtraceRegisters& regs)
|
||||
{
|
||||
return adopt(*new BacktraceModel(create_backtrace(debug_session, regs)));
|
||||
return adopt_ref(*new BacktraceModel(create_backtrace(debug_session, regs)));
|
||||
}
|
||||
|
||||
GUI::Variant BacktraceModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
|
|
|
@ -30,7 +30,7 @@ class DisassemblyModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<DisassemblyModel> create(const Debug::DebugSession& debug_session, const PtraceRegisters& regs)
|
||||
{
|
||||
return adopt(*new DisassemblyModel(debug_session, regs));
|
||||
return adopt_ref(*new DisassemblyModel(debug_session, regs));
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -22,12 +22,12 @@ class RegistersModel final : public GUI::Model {
|
|||
public:
|
||||
static RefPtr<RegistersModel> create(const PtraceRegisters& regs)
|
||||
{
|
||||
return adopt(*new RegistersModel(regs));
|
||||
return adopt_ref(*new RegistersModel(regs));
|
||||
}
|
||||
|
||||
static RefPtr<RegistersModel> create(const PtraceRegisters& current_regs, const PtraceRegisters& previous_regs)
|
||||
{
|
||||
return adopt(*new RegistersModel(current_regs, previous_regs));
|
||||
return adopt_ref(*new RegistersModel(current_regs, previous_regs));
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -169,7 +169,7 @@ RefPtr<VariablesModel> VariablesModel::create(const PtraceRegisters& regs)
|
|||
if (!lib)
|
||||
return nullptr;
|
||||
auto variables = lib->debug_info->get_variables_in_current_scope(regs);
|
||||
return adopt(*new VariablesModel(move(variables), regs));
|
||||
return adopt_ref(*new VariablesModel(move(variables), regs));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class ProjectTemplatesModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<ProjectTemplatesModel> create()
|
||||
{
|
||||
return adopt(*new ProjectTemplatesModel());
|
||||
return adopt_ref(*new ProjectTemplatesModel());
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -110,7 +110,7 @@ static RefPtr<SearchResultsModel> find_in_files(const StringView& text)
|
|||
}
|
||||
});
|
||||
|
||||
return adopt(*new SearchResultsModel(move(matches)));
|
||||
return adopt_ref(*new SearchResultsModel(move(matches)));
|
||||
}
|
||||
|
||||
FindInFilesWidget::FindInFilesWidget()
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace HackStudio {
|
|||
|
||||
NonnullRefPtr<GitFilesModel> GitFilesModel::create(Vector<LexicalPath>&& files)
|
||||
{
|
||||
return adopt(*new GitFilesModel(move(files)));
|
||||
return adopt_ref(*new GitFilesModel(move(files)));
|
||||
}
|
||||
|
||||
GitFilesModel::GitFilesModel(Vector<LexicalPath>&& files)
|
||||
|
|
|
@ -20,7 +20,7 @@ GitRepo::CreateResult GitRepo::try_to_create(const LexicalPath& repository_root)
|
|||
return { CreateResult::Type::NoGitRepo, nullptr };
|
||||
}
|
||||
|
||||
return { CreateResult::Type::Success, adopt(*new GitRepo(repository_root)) };
|
||||
return { CreateResult::Type::Success, adopt_ref(*new GitRepo(repository_root)) };
|
||||
}
|
||||
|
||||
RefPtr<GitRepo> GitRepo::initialize_repository(const LexicalPath& repository_root)
|
||||
|
@ -30,7 +30,7 @@ RefPtr<GitRepo> GitRepo::initialize_repository(const LexicalPath& repository_roo
|
|||
return {};
|
||||
|
||||
VERIFY(git_repo_exists(repository_root));
|
||||
return adopt(*new GitRepo(repository_root));
|
||||
return adopt_ref(*new GitRepo(repository_root));
|
||||
}
|
||||
|
||||
Vector<LexicalPath> GitRepo::unstaged_files() const
|
||||
|
|
|
@ -26,7 +26,7 @@ RefPtr<GUI::TextDocument> FileDB::get(const String& file_name)
|
|||
auto document = reinterpret_cast<const FileDB*>(this)->get(file_name);
|
||||
if (document.is_null())
|
||||
return nullptr;
|
||||
return adopt(*const_cast<GUI::TextDocument*>(document.leak_ref()));
|
||||
return adopt_ref(*const_cast<GUI::TextDocument*>(document.leak_ref()));
|
||||
}
|
||||
|
||||
RefPtr<const GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& file_name) const
|
||||
|
@ -43,7 +43,7 @@ RefPtr<GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& fi
|
|||
auto document = reinterpret_cast<const FileDB*>(this)->get_or_create_from_filesystem(file_name);
|
||||
if (document.is_null())
|
||||
return nullptr;
|
||||
return adopt(*const_cast<GUI::TextDocument*>(document.leak_ref()));
|
||||
return adopt_ref(*const_cast<GUI::TextDocument*>(document.leak_ref()));
|
||||
}
|
||||
|
||||
bool FileDB::is_open(const String& file_name) const
|
||||
|
|
|
@ -211,7 +211,7 @@ void Locator::update_suggestions()
|
|||
|
||||
bool has_suggestions = !suggestions.is_empty();
|
||||
|
||||
m_suggestion_view->set_model(adopt(*new LocatorSuggestionModel(move(suggestions))));
|
||||
m_suggestion_view->set_model(adopt_ref(*new LocatorSuggestionModel(move(suggestions))));
|
||||
|
||||
if (!has_suggestions)
|
||||
m_suggestion_view->selection().clear();
|
||||
|
|
|
@ -18,7 +18,7 @@ class ProjectFile : public RefCounted<ProjectFile> {
|
|||
public:
|
||||
static NonnullRefPtr<ProjectFile> construct_with_name(const String& name)
|
||||
{
|
||||
return adopt(*new ProjectFile(name));
|
||||
return adopt_ref(*new ProjectFile(name));
|
||||
}
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
|
|
|
@ -62,7 +62,7 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(const String& manife
|
|||
icon = GUI::Icon(move(bitmap32));
|
||||
}
|
||||
|
||||
return adopt(*new ProjectTemplate(id, name, description, icon, priority));
|
||||
return adopt_ref(*new ProjectTemplate(id, name, description, icon, priority));
|
||||
}
|
||||
|
||||
Result<void, String> ProjectTemplate::create_project(const String& name, const String& path)
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace HackStudio {
|
|||
|
||||
class WidgetTreeModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<WidgetTreeModel> create(GUI::Widget& root) { return adopt(*new WidgetTreeModel(root)); }
|
||||
static NonnullRefPtr<WidgetTreeModel> create(GUI::Widget& root) { return adopt_ref(*new WidgetTreeModel(root)); }
|
||||
virtual ~WidgetTreeModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
|
|
|
@ -20,7 +20,7 @@ class RemoteObjectGraphModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<RemoteObjectGraphModel> create(RemoteProcess& process)
|
||||
{
|
||||
return adopt(*new RemoteObjectGraphModel(process));
|
||||
return adopt_ref(*new RemoteObjectGraphModel(process));
|
||||
}
|
||||
|
||||
virtual ~RemoteObjectGraphModel() override;
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
virtual ~RemoteObjectPropertyModel() override { }
|
||||
static NonnullRefPtr<RemoteObjectPropertyModel> create(RemoteObject& object)
|
||||
{
|
||||
return adopt(*new RemoteObjectPropertyModel(object));
|
||||
return adopt_ref(*new RemoteObjectPropertyModel(object));
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -25,7 +25,7 @@ class DisassemblyModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<DisassemblyModel> create(Profile& profile, ProfileNode& node)
|
||||
{
|
||||
return adopt(*new DisassemblyModel(profile, node));
|
||||
return adopt_ref(*new DisassemblyModel(profile, node));
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -14,7 +14,7 @@ class IndividualSampleModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<IndividualSampleModel> create(Profile& profile, size_t event_index)
|
||||
{
|
||||
return adopt(*new IndividualSampleModel(profile, event_index));
|
||||
return adopt_ref(*new IndividualSampleModel(profile, event_index));
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -71,7 +71,7 @@ class ProfileNode : public RefCounted<ProfileNode> {
|
|||
public:
|
||||
static NonnullRefPtr<ProfileNode> create(FlyString object_name, String symbol, u32 address, u32 offset, u64 timestamp, pid_t pid)
|
||||
{
|
||||
return adopt(*new ProfileNode(move(object_name), move(symbol), address, offset, timestamp, pid));
|
||||
return adopt_ref(*new ProfileNode(move(object_name), move(symbol), address, offset, timestamp, pid));
|
||||
}
|
||||
|
||||
// These functions are only relevant for root nodes
|
||||
|
|
|
@ -14,7 +14,7 @@ class ProfileModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<ProfileModel> create(Profile& profile)
|
||||
{
|
||||
return adopt(*new ProfileModel(profile));
|
||||
return adopt_ref(*new ProfileModel(profile));
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -14,7 +14,7 @@ class SamplesModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<SamplesModel> create(Profile& profile)
|
||||
{
|
||||
return adopt(*new SamplesModel(profile));
|
||||
return adopt_ref(*new SamplesModel(profile));
|
||||
}
|
||||
|
||||
enum Column {
|
||||
|
|
|
@ -93,11 +93,11 @@ public:
|
|||
static RefPtr<Buffer> from_pcm_stream(InputMemoryStream& stream, ResampleHelper& resampler, int num_channels, int bits_per_sample, int num_samples);
|
||||
static NonnullRefPtr<Buffer> create_with_samples(Vector<Frame>&& samples)
|
||||
{
|
||||
return adopt(*new Buffer(move(samples)));
|
||||
return adopt_ref(*new Buffer(move(samples)));
|
||||
}
|
||||
static NonnullRefPtr<Buffer> create_with_anonymous_buffer(Core::AnonymousBuffer buffer, i32 buffer_id, int sample_count)
|
||||
{
|
||||
return adopt(*new Buffer(move(buffer), buffer_id, sample_count));
|
||||
return adopt_ref(*new Buffer(move(buffer), buffer_id, sample_count));
|
||||
}
|
||||
|
||||
const Frame* samples() const { return (const Frame*)data(); }
|
||||
|
|
|
@ -39,8 +39,8 @@ public:
|
|||
|
||||
class Loader : public RefCounted<Loader> {
|
||||
public:
|
||||
static NonnullRefPtr<Loader> create(const StringView& path) { return adopt(*new Loader(path)); }
|
||||
static NonnullRefPtr<Loader> create(const ByteBuffer& buffer) { return adopt(*new Loader(buffer)); }
|
||||
static NonnullRefPtr<Loader> create(const StringView& path) { return adopt_ref(*new Loader(path)); }
|
||||
static NonnullRefPtr<Loader> create(const ByteBuffer& buffer) { return adopt_ref(*new Loader(buffer)); }
|
||||
|
||||
bool has_error() const { return m_plugin ? m_plugin->has_error() : true; }
|
||||
const char* error_string() const { return m_plugin ? m_plugin->error_string() : "No loader plugin available"; }
|
||||
|
|
|
@ -61,7 +61,7 @@ RefPtr<AnonymousBufferImpl> AnonymousBufferImpl::create(int fd, size_t size)
|
|||
perror("mmap");
|
||||
return {};
|
||||
}
|
||||
return adopt(*new AnonymousBufferImpl(fd, size, data));
|
||||
return adopt_ref(*new AnonymousBufferImpl(fd, size, data));
|
||||
}
|
||||
|
||||
AnonymousBufferImpl::~AnonymousBufferImpl()
|
||||
|
|
|
@ -20,25 +20,25 @@ NonnullRefPtr<ConfigFile> ConfigFile::get_for_lib(const String& lib_name)
|
|||
String directory = StandardPaths::config_directory();
|
||||
auto path = String::formatted("{}/lib/{}.ini", directory, lib_name);
|
||||
|
||||
return adopt(*new ConfigFile(path));
|
||||
return adopt_ref(*new ConfigFile(path));
|
||||
}
|
||||
|
||||
NonnullRefPtr<ConfigFile> ConfigFile::get_for_app(const String& app_name)
|
||||
{
|
||||
String directory = StandardPaths::config_directory();
|
||||
auto path = String::formatted("{}/{}.ini", directory, app_name);
|
||||
return adopt(*new ConfigFile(path));
|
||||
return adopt_ref(*new ConfigFile(path));
|
||||
}
|
||||
|
||||
NonnullRefPtr<ConfigFile> ConfigFile::get_for_system(const String& app_name)
|
||||
{
|
||||
auto path = String::formatted("/etc/{}.ini", app_name);
|
||||
return adopt(*new ConfigFile(path));
|
||||
return adopt_ref(*new ConfigFile(path));
|
||||
}
|
||||
|
||||
NonnullRefPtr<ConfigFile> ConfigFile::open(const String& path)
|
||||
{
|
||||
return adopt(*new ConfigFile(path));
|
||||
return adopt_ref(*new ConfigFile(path));
|
||||
}
|
||||
|
||||
ConfigFile::ConfigFile(const String& file_name)
|
||||
|
|
|
@ -525,7 +525,7 @@ int EventLoop::register_signal(int signo, Function<void(int)> handler)
|
|||
auto& info = *signals_info();
|
||||
auto handlers = info.signal_handlers.find(signo);
|
||||
if (handlers == info.signal_handlers.end()) {
|
||||
auto signal_handlers = adopt(*new SignalHandlers(signo, EventLoop::handle_signal));
|
||||
auto signal_handlers = adopt_ref(*new SignalHandlers(signo, EventLoop::handle_signal));
|
||||
auto handler_id = signal_handlers->add(move(handler));
|
||||
info.signal_handlers.set(signo, move(signal_handlers));
|
||||
return handler_id;
|
||||
|
|
|
@ -103,7 +103,7 @@ Result<NonnullRefPtr<FileWatcher>, String> FileWatcher::watch(const String& path
|
|||
|
||||
dbgln_if(FILE_WATCHER_DEBUG, "Started watcher for file '{}'", path.characters());
|
||||
auto notifier = Notifier::construct(watch_fd, Notifier::Event::Read);
|
||||
return adopt(*new FileWatcher(move(notifier), move(path)));
|
||||
return adopt_ref(*new FileWatcher(move(notifier), move(path)));
|
||||
}
|
||||
|
||||
FileWatcher::FileWatcher(NonnullRefPtr<Notifier> notifier, const String& path)
|
||||
|
|
|
@ -32,7 +32,7 @@ public: \
|
|||
template<class... Args> \
|
||||
static inline NonnullRefPtr<klass> construct(Args&&... args) \
|
||||
{ \
|
||||
return adopt(*new klass(forward<Args>(args)...)); \
|
||||
return adopt_ref(*new klass(forward<Args>(args)...)); \
|
||||
}
|
||||
|
||||
#define C_OBJECT_ABSTRACT(klass) \
|
||||
|
|
|
@ -17,13 +17,13 @@ class Timer final : public Object {
|
|||
public:
|
||||
static NonnullRefPtr<Timer> create_repeating(int interval, Function<void()>&& timeout_handler, Object* parent = nullptr)
|
||||
{
|
||||
auto timer = adopt(*new Timer(interval, move(timeout_handler), parent));
|
||||
auto timer = adopt_ref(*new Timer(interval, move(timeout_handler), parent));
|
||||
timer->stop();
|
||||
return timer;
|
||||
}
|
||||
static NonnullRefPtr<Timer> create_single_shot(int interval, Function<void()>&& timeout_handler, Object* parent = nullptr)
|
||||
{
|
||||
auto timer = adopt(*new Timer(interval, move(timeout_handler), parent));
|
||||
auto timer = adopt_ref(*new Timer(interval, move(timeout_handler), parent));
|
||||
timer->set_single_shot(true);
|
||||
timer->stop();
|
||||
return timer;
|
||||
|
|
|
@ -139,7 +139,7 @@ private:
|
|||
NonnullRefPtr<T>
|
||||
create_ast_node(ASTNode& parent, const Position& start, Optional<Position> end, Args&&... args)
|
||||
{
|
||||
auto node = adopt(*new T(&parent, start, end, m_filename, forward<Args>(args)...));
|
||||
auto node = adopt_ref(*new T(&parent, start, end, m_filename, forward<Args>(args)...));
|
||||
if (!parent.is_dummy_node()) {
|
||||
m_state.nodes.append(node);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ private:
|
|||
NonnullRefPtr<TranslationUnit>
|
||||
create_root_ast_node(const Position& start, Position end)
|
||||
{
|
||||
auto node = adopt(*new TranslationUnit(nullptr, start, end, m_filename));
|
||||
auto node = adopt_ref(*new TranslationUnit(nullptr, start, end, m_filename));
|
||||
m_state.nodes.append(node);
|
||||
m_root_node = node;
|
||||
return node;
|
||||
|
@ -157,7 +157,7 @@ private:
|
|||
|
||||
DummyAstNode& get_dummy_node()
|
||||
{
|
||||
static NonnullRefPtr<DummyAstNode> dummy = adopt(*new DummyAstNode(nullptr, {}, {}, {}));
|
||||
static NonnullRefPtr<DummyAstNode> dummy = adopt_ref(*new DummyAstNode(nullptr, {}, {}, {}));
|
||||
return dummy;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ NonnullRefPtr<AppFile> AppFile::get_for_app(const StringView& app_name)
|
|||
|
||||
NonnullRefPtr<AppFile> AppFile::open(const StringView& path)
|
||||
{
|
||||
return adopt(*new AppFile(path));
|
||||
return adopt_ref(*new AppFile(path));
|
||||
}
|
||||
|
||||
void AppFile::for_each(Function<void(NonnullRefPtr<AppFile>)> callback, const StringView& directory)
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Desktop {
|
|||
|
||||
auto Launcher::Details::from_details_str(const String& details_str) -> NonnullRefPtr<Details>
|
||||
{
|
||||
auto details = adopt(*new Details);
|
||||
auto details = adopt_ref(*new Details);
|
||||
auto json = JsonValue::from_string(details_str);
|
||||
VERIFY(json.has_value());
|
||||
auto obj = json.value().as_object();
|
||||
|
|
|
@ -54,7 +54,7 @@ RefPtr<DynamicLoader> DynamicLoader::try_create(int fd, String filename)
|
|||
return {};
|
||||
}
|
||||
|
||||
return adopt(*new DynamicLoader(fd, move(filename), data, size));
|
||||
return adopt_ref(*new DynamicLoader(fd, move(filename), data, size));
|
||||
}
|
||||
|
||||
DynamicLoader::DynamicLoader(int fd, String filename, void* data, size_t size)
|
||||
|
|
|
@ -444,7 +444,7 @@ auto DynamicObject::lookup_symbol(const StringView& name, u32 gnu_hash, u32 sysv
|
|||
|
||||
NonnullRefPtr<DynamicObject> DynamicObject::create(const String& filename, VirtualAddress base_address, VirtualAddress dynamic_section_address)
|
||||
{
|
||||
return adopt(*new DynamicObject(filename, base_address, dynamic_section_address));
|
||||
return adopt_ref(*new DynamicObject(filename, base_address, dynamic_section_address));
|
||||
}
|
||||
|
||||
// offset is in PLT relocation table
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace GUI {
|
|||
|
||||
NonnullRefPtr<RunningProcessesModel> RunningProcessesModel::create()
|
||||
{
|
||||
return adopt(*new RunningProcessesModel);
|
||||
return adopt_ref(*new RunningProcessesModel);
|
||||
}
|
||||
|
||||
RunningProcessesModel::RunningProcessesModel()
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -30,7 +30,7 @@ String Document::render_to_html() const
|
|||
|
||||
NonnullRefPtr<Document> Document::parse(const StringView& lines, const URL& url)
|
||||
{
|
||||
auto document = adopt(*new Document(url));
|
||||
auto document = adopt_ref(*new Document(url));
|
||||
document->read_lines(lines);
|
||||
return document;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
virtual ~GeminiResponse() override;
|
||||
static NonnullRefPtr<GeminiResponse> create(int status, String meta)
|
||||
{
|
||||
return adopt(*new GeminiResponse(status, meta));
|
||||
return adopt_ref(*new GeminiResponse(status, meta));
|
||||
}
|
||||
|
||||
int status() const { return m_status; }
|
||||
|
|
|
@ -73,7 +73,7 @@ RefPtr<Bitmap> Bitmap::create(BitmapFormat format, const IntSize& size, int scal
|
|||
auto backing_store = Bitmap::allocate_backing_store(format, size, scale_factor, Purgeable::No);
|
||||
if (!backing_store.has_value())
|
||||
return nullptr;
|
||||
return adopt(*new Bitmap(format, size, scale_factor, Purgeable::No, backing_store.value()));
|
||||
return adopt_ref(*new Bitmap(format, size, scale_factor, Purgeable::No, backing_store.value()));
|
||||
}
|
||||
|
||||
RefPtr<Bitmap> Bitmap::create_purgeable(BitmapFormat format, const IntSize& size, int scale_factor)
|
||||
|
@ -81,7 +81,7 @@ RefPtr<Bitmap> Bitmap::create_purgeable(BitmapFormat format, const IntSize& size
|
|||
auto backing_store = Bitmap::allocate_backing_store(format, size, scale_factor, Purgeable::Yes);
|
||||
if (!backing_store.has_value())
|
||||
return nullptr;
|
||||
return adopt(*new Bitmap(format, size, scale_factor, Purgeable::Yes, backing_store.value()));
|
||||
return adopt_ref(*new Bitmap(format, size, scale_factor, Purgeable::Yes, backing_store.value()));
|
||||
}
|
||||
|
||||
#ifdef __serenity__
|
||||
|
@ -120,7 +120,7 @@ RefPtr<Bitmap> Bitmap::create_wrapper(BitmapFormat format, const IntSize& size,
|
|||
{
|
||||
if (size_would_overflow(format, size, scale_factor))
|
||||
return nullptr;
|
||||
return adopt(*new Bitmap(format, size, scale_factor, pitch, data));
|
||||
return adopt_ref(*new Bitmap(format, size, scale_factor, pitch, data));
|
||||
}
|
||||
|
||||
RefPtr<Bitmap> Bitmap::load_from_file(String const& path, int scale_factor)
|
||||
|
@ -219,7 +219,7 @@ RefPtr<Bitmap> Bitmap::create_with_anon_fd(BitmapFormat format, int anon_fd, con
|
|||
}
|
||||
}
|
||||
|
||||
return adopt(*new Bitmap(format, anon_fd, size, scale_factor, data, palette));
|
||||
return adopt_ref(*new Bitmap(format, anon_fd, size, scale_factor, data, palette));
|
||||
}
|
||||
|
||||
/// Read a bitmap as described by:
|
||||
|
|
|
@ -44,7 +44,7 @@ NonnullRefPtr<Font> BitmapFont::clone() const
|
|||
memcpy(new_rows, m_rows, bytes_per_glyph * m_glyph_count);
|
||||
auto* new_widths = static_cast<u8*>(malloc(m_glyph_count));
|
||||
memcpy(new_widths, m_glyph_widths, m_glyph_count);
|
||||
return adopt(*new BitmapFont(m_name, m_family, new_rows, new_widths, m_fixed_width, m_glyph_width, m_glyph_height, m_glyph_spacing, m_type, m_baseline, m_mean_line, m_presentation_size, m_weight, true));
|
||||
return adopt_ref(*new BitmapFont(m_name, m_family, new_rows, new_widths, m_fixed_width, m_glyph_width, m_glyph_height, m_glyph_spacing, m_type, m_baseline, m_mean_line, m_presentation_size, m_weight, true));
|
||||
}
|
||||
|
||||
NonnullRefPtr<BitmapFont> BitmapFont::create(u8 glyph_height, u8 glyph_width, bool fixed, FontTypes type)
|
||||
|
@ -55,7 +55,7 @@ NonnullRefPtr<BitmapFont> BitmapFont::create(u8 glyph_height, u8 glyph_width, bo
|
|||
memset(new_rows, 0, bytes_per_glyph * count);
|
||||
auto* new_widths = static_cast<u8*>(malloc(count));
|
||||
memset(new_widths, 0, count);
|
||||
return adopt(*new BitmapFont("Untitled", "Untitled", new_rows, new_widths, fixed, glyph_width, glyph_height, 1, type, 0, 0, 0, 400, true));
|
||||
return adopt_ref(*new BitmapFont("Untitled", "Untitled", new_rows, new_widths, fixed, glyph_width, glyph_height, 1, type, 0, 0, 0, 400, true));
|
||||
}
|
||||
|
||||
BitmapFont::BitmapFont(String name, String family, unsigned* rows, u8* widths, bool is_fixed_width, u8 glyph_width, u8 glyph_height, u8 glyph_spacing, FontTypes type, u8 baseline, u8 mean_line, u8 presentation_size, u16 weight, bool owns_arrays)
|
||||
|
@ -137,7 +137,7 @@ RefPtr<BitmapFont> BitmapFont::load_from_memory(const u8* data)
|
|||
|
||||
auto* rows = const_cast<unsigned*>((const unsigned*)(data + sizeof(FontFileHeader)));
|
||||
u8* widths = (u8*)(rows) + count * bytes_per_glyph;
|
||||
return adopt(*new BitmapFont(String(header.name), String(header.family), rows, widths, !header.is_variable_width, header.glyph_width, header.glyph_height, header.glyph_spacing, type, header.baseline, header.mean_line, header.presentation_size, header.weight));
|
||||
return adopt_ref(*new BitmapFont(String(header.name), String(header.family), rows, widths, !header.is_variable_width, header.glyph_width, header.glyph_height, header.glyph_spacing, type, header.baseline, header.mean_line, header.presentation_size, header.weight));
|
||||
}
|
||||
|
||||
size_t BitmapFont::glyph_count_by_type(FontTypes type)
|
||||
|
|
|
@ -20,7 +20,7 @@ CharacterBitmap::~CharacterBitmap()
|
|||
|
||||
NonnullRefPtr<CharacterBitmap> CharacterBitmap::create_from_ascii(const char* asciiData, unsigned width, unsigned height)
|
||||
{
|
||||
return adopt(*new CharacterBitmap(asciiData, width, height));
|
||||
return adopt_ref(*new CharacterBitmap(asciiData, width, height));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ RefPtr<Typeface> FontDatabase::get_or_create_typeface(const String& family, cons
|
|||
if (typeface->family() == family && typeface->variant() == variant)
|
||||
return typeface;
|
||||
}
|
||||
auto typeface = adopt(*new Typeface(family, variant));
|
||||
auto typeface = adopt_ref(*new Typeface(family, variant));
|
||||
m_private->typefaces.append(typeface);
|
||||
return typeface;
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ protected:
|
|||
|
||||
class ImageDecoder : public RefCounted<ImageDecoder> {
|
||||
public:
|
||||
static NonnullRefPtr<ImageDecoder> create(const u8* data, size_t size) { return adopt(*new ImageDecoder(data, size)); }
|
||||
static NonnullRefPtr<ImageDecoder> create(const ByteBuffer& data) { return adopt(*new ImageDecoder(data.data(), data.size())); }
|
||||
static NonnullRefPtr<ImageDecoder> create(const u8* data, size_t size) { return adopt_ref(*new ImageDecoder(data, size)); }
|
||||
static NonnullRefPtr<ImageDecoder> create(const ByteBuffer& data) { return adopt_ref(*new ImageDecoder(data.data(), data.size())); }
|
||||
~ImageDecoder();
|
||||
|
||||
bool is_valid() const { return m_plugin; }
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Gfx {
|
|||
|
||||
NonnullRefPtr<PaletteImpl> PaletteImpl::create_with_anonymous_buffer(Core::AnonymousBuffer buffer)
|
||||
{
|
||||
return adopt(*new PaletteImpl(move(buffer)));
|
||||
return adopt_ref(*new PaletteImpl(move(buffer)));
|
||||
}
|
||||
|
||||
PaletteImpl::PaletteImpl(Core::AnonymousBuffer buffer)
|
||||
|
@ -45,7 +45,7 @@ NonnullRefPtr<PaletteImpl> PaletteImpl::clone() const
|
|||
{
|
||||
auto new_theme_buffer = Core::AnonymousBuffer::create_with_size(m_theme_buffer.size());
|
||||
memcpy(new_theme_buffer.data<SystemTheme>(), &theme(), m_theme_buffer.size());
|
||||
return adopt(*new PaletteImpl(move(new_theme_buffer)));
|
||||
return adopt_ref(*new PaletteImpl(move(new_theme_buffer)));
|
||||
}
|
||||
|
||||
void Palette::set_color(ColorRole role, Color color)
|
||||
|
|
|
@ -197,7 +197,7 @@ private:
|
|||
template<typename T, typename... Args>
|
||||
void append_segment(Args&&... args)
|
||||
{
|
||||
m_segments.append(adopt(*new T(forward<Args>(args)...)));
|
||||
m_segments.append(adopt_ref(*new T(forward<Args>(args)...)));
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Segment> m_segments {};
|
||||
|
|
|
@ -46,7 +46,7 @@ RefPtr<Font> Typeface::get_font(unsigned size)
|
|||
}
|
||||
|
||||
if (m_ttf_font)
|
||||
return adopt(*new TTF::ScaledFont(*m_ttf_font, size, size));
|
||||
return adopt_ref(*new TTF::ScaledFont(*m_ttf_font, size, size));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
virtual ~HttpResponse() override;
|
||||
static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String, CaseInsensitiveStringTraits>&& headers)
|
||||
{
|
||||
return adopt(*new HttpResponse(code, move(headers)));
|
||||
return adopt_ref(*new HttpResponse(code, move(headers)));
|
||||
}
|
||||
|
||||
int code() const { return m_code; }
|
||||
|
|
|
@ -27,7 +27,7 @@ template<class T, class... Args>
|
|||
static inline NonnullRefPtr<T>
|
||||
create_ast_node(SourceRange range, Args&&... args)
|
||||
{
|
||||
return adopt(*new T(range, forward<Args>(args)...));
|
||||
return adopt_ref(*new T(range, forward<Args>(args)...));
|
||||
}
|
||||
|
||||
class ASTNode : public RefCounted<ASTNode> {
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
|
||||
static Handle create(T* cell)
|
||||
{
|
||||
return Handle(adopt(*new HandleImpl(cell)));
|
||||
return Handle(adopt_ref(*new HandleImpl(cell)));
|
||||
}
|
||||
|
||||
T* cell() { return static_cast<T*>(m_impl->cell()); }
|
||||
|
|
|
@ -228,7 +228,7 @@ NonnullRefPtr<Program> Parser::parse_program()
|
|||
{
|
||||
auto rule_start = push_start();
|
||||
ScopePusher scope(*this, ScopePusher::Var | ScopePusher::Let | ScopePusher::Function);
|
||||
auto program = adopt(*new Program({ m_filename, rule_start.position(), position() }));
|
||||
auto program = adopt_ref(*new Program({ m_filename, rule_start.position(), position() }));
|
||||
|
||||
bool first = true;
|
||||
while (!done()) {
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace JS {
|
|||
|
||||
NonnullRefPtr<VM> VM::create()
|
||||
{
|
||||
return adopt(*new VM);
|
||||
return adopt_ref(*new VM);
|
||||
}
|
||||
|
||||
VM::VM()
|
||||
|
|
|
@ -17,7 +17,7 @@ RefPtr<Database> Database::open(const String& file_name)
|
|||
auto file_or_error = MappedFile::map(file_name);
|
||||
if (file_or_error.is_error())
|
||||
return nullptr;
|
||||
auto res = adopt(*new Database(file_or_error.release_value()));
|
||||
auto res = adopt_ref(*new Database(file_or_error.release_value()));
|
||||
if (res->init() != 0)
|
||||
return nullptr;
|
||||
return res;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<Download> create_from_id(Badge<Client>, Client& client, i32 download_id)
|
||||
{
|
||||
return adopt(*new Download(client, download_id));
|
||||
return adopt_ref(*new Download(client, download_id));
|
||||
}
|
||||
|
||||
int id() const { return m_download_id; }
|
||||
|
|
|
@ -20,7 +20,7 @@ template<class T, class... Args>
|
|||
static inline NonnullRefPtr<T>
|
||||
create_ast_node(Args&&... args)
|
||||
{
|
||||
return adopt(*new T(forward<Args>(args)...));
|
||||
return adopt_ref(*new T(forward<Args>(args)...));
|
||||
}
|
||||
|
||||
class ASTNode : public RefCounted<ASTNode> {
|
||||
|
|
|
@ -389,7 +389,7 @@ RefPtr<Font> Font::load_from_offset(ByteBuffer&& buffer, u32 offset)
|
|||
}
|
||||
}
|
||||
|
||||
return adopt(*new Font(move(buffer), move(head), move(name), move(hhea), move(maxp), move(hmtx), move(cmap), move(loca), move(glyf)));
|
||||
return adopt_ref(*new Font(move(buffer), move(head), move(name), move(hhea), move(maxp), move(hmtx), move(cmap), move(loca), move(glyf)));
|
||||
}
|
||||
|
||||
ScaledFontMetrics Font::metrics(float x_scale, float y_scale) const
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
Function<Result()> action,
|
||||
Function<void(Result)> on_complete = nullptr)
|
||||
{
|
||||
return adopt(*new BackgroundAction(move(action), move(on_complete)));
|
||||
return adopt_ref(*new BackgroundAction(move(action), move(on_complete)));
|
||||
}
|
||||
|
||||
virtual ~BackgroundAction() { }
|
||||
|
|
|
@ -18,7 +18,7 @@ class CSSImportRule : public CSSRule {
|
|||
public:
|
||||
static NonnullRefPtr<CSSImportRule> create(URL url)
|
||||
{
|
||||
return adopt(*new CSSImportRule(move(url)));
|
||||
return adopt_ref(*new CSSImportRule(move(url)));
|
||||
}
|
||||
|
||||
~CSSImportRule();
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<CSSStyleDeclaration> create(Vector<StyleProperty>&& properties)
|
||||
{
|
||||
return adopt(*new CSSStyleDeclaration(move(properties)));
|
||||
return adopt_ref(*new CSSStyleDeclaration(move(properties)));
|
||||
}
|
||||
|
||||
virtual ~CSSStyleDeclaration();
|
||||
|
@ -48,7 +48,7 @@ private:
|
|||
|
||||
class ElementInlineCSSStyleDeclaration final : public CSSStyleDeclaration {
|
||||
public:
|
||||
static NonnullRefPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element& element) { return adopt(*new ElementInlineCSSStyleDeclaration(element)); }
|
||||
static NonnullRefPtr<ElementInlineCSSStyleDeclaration> create(DOM::Element& element) { return adopt_ref(*new ElementInlineCSSStyleDeclaration(element)); }
|
||||
virtual ~ElementInlineCSSStyleDeclaration() override;
|
||||
|
||||
DOM::Element* element() { return m_element.ptr(); }
|
||||
|
|
|
@ -21,7 +21,7 @@ class CSSStyleRule : public CSSRule {
|
|||
public:
|
||||
static NonnullRefPtr<CSSStyleRule> create(Vector<Selector>&& selectors, NonnullRefPtr<CSSStyleDeclaration>&& declaration)
|
||||
{
|
||||
return adopt(*new CSSStyleRule(move(selectors), move(declaration)));
|
||||
return adopt_ref(*new CSSStyleRule(move(selectors), move(declaration)));
|
||||
}
|
||||
|
||||
~CSSStyleRule();
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<CSSStyleSheet> create(NonnullRefPtrVector<CSSRule> rules)
|
||||
{
|
||||
return adopt(*new CSSStyleSheet(move(rules)));
|
||||
return adopt_ref(*new CSSStyleSheet(move(rules)));
|
||||
}
|
||||
|
||||
virtual ~CSSStyleSheet() override;
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<Screen> create(DOM::Window& window)
|
||||
{
|
||||
return adopt(*new Screen(window));
|
||||
return adopt_ref(*new Screen(window));
|
||||
}
|
||||
|
||||
i32 width() const { return screen_rect().width(); }
|
||||
|
|
|
@ -28,7 +28,7 @@ StyleProperties::StyleProperties(const StyleProperties& other)
|
|||
|
||||
NonnullRefPtr<StyleProperties> StyleProperties::clone() const
|
||||
{
|
||||
return adopt(*new StyleProperties(*this));
|
||||
return adopt_ref(*new StyleProperties(*this));
|
||||
}
|
||||
|
||||
void StyleProperties::set_property(CSS::PropertyID id, NonnullRefPtr<StyleValue> value)
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
|
||||
explicit StyleProperties(const StyleProperties&);
|
||||
|
||||
static NonnullRefPtr<StyleProperties> create() { return adopt(*new StyleProperties); }
|
||||
static NonnullRefPtr<StyleProperties> create() { return adopt_ref(*new StyleProperties); }
|
||||
|
||||
NonnullRefPtr<StyleProperties> clone() const;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue