#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/inspector/inspector_performance_agent.h"
#include <utility>
#include "base/process/process.h"
#include "base/process/process_metrics.h"
#include "base/time/time_override.h"
#include "base/types/expected.h"
#include "build/build_config.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/core/execution_context/agent.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/inspected_frames.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"
#include "third_party/blink/renderer/platform/instrumentation/instance_counters.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
namespace blink {
TimeDomain;
namespace {
constexpr bool isPlural(const char* str, int len) { … }
static constexpr const char* kInstanceCounterNames[] = …;
std::unique_ptr<base::ProcessMetrics> GetCurrentProcessMetrics() { … }
base::TimeDelta GetCurrentProcessTime() { … }
}
InspectorPerformanceAgent::InspectorPerformanceAgent(
InspectedFrames* inspected_frames)
: … { … }
InspectorPerformanceAgent::~InspectorPerformanceAgent() = default;
void InspectorPerformanceAgent::Restore() { … }
void InspectorPerformanceAgent::InnerEnable() { … }
protocol::Response InspectorPerformanceAgent::enable(
Maybe<String> optional_time_domain) { … }
protocol::Response InspectorPerformanceAgent::disable() { … }
namespace {
void AppendMetric(protocol::Array<protocol::Performance::Metric>* container,
const String& name,
double value) { … }
}
protocol::Response InspectorPerformanceAgent::setTimeDomain(
const String& time_domain) { … }
base::TimeTicks InspectorPerformanceAgent::GetTimeTicksNow() { … }
base::TimeTicks InspectorPerformanceAgent::GetThreadTimeNow() { … }
bool InspectorPerformanceAgent::HasTimeDomain(const String& time_domain) { … }
protocol::Response InspectorPerformanceAgent::InnerSetTimeDomain(
const String& time_domain) { … }
protocol::Response InspectorPerformanceAgent::getMetrics(
std::unique_ptr<protocol::Array<protocol::Performance::Metric>>*
out_result) { … }
void InspectorPerformanceAgent::ConsoleTimeStamp(v8::Isolate* isolate,
v8::Local<v8::String> label) { … }
void InspectorPerformanceAgent::ScriptStarts() { … }
void InspectorPerformanceAgent::ScriptEnds() { … }
void InspectorPerformanceAgent::Will(const probe::CallFunction& probe) { … }
void InspectorPerformanceAgent::Did(const probe::CallFunction& probe) { … }
void InspectorPerformanceAgent::Will(const probe::ExecuteScript& probe) { … }
void InspectorPerformanceAgent::Did(const probe::ExecuteScript& probe) { … }
void InspectorPerformanceAgent::Will(const probe::RecalculateStyle& probe) { … }
void InspectorPerformanceAgent::Did(const probe::RecalculateStyle& probe) { … }
void InspectorPerformanceAgent::Will(const probe::UpdateLayout& probe) { … }
void InspectorPerformanceAgent::Did(const probe::UpdateLayout& probe) { … }
void InspectorPerformanceAgent::Will(const probe::V8Compile& probe) { … }
void InspectorPerformanceAgent::Did(const probe::V8Compile& probe) { … }
void InspectorPerformanceAgent::WillStartDebuggerTask() { … }
void InspectorPerformanceAgent::DidFinishDebuggerTask() { … }
void InspectorPerformanceAgent::WillProcessTask(base::TimeTicks start_time) { … }
void InspectorPerformanceAgent::DidProcessTask(base::TimeTicks start_time,
base::TimeTicks end_time) { … }
void InspectorPerformanceAgent::Trace(Visitor* visitor) const { … }
}