* [PATCH] Simplify the ui-out progress API
@ 2022-03-04 19:30 Tom Tromey
2022-03-07 17:50 ` Aaron Merey
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2022-03-04 19:30 UTC (permalink / raw)
To: gdb-patches; +Cc: Aaron Merey, Tom Tromey
I noticed that 'progress' is a method on ui-out, but it seems to me
that it would be better if the only API were via the progress_meter
class. This patch makes this change, changing progress to be a method
on the meter itself.
---
gdb/debuginfod-support.c | 2 +-
gdb/ui-out.h | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c
index 56d8e7781c5..deb1c24d5ed 100644
--- a/gdb/debuginfod-support.c
+++ b/gdb/debuginfod-support.c
@@ -129,7 +129,7 @@ progressfn (debuginfod_client *c, long cur, long total)
data->meter.emplace (current_uiout, message, 1);
}
- current_uiout->progress ((double)cur / (double)total);
+ data->meter->progress ((double)cur / (double)total);
return 0;
}
diff --git a/gdb/ui-out.h b/gdb/ui-out.h
index 60dd6fc2d37..cd36211be1f 100644
--- a/gdb/ui-out.h
+++ b/gdb/ui-out.h
@@ -301,18 +301,18 @@ class ui_out
progress_meter (const progress_meter &) = delete;
progress_meter &operator= (const progress_meter &) = delete;
+ /* Emit some progress for this progress meter. HOWMUCH may range
+ from 0.0 to 1.0. */
+ void progress (double howmuch)
+ {
+ m_uiout->do_progress_notify (howmuch);
+ }
+
private:
struct ui_out *m_uiout;
};
- /* Emit some progress corresponding to the most recently created
- progress meter. HOWMUCH may range from 0.0 to 1.0. */
- void progress (double howmuch)
- {
- do_progress_notify (howmuch);
- }
-
protected:
virtual void do_table_begin (int nbrofcols, int nr_rows, const char *tblid)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Simplify the ui-out progress API
2022-03-04 19:30 [PATCH] Simplify the ui-out progress API Tom Tromey
@ 2022-03-07 17:50 ` Aaron Merey
2022-03-10 17:11 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Aaron Merey @ 2022-03-07 17:50 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
Hi Tom,
On Fri, Mar 4, 2022 at 2:30 PM Tom Tromey <tromey@adacore.com> wrote:
> I noticed that 'progress' is a method on ui-out, but it seems to me
> that it would be better if the only API were via the progress_meter
> class. This patch makes this change, changing progress to be a method
> on the meter itself.
LGTM. I agree that it's better to use progress_meter for this API. This
change should be fine even if we were to implement progress handling
in a ui_out derived class.
Aaron
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Simplify the ui-out progress API
2022-03-07 17:50 ` Aaron Merey
@ 2022-03-10 17:11 ` Tom Tromey
0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2022-03-10 17:11 UTC (permalink / raw)
To: Aaron Merey; +Cc: Tom Tromey, gdb-patches
>>>>> "Aaron" == Aaron Merey <amerey@redhat.com> writes:
Aaron> Hi Tom,
Aaron> On Fri, Mar 4, 2022 at 2:30 PM Tom Tromey <tromey@adacore.com> wrote:
>> I noticed that 'progress' is a method on ui-out, but it seems to me
>> that it would be better if the only API were via the progress_meter
>> class. This patch makes this change, changing progress to be a method
>> on the meter itself.
Aaron> LGTM. I agree that it's better to use progress_meter for this API. This
Aaron> change should be fine even if we were to implement progress handling
Aaron> in a ui_out derived class.
Thanks. I'm going to check this in now.
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-10 17:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 19:30 [PATCH] Simplify the ui-out progress API Tom Tromey
2022-03-07 17:50 ` Aaron Merey
2022-03-10 17:11 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).