#include "gpu/command_buffer/service/dawn_platform.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "base/trace_event/trace_arguments.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/service/dawn_caching_interface.h"
#include "gpu/config/gpu_finch_features.h"
namespace gpu::webgpu {
namespace {
class AsyncWaitableEventImpl
: public base::RefCountedThreadSafe<AsyncWaitableEventImpl> { … };
class AsyncWaitableEvent : public dawn::platform::WaitableEvent { … };
class AsyncWorkerTaskPool : public dawn::platform::WorkerTaskPool { … };
void RecordDelayedUMA(scoped_refptr<DawnPlatform::CacheCountsMap> cache_map,
std::string uma_prefix) { … }
}
DawnPlatform::CacheCountsMap::CacheCountsMap() = default;
DawnPlatform::CacheCountsMap::~CacheCountsMap() = default;
DawnPlatform::DawnPlatform(
std::unique_ptr<DawnCachingInterface> dawn_caching_interface,
const char* uma_prefix,
bool record_cache_count_uma)
: … { … }
DawnPlatform::~DawnPlatform() = default;
const unsigned char* DawnPlatform::GetTraceCategoryEnabledFlag(
dawn::platform::TraceCategory category) { … }
double DawnPlatform::MonotonicallyIncreasingTime() { … }
uint64_t DawnPlatform::AddTraceEvent(
char phase,
const unsigned char* category_group_enabled,
const char* name,
uint64_t id,
double timestamp,
int num_args,
const char** arg_names,
const unsigned char* arg_types,
const uint64_t* arg_values,
unsigned char flags) { … }
void DawnPlatform::HistogramCacheCountHelper(std::string name,
int sample,
int min,
int max,
int bucketCount) { … }
void DawnPlatform::HistogramCustomCounts(const char* name,
int sample,
int min,
int max,
int bucketCount) { … }
void DawnPlatform::HistogramCustomCountsHPC(const char* name,
int sample,
int min,
int max,
int bucketCount) { … }
void DawnPlatform::HistogramEnumeration(const char* name,
int sample,
int boundaryValue) { … }
void DawnPlatform::HistogramSparse(const char* name, int sample) { … }
void DawnPlatform::HistogramBoolean(const char* name, bool sample) { … }
dawn::platform::CachingInterface* DawnPlatform::GetCachingInterface() { … }
std::unique_ptr<dawn::platform::WorkerTaskPool>
DawnPlatform::CreateWorkerTaskPool() { … }
bool DawnPlatform::IsFeatureEnabled(dawn::platform::Features feature) { … }
}