chromium/third_party/blink/renderer/core/timing/profiler_group.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/timing/profiler_group.h"

#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_profiler_init_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_profiler_trace.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/timing/profiler.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
#include "v8/include/v8-profiler.h"
#include "v8/include/v8.h"

namespace blink {

namespace {

#if BUILDFLAG(IS_WIN)
// On Windows, assume we have the coarsest possible timer.
static constexpr int kBaseSampleIntervalMs =
    base::Time::kMinLowResolutionThresholdMs;
#else
// Default to a 10ms base sampling interval on other platforms.
// TODO(acomminos): Reevaluate based on empirical overhead.
static constexpr int kBaseSampleIntervalMs =;
#endif  // BUILDFLAG(IS_WIN)

}  // namespace

class ProfilerGroup::ProfilingContextObserver
    : public GarbageCollected<ProfilingContextObserver>,
      public ExecutionContextLifecycleObserver {};

bool ProfilerGroup::CanProfile(LocalDOMWindow* local_window,
                               ExceptionState* exception_state,
                               ReportOptions report_options) {}

void ProfilerGroup::InitializeIfEnabled(LocalDOMWindow* local_window) {}

ProfilerGroup* ProfilerGroup::From(v8::Isolate* isolate) {}

base::TimeDelta ProfilerGroup::GetBaseSampleInterval() {}

ProfilerGroup::ProfilerGroup(v8::Isolate* isolate)
    :{}

void DiscardedSamplesDelegate::Notify() {}

void ProfilerGroup::OnProfilingContextAdded(ExecutionContext* context) {}

void ProfilerGroup::DispatchSampleBufferFullEvent(String profiler_id) {}

Profiler* ProfilerGroup::CreateProfiler(ScriptState* script_state,
                                        const ProfilerInitOptions& init_options,
                                        base::TimeTicks time_origin,
                                        ExceptionState& exception_state) {}

ProfilerGroup::~ProfilerGroup() {}

void ProfilerGroup::WillBeDestroyed() {}

void ProfilerGroup::Trace(Visitor* visitor) const {}

void ProfilerGroup::OnProfilingContextDestroyed(
    ProfilingContextObserver* observer) {}

void ProfilerGroup::InitV8Profiler() {}

void ProfilerGroup::TeardownV8Profiler() {}

void ProfilerGroup::StopProfiler(
    ScriptState* script_state,
    Profiler* profiler,
    ScriptPromiseResolver<ProfilerTrace>* resolver) {}

void ProfilerGroup::CancelProfiler(Profiler* profiler) {}

void ProfilerGroup::CancelProfilerAsync(ScriptState* script_state,
                                        Profiler* profiler) {}

void ProfilerGroup::StopDetachedProfiler(String profiler_id) {}

void ProfilerGroup::StopDetachedProfilers() {}

void ProfilerGroup::CancelProfilerImpl(String profiler_id) {}

String ProfilerGroup::NextProfilerId() {}

}  // namespace blink