| Summary: | Use `Seconds` as the underlying value for `MonotonicTime`/`WallTime`/etc. | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Devin Rousso <hi> | ||||||||||
| Component: | New Bugs | Assignee: | Devin Rousso <hi> | ||||||||||
| Status: | NEW --- | ||||||||||||
| Severity: | Normal | CC: | alecflett, beidson, benjamin, berto, calvaris, cdumez, cgarcia, changseok, cmarcelo, eric.carlson, esprehn+autocc, ews-watchlist, fpizlo, galpeter, glenn, gustavo, gyuyoung.kim, hi, japhet, jer.noble, jsbell, mifenton, mmaxfield, philipj, pnormand, sergio, vjaquez, webkit-bug-importer, ysuzuki | ||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||
| Version: | WebKit Nightly Build | ||||||||||||
| Hardware: | Unspecified | ||||||||||||
| OS: | Unspecified | ||||||||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=233781 | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Devin Rousso
2021-12-02 18:12:49 PST
Created attachment 445799 [details]
Patch
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API Created attachment 445874 [details]
Patch
Created attachment 446263 [details]
Patch
Created attachment 446265 [details]
Patch
Comment on attachment 446265 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446265&action=review Phil should probably be the one to review this. > Source/WTF/wtf/ApproximateTime.cpp:49 > - out.print("Approximate(", m_value, " sec)"); > + out.print("Approximate("); > + secondsSinceEpoch().dump(out); > + out.print(")"); Can't we add the necessary facilities to make this change not necessary? > Source/WTF/wtf/CurrentTime.cpp:251 > - return fromRawSeconds(currentTime()); > + return WallTime(Seconds(currentTime())); Is it really necessary to make fromRawSeconds() no longer work? > Source/WTF/wtf/CurrentTime.cpp:277 > - return static_cast<uint64_t>((m_value * 1.0e9 * info.denom) / info.numer); > + return static_cast<uint64_t>((secondsSinceEpoch().value() * 1.0e9 * info.denom) / info.numer); Is this really better? Comment on attachment 446265 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=446265&action=review I think that my main worry about this change is that I'm not super sure what it improves? But, I think it's OK, if you make the changes I suggest. >> Source/WTF/wtf/ApproximateTime.cpp:49 >> + out.print(")"); > > Can't we add the necessary facilities to make this change not necessary? Why can't you just say: out.print("Approximate(", secondsSinceEpoch(), ")")? > Source/WTF/wtf/MonotonicTime.h:51 > + explicit constexpr MonotonicTime(Seconds seconds) > + : GenericTimeMixin<MonotonicTime>(seconds) > + { > + } > + Why isn't this called "fromSecondsSinceEpoch()" rather than making it a constructor? > Source/WTF/wtf/TimeWithDynamicClockType.cpp:136 > + out.print("("); > + m_seconds.dump(out); > + out.print(")"); Why isn't this just out.print("(", m_seconds, ")")? > Source/WTF/wtf/WallTime.cpp:44 > + out.print("Wall("); > + secondsSinceEpoch().dump(out); > + out.print(")"); > } Ditto. > Source/WTF/wtf/WallTime.h:52 > + explicit constexpr WallTime(Seconds seconds) > + : GenericTimeMixin<WallTime>(seconds) > + { > + } > + Ditto - I'd much rather force people to say WallTime::fromSecondsSinceEpoch(...) than WallTime(...). > Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:2816 > - auto dateToInsert = OperatingDate::fromWallTime(WallTime::fromRawSeconds(daysAgoInSeconds)); > + auto dateToInsert = OperatingDate::fromWallTime(WallTime(Seconds(daysAgoInSeconds))); Seems like it would be great to still be able to say fromRawSeconds. > Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.h:186 > - virtual void setLastSeen(const RegistrableDomain& primaryDomain, Seconds) = 0; > + virtual void setLastSeen(const RegistrableDomain& primaryDomain, WallTime) = 0; Are changes like this really related to this change? |