Bug 1539254 - replace MaybeDuration in IPDL with native Maybe syntax; r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D24960

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alex Gaynor 2019-03-26 20:23:07 +00:00
Родитель b49b18f7fb
Коммит 971c3169af
3 изменённых файлов: 6 добавлений и 22 удалений

Просмотреть файл

@ -29,9 +29,7 @@ mozilla::ipc::IPCResult ProfilerChild::RecvStart(
profiler_start(params.entries(), params.interval(), params.features(), profiler_start(params.entries(), params.interval(), params.features(),
filterArray.Elements(), filterArray.Length(), filterArray.Elements(), filterArray.Length(),
params.duration().type() == MaybeDuration::Tnull_t params.duration());
? mozilla::Nothing()
: mozilla::Some(params.duration().get_double()));
return IPC_OK(); return IPC_OK();
} }
@ -45,10 +43,7 @@ mozilla::ipc::IPCResult ProfilerChild::RecvEnsureStarted(
profiler_ensure_started(params.entries(), params.interval(), profiler_ensure_started(params.entries(), params.interval(),
params.features(), filterArray.Elements(), params.features(), filterArray.Elements(),
filterArray.Length(), filterArray.Length(), params.duration());
params.duration().type() == MaybeDuration::Tnull_t
? mozilla::Nothing()
: mozilla::Some(params.duration().get_double()));
return IPC_OK(); return IPC_OK();
} }

Просмотреть файл

@ -138,11 +138,7 @@ void ProfilerParent::Init() {
ProfilerInitParams ipcParams; ProfilerInitParams ipcParams;
ipcParams.enabled() = true; ipcParams.enabled() = true;
ipcParams.entries() = entries; ipcParams.entries() = entries;
if (duration.isSome()) { ipcParams.duration() = duration;
ipcParams.duration() = duration.value();
} else {
ipcParams.duration() = mozilla::null_t();
}
ipcParams.interval() = interval; ipcParams.interval() = interval;
ipcParams.features() = features; ipcParams.features() = features;
@ -188,9 +184,9 @@ void ProfilerParent::ProfilerStarted(nsIProfilerStartParams* aParams) {
aParams->GetEntries(&ipcParams.entries()); aParams->GetEntries(&ipcParams.entries());
aParams->GetDuration(&duration); aParams->GetDuration(&duration);
if (duration > 0.0) { if (duration > 0.0) {
ipcParams.duration() = duration; ipcParams.duration() = Some(duration);
} else { } else {
ipcParams.duration() = mozilla::null_t(); ipcParams.duration() = Nothing();
} }
aParams->GetInterval(&ipcParams.interval()); aParams->GetInterval(&ipcParams.interval());
aParams->GetFeatures(&ipcParams.features()); aParams->GetFeatures(&ipcParams.features());

Просмотреть файл

@ -3,19 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
namespace mozilla { namespace mozilla {
union MaybeDuration {
null_t;
double;
};
struct ProfilerInitParams { struct ProfilerInitParams {
bool enabled; bool enabled;
uint32_t entries; uint32_t entries;
MaybeDuration duration; double? duration;
double interval; double interval;
uint32_t features; uint32_t features;
nsCString[] filters; nsCString[] filters;