Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Unified Diff: services/resource_coordinator/service_callbacks_impl.cc

Issue 2938443002: [GRC] UKM Support (Closed)
Patch Set: Address reviewer feedback Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/resource_coordinator/service_callbacks_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/resource_coordinator/service_callbacks_impl.cc
diff --git a/services/resource_coordinator/service_callbacks_impl.cc b/services/resource_coordinator/service_callbacks_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..acefed15252fe7c70876ccc7104e24104db83683
--- /dev/null
+++ b/services/resource_coordinator/service_callbacks_impl.cc
@@ -0,0 +1,50 @@
+// 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/resource_coordinator/service_callbacks_impl.h"
+
+#include <utility>
+
+#include "base/memory/ptr_util.h"
+#include "components/ukm/public/mojo_ukm_recorder.h"
+#include "services/resource_coordinator/resource_coordinator_service.h"
+#include "services/service_manager/public/cpp/service_context_ref.h"
+
+namespace resource_coordinator {
+
+ServiceCallbacksImpl::ServiceCallbacksImpl(
+ service_manager::ServiceContextRefFactory* service_ref_factory,
+ ResourceCoordinatorService* resource_coordinator_service)
+ : resource_coordinator_service_(resource_coordinator_service) {
+ DCHECK(service_ref_factory);
+ service_ref_ = service_ref_factory->CreateRef();
+}
+
+ServiceCallbacksImpl::~ServiceCallbacksImpl() = default;
+
+// static
+void ServiceCallbacksImpl::Create(
+ service_manager::ServiceContextRefFactory* service_ref_factory,
+ ResourceCoordinatorService* resource_coordinator_service,
+ const service_manager::BindSourceInfo& source_info,
+ resource_coordinator::mojom::ServiceCallbacksRequest request) {
+ mojo::MakeStrongBinding(
+ base::MakeUnique<ServiceCallbacksImpl>(service_ref_factory,
+ resource_coordinator_service),
+ std::move(request));
+}
+
+void ServiceCallbacksImpl::SetUkmRecorderInterface(
+ ukm::mojom::UkmRecorderInterfacePtr ukm_recorder_interface) {
+ resource_coordinator_service_->SetUkmRecorder(
+ base::MakeUnique<ukm::MojoUkmRecorder>(
+ std::move(ukm_recorder_interface)));
+}
+
+void ServiceCallbacksImpl::IsUkmRecorderInterfaceInitialized(
+ const IsUkmRecorderInterfaceInitializedCallback& callback) {
+ callback.Run(resource_coordinator_service_->ukm_recorder() != nullptr);
+}
+
+} // namespace resource_coordinator
« no previous file with comments | « services/resource_coordinator/service_callbacks_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698