blob: 7d497861aaa5983fd237bff0f94784e162cf6cfc [file] [log] [blame]
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/metrics/ukm_recorder_interface.h"
#include "base/atomic_sequence_num.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "url/gurl.h"
namespace metrics {
UkmRecorderInterface::UkmRecorderInterface(ukm::UkmRecorder* ukm_recorder)
: ukm_recorder_(ukm_recorder) {}
UkmRecorderInterface::~UkmRecorderInterface() = default;
// static
void UkmRecorderInterface::Create(
ukm::UkmRecorder* ukm_recorder,
ukm::mojom::UkmRecorderInterfaceRequest request) {
mojo::MakeStrongBinding(std::make_unique<UkmRecorderInterface>(ukm_recorder),
std::move(request));
}
void UkmRecorderInterface::AddEntry(ukm::mojom::UkmEntryPtr ukm_entry) {
ukm_recorder_->AddEntry(std::move(ukm_entry));
}
void UkmRecorderInterface::UpdateSourceURL(int64_t source_id,
const std::string& url) {
ukm_recorder_->UpdateSourceURL(source_id, GURL(url));
}
} // namespace metrics