// Copyright © 2020 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
namespace CefSharp.DevTools.Performance
{
using System.Linq;
///
/// Performance
///
public partial class Performance : DevToolsDomainBase
{
private CefSharp.DevTools.IDevToolsClient _client;
public Performance(CefSharp.DevTools.IDevToolsClient client)
{
_client = (client);
}
///
/// Disable collecting and reporting metrics.
///
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task DisableAsync()
{
System.Collections.Generic.Dictionary dict = null;
var methodResult = await _client.ExecuteDevToolsMethodAsync("Performance.disable", dict);
return methodResult;
}
partial void ValidateEnable(string timeDomain = null);
///
/// Enable collecting and reporting metrics.
///
/// Time domain to use for collecting and reporting duration metrics.
/// returns System.Threading.Tasks.Task<DevToolsMethodResponse>
public async System.Threading.Tasks.Task EnableAsync(string timeDomain = null)
{
ValidateEnable(timeDomain);
var dict = new System.Collections.Generic.Dictionary();
if (!(string.IsNullOrEmpty(timeDomain)))
{
dict.Add("timeDomain", timeDomain);
}
var methodResult = await _client.ExecuteDevToolsMethodAsync("Performance.enable", dict);
return methodResult;
}
///
/// Retrieve current values of run-time metrics.
///
/// returns System.Threading.Tasks.Task<GetMetricsResponse>
public async System.Threading.Tasks.Task GetMetricsAsync()
{
System.Collections.Generic.Dictionary dict = null;
var methodResult = await _client.ExecuteDevToolsMethodAsync("Performance.getMetrics", dict);
return methodResult.DeserializeJson();
}
}
}