Commit f710f276 authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Commit Bot

RC: Ditch the legacy service_keepalive in PerformanceManager.

Bug: 910288
Change-Id: I1381260a1001c236e9d65d5fb28778436268e61a
Reviewed-on: https://chromium-review.googlesource.com/c/1483693Reviewed-by: default avatarChris Hamilton <chrisha@chromium.org>
Commit-Queue: Sigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635108}
parent cbfeebea
...@@ -11,11 +11,9 @@ ...@@ -11,11 +11,9 @@
namespace performance_manager { namespace performance_manager {
FrameNodeImpl::FrameNodeImpl( FrameNodeImpl::FrameNodeImpl(const resource_coordinator::CoordinationUnitID& id,
const resource_coordinator::CoordinationUnitID& id, Graph* graph)
Graph* graph, : CoordinationUnitInterface(id, graph),
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref)
: CoordinationUnitInterface(id, graph, std::move(keepalive_ref)),
parent_frame_coordination_unit_(nullptr), parent_frame_coordination_unit_(nullptr),
page_coordination_unit_(nullptr), page_coordination_unit_(nullptr),
process_coordination_unit_(nullptr) { process_coordination_unit_(nullptr) {
......
...@@ -29,10 +29,8 @@ class FrameNodeImpl ...@@ -29,10 +29,8 @@ class FrameNodeImpl
return resource_coordinator::CoordinationUnitType::kFrame; return resource_coordinator::CoordinationUnitType::kFrame;
} }
FrameNodeImpl( FrameNodeImpl(const resource_coordinator::CoordinationUnitID& id,
const resource_coordinator::CoordinationUnitID& id, Graph* graph);
Graph* graph,
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref);
~FrameNodeImpl() override; ~FrameNodeImpl() override;
// FrameNode implementation. // FrameNode implementation.
......
...@@ -48,10 +48,9 @@ Graph::~Graph() { ...@@ -48,10 +48,9 @@ Graph::~Graph() {
} }
void Graph::OnStart(service_manager::BinderRegistryWithArgs< void Graph::OnStart(service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry, const service_manager::BindSourceInfo&>* registry) {
service_manager::ServiceKeepalive* keepalive) {
// Create the singleton CoordinationUnitProvider. // Create the singleton CoordinationUnitProvider.
provider_ = std::make_unique<GraphNodeProviderImpl>(keepalive, this); provider_ = std::make_unique<GraphNodeProviderImpl>(this);
registry->AddInterface(base::BindRepeating( registry->AddInterface(base::BindRepeating(
&GraphNodeProviderImpl::Bind, base::Unretained(provider_.get()))); &GraphNodeProviderImpl::Bind, base::Unretained(provider_.get())));
} }
...@@ -75,32 +74,27 @@ void Graph::OnBeforeNodeDestroyed(NodeBase* coordination_unit) { ...@@ -75,32 +74,27 @@ void Graph::OnBeforeNodeDestroyed(NodeBase* coordination_unit) {
} }
FrameNodeImpl* Graph::CreateFrameNode( FrameNodeImpl* Graph::CreateFrameNode(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id) {
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref) { return FrameNodeImpl::Create(id, this);
return FrameNodeImpl::Create(id, this, std::move(service_ref));
} }
PageNodeImpl* Graph::CreatePageNode( PageNodeImpl* Graph::CreatePageNode(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id) {
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref) { return PageNodeImpl::Create(id, this);
return PageNodeImpl::Create(id, this, std::move(service_ref));
} }
ProcessNodeImpl* Graph::CreateProcessNode( ProcessNodeImpl* Graph::CreateProcessNode(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id) {
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref) { return ProcessNodeImpl::Create(id, this);
return ProcessNodeImpl::Create(id, this, std::move(service_ref));
} }
SystemNodeImpl* Graph::FindOrCreateSystemNode( SystemNodeImpl* Graph::FindOrCreateSystemNode() {
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref) {
NodeBase* system_cu = GetNodeByID(system_coordination_unit_id_); NodeBase* system_cu = GetNodeByID(system_coordination_unit_id_);
if (system_cu) if (system_cu)
return SystemNodeImpl::FromNodeBase(system_cu); return SystemNodeImpl::FromNodeBase(system_cu);
// Create the singleton SystemCU instance. Ownership is taken by the graph. // Create the singleton SystemCU instance. Ownership is taken by the graph.
return SystemNodeImpl::Create(system_coordination_unit_id_, this, return SystemNodeImpl::Create(system_coordination_unit_id_, this);
std::move(service_ref));
} }
NodeBase* Graph::GetNodeByID( NodeBase* Graph::GetNodeByID(
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "services/metrics/public/cpp/ukm_recorder.h" #include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/resource_coordinator/public/cpp/coordination_unit_id.h" #include "services/resource_coordinator/public/cpp/coordination_unit_id.h"
#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" #include "services/resource_coordinator/public/cpp/coordination_unit_types.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
namespace service_manager { namespace service_manager {
template <typename... BinderArgs> template <typename... BinderArgs>
...@@ -50,23 +49,18 @@ class Graph { ...@@ -50,23 +49,18 @@ class Graph {
ukm::UkmRecorder* ukm_recorder() const { return ukm_recorder_; } ukm::UkmRecorder* ukm_recorder() const { return ukm_recorder_; }
void OnStart(service_manager::BinderRegistryWithArgs< void OnStart(service_manager::BinderRegistryWithArgs<
const service_manager::BindSourceInfo&>* registry, const service_manager::BindSourceInfo&>* registry);
service_manager::ServiceKeepalive* keepalive);
void RegisterObserver(std::unique_ptr<GraphObserver> observer); void RegisterObserver(std::unique_ptr<GraphObserver> observer);
void OnNodeCreated(NodeBase* coordination_unit); void OnNodeCreated(NodeBase* coordination_unit);
void OnBeforeNodeDestroyed(NodeBase* coordination_unit); void OnBeforeNodeDestroyed(NodeBase* coordination_unit);
FrameNodeImpl* CreateFrameNode( FrameNodeImpl* CreateFrameNode(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id);
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref);
PageNodeImpl* CreatePageNode( PageNodeImpl* CreatePageNode(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id);
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref);
ProcessNodeImpl* CreateProcessNode( ProcessNodeImpl* CreateProcessNode(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id);
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref); SystemNodeImpl* FindOrCreateSystemNode();
SystemNodeImpl* FindOrCreateSystemNode(
std::unique_ptr<service_manager::ServiceKeepaliveRef> service_ref);
std::vector<ProcessNodeImpl*> GetAllProcessNodes(); std::vector<ProcessNodeImpl*> GetAllProcessNodes();
std::vector<FrameNodeImpl*> GetAllFrameNodes(); std::vector<FrameNodeImpl*> GetAllFrameNodes();
...@@ -105,7 +99,7 @@ class Graph { ...@@ -105,7 +99,7 @@ class Graph {
ukm::UkmRecorder* ukm_recorder_ = nullptr; ukm::UkmRecorder* ukm_recorder_ = nullptr;
std::unique_ptr<GraphNodeProviderImpl> provider_; std::unique_ptr<GraphNodeProviderImpl> provider_;
static void Create(service_manager::ServiceKeepalive* keepalive); static void Create();
DISALLOW_COPY_AND_ASSIGN(Graph); DISALLOW_COPY_AND_ASSIGN(Graph);
}; };
......
...@@ -17,14 +17,8 @@ ...@@ -17,14 +17,8 @@
namespace performance_manager { namespace performance_manager {
GraphNodeProviderImpl::GraphNodeProviderImpl( GraphNodeProviderImpl::GraphNodeProviderImpl(Graph* coordination_unit_graph)
service_manager::ServiceKeepalive* service_keepalive, : coordination_unit_graph_(coordination_unit_graph) {}
Graph* coordination_unit_graph)
: service_keepalive_(service_keepalive),
coordination_unit_graph_(coordination_unit_graph) {
DCHECK(service_keepalive_);
keepalive_ref_ = service_keepalive_->CreateRef();
}
GraphNodeProviderImpl::~GraphNodeProviderImpl() = default; GraphNodeProviderImpl::~GraphNodeProviderImpl() = default;
...@@ -35,8 +29,7 @@ void GraphNodeProviderImpl::OnConnectionError(NodeBase* coordination_unit) { ...@@ -35,8 +29,7 @@ void GraphNodeProviderImpl::OnConnectionError(NodeBase* coordination_unit) {
void GraphNodeProviderImpl::CreateFrameCoordinationUnit( void GraphNodeProviderImpl::CreateFrameCoordinationUnit(
resource_coordinator::mojom::FrameCoordinationUnitRequest request, resource_coordinator::mojom::FrameCoordinationUnitRequest request,
const resource_coordinator::CoordinationUnitID& id) { const resource_coordinator::CoordinationUnitID& id) {
FrameNodeImpl* frame_cu = coordination_unit_graph_->CreateFrameNode( FrameNodeImpl* frame_cu = coordination_unit_graph_->CreateFrameNode(id);
id, service_keepalive_->CreateRef());
frame_cu->Bind(std::move(request)); frame_cu->Bind(std::move(request));
auto& frame_cu_binding = frame_cu->binding(); auto& frame_cu_binding = frame_cu->binding();
...@@ -49,8 +42,7 @@ void GraphNodeProviderImpl::CreateFrameCoordinationUnit( ...@@ -49,8 +42,7 @@ void GraphNodeProviderImpl::CreateFrameCoordinationUnit(
void GraphNodeProviderImpl::CreatePageCoordinationUnit( void GraphNodeProviderImpl::CreatePageCoordinationUnit(
resource_coordinator::mojom::PageCoordinationUnitRequest request, resource_coordinator::mojom::PageCoordinationUnitRequest request,
const resource_coordinator::CoordinationUnitID& id) { const resource_coordinator::CoordinationUnitID& id) {
PageNodeImpl* page_cu = coordination_unit_graph_->CreatePageNode( PageNodeImpl* page_cu = coordination_unit_graph_->CreatePageNode(id);
id, service_keepalive_->CreateRef());
page_cu->Bind(std::move(request)); page_cu->Bind(std::move(request));
auto& page_cu_binding = page_cu->binding(); auto& page_cu_binding = page_cu->binding();
...@@ -63,8 +55,7 @@ void GraphNodeProviderImpl::CreatePageCoordinationUnit( ...@@ -63,8 +55,7 @@ void GraphNodeProviderImpl::CreatePageCoordinationUnit(
void GraphNodeProviderImpl::CreateProcessCoordinationUnit( void GraphNodeProviderImpl::CreateProcessCoordinationUnit(
resource_coordinator::mojom::ProcessCoordinationUnitRequest request, resource_coordinator::mojom::ProcessCoordinationUnitRequest request,
const resource_coordinator::CoordinationUnitID& id) { const resource_coordinator::CoordinationUnitID& id) {
ProcessNodeImpl* process_cu = coordination_unit_graph_->CreateProcessNode( ProcessNodeImpl* process_cu = coordination_unit_graph_->CreateProcessNode(id);
id, service_keepalive_->CreateRef());
process_cu->Bind(std::move(request)); process_cu->Bind(std::move(request));
auto& process_cu_binding = process_cu->binding(); auto& process_cu_binding = process_cu->binding();
...@@ -77,9 +68,8 @@ void GraphNodeProviderImpl::CreateProcessCoordinationUnit( ...@@ -77,9 +68,8 @@ void GraphNodeProviderImpl::CreateProcessCoordinationUnit(
void GraphNodeProviderImpl::GetSystemCoordinationUnit( void GraphNodeProviderImpl::GetSystemCoordinationUnit(
resource_coordinator::mojom::SystemCoordinationUnitRequest request) { resource_coordinator::mojom::SystemCoordinationUnitRequest request) {
// Simply fetch the existing SystemCU and add an additional binding to it. // Simply fetch the existing SystemCU and add an additional binding to it.
coordination_unit_graph_ coordination_unit_graph_->FindOrCreateSystemNode()->AddBinding(
->FindOrCreateSystemNode(service_keepalive_->CreateRef()) std::move(request));
->AddBinding(std::move(request));
} }
void GraphNodeProviderImpl::Bind( void GraphNodeProviderImpl::Bind(
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/public/cpp/bindings/interface_request.h" #include "mojo/public/cpp/bindings/interface_request.h"
#include "services/resource_coordinator/public/mojom/coordination_unit_provider.mojom.h" #include "services/resource_coordinator/public/mojom/coordination_unit_provider.mojom.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
namespace service_manager { namespace service_manager {
struct BindSourceInfo; struct BindSourceInfo;
...@@ -23,8 +22,7 @@ namespace performance_manager { ...@@ -23,8 +22,7 @@ namespace performance_manager {
class GraphNodeProviderImpl class GraphNodeProviderImpl
: public resource_coordinator::mojom::CoordinationUnitProvider { : public resource_coordinator::mojom::CoordinationUnitProvider {
public: public:
GraphNodeProviderImpl(service_manager::ServiceKeepalive* service_keepalive, explicit GraphNodeProviderImpl(Graph* coordination_unit_graph);
Graph* coordination_unit_graph);
~GraphNodeProviderImpl() override; ~GraphNodeProviderImpl() override;
void Bind( void Bind(
...@@ -48,8 +46,6 @@ class GraphNodeProviderImpl ...@@ -48,8 +46,6 @@ class GraphNodeProviderImpl
override; override;
private: private:
service_manager::ServiceKeepalive* const service_keepalive_;
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref_;
Graph* coordination_unit_graph_; Graph* coordination_unit_graph_;
mojo::BindingSet<resource_coordinator::mojom::CoordinationUnitProvider> mojo::BindingSet<resource_coordinator::mojom::CoordinationUnitProvider>
bindings_; bindings_;
......
...@@ -12,9 +12,7 @@ namespace performance_manager { ...@@ -12,9 +12,7 @@ namespace performance_manager {
GraphTestHarness::GraphTestHarness() GraphTestHarness::GraphTestHarness()
: task_env_(base::test::ScopedTaskEnvironment::MainThreadType::MOCK_TIME, : task_env_(base::test::ScopedTaskEnvironment::MainThreadType::MOCK_TIME,
base::test::ScopedTaskEnvironment::ExecutionMode::QUEUED), base::test::ScopedTaskEnvironment::ExecutionMode::QUEUED),
service_keepalive_(static_cast<service_manager::ServiceBinding*>(nullptr), provider_(&coordination_unit_graph_) {}
base::nullopt /* idle_timeout */),
provider_(&service_keepalive_, &coordination_unit_graph_) {}
GraphTestHarness::~GraphTestHarness() = default; GraphTestHarness::~GraphTestHarness() = default;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "chrome/browser/performance_manager/graph/graph_node_provider_impl.h" #include "chrome/browser/performance_manager/graph/graph_node_provider_impl.h"
#include "chrome/browser/performance_manager/graph/node_base.h" #include "chrome/browser/performance_manager/graph/node_base.h"
#include "chrome/browser/performance_manager/graph/system_node_impl.h" #include "chrome/browser/performance_manager/graph/system_node_impl.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
namespace resource_coordinator { namespace resource_coordinator {
...@@ -30,7 +29,7 @@ class TestNodeWrapper { ...@@ -30,7 +29,7 @@ class TestNodeWrapper {
static TestNodeWrapper<NodeClass> Create(Graph* graph) { static TestNodeWrapper<NodeClass> Create(Graph* graph) {
resource_coordinator::CoordinationUnitID cu_id( resource_coordinator::CoordinationUnitID cu_id(
NodeClass::Type(), resource_coordinator::CoordinationUnitID::RANDOM_ID); NodeClass::Type(), resource_coordinator::CoordinationUnitID::RANDOM_ID);
return TestNodeWrapper<NodeClass>(NodeClass::Create(cu_id, graph, nullptr)); return TestNodeWrapper<NodeClass>(NodeClass::Create(cu_id, graph));
} }
explicit TestNodeWrapper(NodeClass* impl) : impl_(impl) { DCHECK(impl); } explicit TestNodeWrapper(NodeClass* impl) : impl_(impl) { DCHECK(impl); }
...@@ -63,8 +62,8 @@ class GraphTestHarness : public testing::Test { ...@@ -63,8 +62,8 @@ class GraphTestHarness : public testing::Test {
template <class NodeClass> template <class NodeClass>
TestNodeWrapper<NodeClass> CreateCoordinationUnit( TestNodeWrapper<NodeClass> CreateCoordinationUnit(
resource_coordinator::CoordinationUnitID cu_id) { resource_coordinator::CoordinationUnitID cu_id) {
return TestNodeWrapper<NodeClass>(NodeClass::Create( return TestNodeWrapper<NodeClass>(
cu_id, coordination_unit_graph(), service_keepalive_.CreateRef())); NodeClass::Create(cu_id, coordination_unit_graph()));
} }
template <class NodeClass> template <class NodeClass>
...@@ -76,8 +75,7 @@ class GraphTestHarness : public testing::Test { ...@@ -76,8 +75,7 @@ class GraphTestHarness : public testing::Test {
TestNodeWrapper<SystemNodeImpl> GetSystemCoordinationUnit() { TestNodeWrapper<SystemNodeImpl> GetSystemCoordinationUnit() {
return TestNodeWrapper<SystemNodeImpl>( return TestNodeWrapper<SystemNodeImpl>(
coordination_unit_graph()->FindOrCreateSystemNode( coordination_unit_graph()->FindOrCreateSystemNode());
service_keepalive_.CreateRef()));
} }
// testing::Test: // testing::Test:
...@@ -90,7 +88,6 @@ class GraphTestHarness : public testing::Test { ...@@ -90,7 +88,6 @@ class GraphTestHarness : public testing::Test {
private: private:
base::test::ScopedTaskEnvironment task_env_; base::test::ScopedTaskEnvironment task_env_;
service_manager::ServiceKeepalive service_keepalive_;
Graph coordination_unit_graph_; Graph coordination_unit_graph_;
GraphNodeProviderImpl provider_; GraphNodeProviderImpl provider_;
}; };
......
...@@ -14,11 +14,9 @@ namespace performance_manager { ...@@ -14,11 +14,9 @@ namespace performance_manager {
namespace { namespace {
ProcessNodeImpl* CreateProcessNode(Graph* graph) { ProcessNodeImpl* CreateProcessNode(Graph* graph) {
return graph->CreateProcessNode( return graph->CreateProcessNode(resource_coordinator::CoordinationUnitID(
resource_coordinator::CoordinationUnitID( resource_coordinator::CoordinationUnitType::kProcess,
resource_coordinator::CoordinationUnitType::kProcess, resource_coordinator::CoordinationUnitID::RANDOM_ID));
resource_coordinator::CoordinationUnitID::RANDOM_ID),
nullptr);
} }
} // namespace } // namespace
...@@ -33,7 +31,7 @@ TEST(GraphTest, DestructionWhileCUSOutstanding) { ...@@ -33,7 +31,7 @@ TEST(GraphTest, DestructionWhileCUSOutstanding) {
process->SetPID(i + 100); process->SetPID(i + 100);
} }
EXPECT_NE(nullptr, graph->FindOrCreateSystemNode(nullptr)); EXPECT_NE(nullptr, graph->FindOrCreateSystemNode());
// This should destroy all the CUs without incident. // This should destroy all the CUs without incident.
graph.reset(); graph.reset();
...@@ -42,15 +40,15 @@ TEST(GraphTest, DestructionWhileCUSOutstanding) { ...@@ -42,15 +40,15 @@ TEST(GraphTest, DestructionWhileCUSOutstanding) {
TEST(GraphTest, FindOrCreateSystemNode) { TEST(GraphTest, FindOrCreateSystemNode) {
Graph graph; Graph graph;
SystemNodeImpl* system_cu = graph.FindOrCreateSystemNode(nullptr); SystemNodeImpl* system_cu = graph.FindOrCreateSystemNode();
// A second request should return the same instance. // A second request should return the same instance.
EXPECT_EQ(system_cu, graph.FindOrCreateSystemNode(nullptr)); EXPECT_EQ(system_cu, graph.FindOrCreateSystemNode());
// Destructing the system CU should be allowed. // Destructing the system CU should be allowed.
system_cu->Destruct(); system_cu->Destruct();
system_cu = graph.FindOrCreateSystemNode(nullptr); system_cu = graph.FindOrCreateSystemNode();
EXPECT_NE(nullptr, system_cu); EXPECT_NE(nullptr, system_cu);
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "services/resource_coordinator/public/cpp/coordination_unit_types.h" #include "services/resource_coordinator/public/cpp/coordination_unit_types.h"
#include "services/resource_coordinator/public/mojom/coordination_unit.mojom.h" #include "services/resource_coordinator/public/mojom/coordination_unit.mojom.h"
#include "services/resource_coordinator/public/mojom/coordination_unit_provider.mojom.h" #include "services/resource_coordinator/public/mojom/coordination_unit_provider.mojom.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
namespace performance_manager { namespace performance_manager {
...@@ -90,11 +89,9 @@ class CoordinationUnitInterface : public NodeBase, public MojoInterfaceClass { ...@@ -90,11 +89,9 @@ class CoordinationUnitInterface : public NodeBase, public MojoInterfaceClass {
public: public:
static CoordinationUnitClass* Create( static CoordinationUnitClass* Create(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id,
Graph* graph, Graph* graph) {
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref) {
std::unique_ptr<CoordinationUnitClass> new_cu = std::unique_ptr<CoordinationUnitClass> new_cu =
std::make_unique<CoordinationUnitClass>(id, graph, std::make_unique<CoordinationUnitClass>(id, graph);
std::move(keepalive_ref));
return static_cast<CoordinationUnitClass*>( return static_cast<CoordinationUnitClass*>(
PassOwnershipToGraph(std::move(new_cu))); PassOwnershipToGraph(std::move(new_cu)));
} }
...@@ -109,14 +106,9 @@ class CoordinationUnitInterface : public NodeBase, public MojoInterfaceClass { ...@@ -109,14 +106,9 @@ class CoordinationUnitInterface : public NodeBase, public MojoInterfaceClass {
return static_cast<CoordinationUnitClass*>(cu); return static_cast<CoordinationUnitClass*>(cu);
} }
CoordinationUnitInterface( CoordinationUnitInterface(const resource_coordinator::CoordinationUnitID& id,
const resource_coordinator::CoordinationUnitID& id, Graph* graph)
Graph* graph, : NodeBase(id, graph), binding_(this) {}
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref)
: NodeBase(id, graph), binding_(this) {
keepalive_ref_ = std::move(keepalive_ref);
}
~CoordinationUnitInterface() override = default; ~CoordinationUnitInterface() override = default;
...@@ -146,7 +138,6 @@ class CoordinationUnitInterface : public NodeBase, public MojoInterfaceClass { ...@@ -146,7 +138,6 @@ class CoordinationUnitInterface : public NodeBase, public MojoInterfaceClass {
private: private:
mojo::BindingSet<MojoInterfaceClass> bindings_; mojo::BindingSet<MojoInterfaceClass> bindings_;
mojo::Binding<MojoInterfaceClass> binding_; mojo::Binding<MojoInterfaceClass> binding_;
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref_;
DISALLOW_COPY_AND_ASSIGN(CoordinationUnitInterface); DISALLOW_COPY_AND_ASSIGN(CoordinationUnitInterface);
}; };
......
...@@ -27,11 +27,9 @@ size_t ToIndex( ...@@ -27,11 +27,9 @@ size_t ToIndex(
} // namespace } // namespace
PageNodeImpl::PageNodeImpl( PageNodeImpl::PageNodeImpl(const resource_coordinator::CoordinationUnitID& id,
const resource_coordinator::CoordinationUnitID& id, Graph* graph)
Graph* graph, : CoordinationUnitInterface(id, graph) {
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref)
: CoordinationUnitInterface(id, graph, std::move(keepalive_ref)) {
InvalidateAllInterventionPolicies(); InvalidateAllInterventionPolicies();
} }
......
...@@ -24,10 +24,8 @@ class PageNodeImpl ...@@ -24,10 +24,8 @@ class PageNodeImpl
return resource_coordinator::CoordinationUnitType::kPage; return resource_coordinator::CoordinationUnitType::kPage;
} }
PageNodeImpl( PageNodeImpl(const resource_coordinator::CoordinationUnitID& id,
const resource_coordinator::CoordinationUnitID& id, Graph* graph);
Graph* graph,
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref);
~PageNodeImpl() override; ~PageNodeImpl() override;
// resource_coordinator::mojom::PageCoordinationUnit implementation. // resource_coordinator::mojom::PageCoordinationUnit implementation.
......
...@@ -12,9 +12,8 @@ namespace performance_manager { ...@@ -12,9 +12,8 @@ namespace performance_manager {
ProcessNodeImpl::ProcessNodeImpl( ProcessNodeImpl::ProcessNodeImpl(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id,
Graph* graph, Graph* graph)
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref) : CoordinationUnitInterface(id, graph) {}
: CoordinationUnitInterface(id, graph, std::move(keepalive_ref)) {}
ProcessNodeImpl::~ProcessNodeImpl() { ProcessNodeImpl::~ProcessNodeImpl() {
// Make as if we're transitioning to the null PID before we die to clear this // Make as if we're transitioning to the null PID before we die to clear this
......
...@@ -37,10 +37,8 @@ class ProcessNodeImpl ...@@ -37,10 +37,8 @@ class ProcessNodeImpl
return resource_coordinator::CoordinationUnitType::kProcess; return resource_coordinator::CoordinationUnitType::kProcess;
} }
ProcessNodeImpl( ProcessNodeImpl(const resource_coordinator::CoordinationUnitID& id,
const resource_coordinator::CoordinationUnitID& id, Graph* graph);
Graph* graph,
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref);
~ProcessNodeImpl() override; ~ProcessNodeImpl() override;
// resource_coordinator::mojom::ProcessCoordinationUnit implementation. // resource_coordinator::mojom::ProcessCoordinationUnit implementation.
......
...@@ -18,9 +18,8 @@ namespace performance_manager { ...@@ -18,9 +18,8 @@ namespace performance_manager {
SystemNodeImpl::SystemNodeImpl( SystemNodeImpl::SystemNodeImpl(
const resource_coordinator::CoordinationUnitID& id, const resource_coordinator::CoordinationUnitID& id,
Graph* graph, Graph* graph)
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref) : CoordinationUnitInterface(id, graph) {}
: CoordinationUnitInterface(id, graph, std::move(keepalive_ref)) {}
SystemNodeImpl::~SystemNodeImpl() = default; SystemNodeImpl::~SystemNodeImpl() = default;
......
...@@ -21,10 +21,8 @@ class SystemNodeImpl ...@@ -21,10 +21,8 @@ class SystemNodeImpl
return resource_coordinator::CoordinationUnitType::kSystem; return resource_coordinator::CoordinationUnitType::kSystem;
} }
SystemNodeImpl( SystemNodeImpl(const resource_coordinator::CoordinationUnitID& id,
const resource_coordinator::CoordinationUnitID& id, Graph* graph);
Graph* graph,
std::unique_ptr<service_manager::ServiceKeepaliveRef> keepalive_ref);
~SystemNodeImpl() override; ~SystemNodeImpl() override;
// resource_coordinator::mojom::SystemCoordinationUnit implementation: // resource_coordinator::mojom::SystemCoordinationUnit implementation:
......
...@@ -38,10 +38,7 @@ PerformanceManager* PerformanceManager::GetInstance() { ...@@ -38,10 +38,7 @@ PerformanceManager* PerformanceManager::GetInstance() {
} }
PerformanceManager::PerformanceManager() PerformanceManager::PerformanceManager()
: service_keepalive_(static_cast<service_manager::ServiceBinding*>(nullptr), : task_runner_(CreateTaskRunner()), introspector_(&graph_) {
base::nullopt),
task_runner_(CreateTaskRunner()),
introspector_(&graph_) {
DETACH_FROM_SEQUENCE(sequence_checker_); DETACH_FROM_SEQUENCE(sequence_checker_);
} }
...@@ -127,7 +124,7 @@ void PerformanceManager::OnStartImpl( ...@@ -127,7 +124,7 @@ void PerformanceManager::OnStartImpl(
graph_.set_ukm_recorder(ukm_recorder_.get()); graph_.set_ukm_recorder(ukm_recorder_.get());
} }
graph_.OnStart(&interface_registry_, &service_keepalive_); graph_.OnStart(&interface_registry_);
} }
void PerformanceManager::BindInterfaceImpl( void PerformanceManager::BindInterfaceImpl(
...@@ -140,7 +137,7 @@ void PerformanceManager::BindInterfaceImpl( ...@@ -140,7 +137,7 @@ void PerformanceManager::BindInterfaceImpl(
void PerformanceManager::DistributeMeasurementBatchImpl( void PerformanceManager::DistributeMeasurementBatchImpl(
resource_coordinator::mojom::ProcessResourceMeasurementBatchPtr batch) { resource_coordinator::mojom::ProcessResourceMeasurementBatchPtr batch) {
SystemNodeImpl* system_node = graph_.FindOrCreateSystemNode(nullptr); SystemNodeImpl* system_node = graph_.FindOrCreateSystemNode();
DCHECK(system_node); DCHECK(system_node);
system_node->DistributeMeasurementBatch(std::move(batch)); system_node->DistributeMeasurementBatch(std::move(batch));
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "services/service_manager/public/cpp/bind_source_info.h" #include "services/service_manager/public/cpp/bind_source_info.h"
#include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/service_keepalive.h"
namespace ukm { namespace ukm {
class MojoUkmRecorder; class MojoUkmRecorder;
...@@ -81,9 +80,6 @@ class PerformanceManager { ...@@ -81,9 +80,6 @@ class PerformanceManager {
const service_manager::BindSourceInfo& source_info); const service_manager::BindSourceInfo& source_info);
void OnGraphDumpConnectionError(WebUIGraphDumpImpl* graph_dump); void OnGraphDumpConnectionError(WebUIGraphDumpImpl* graph_dump);
// TODO(siggi): Remove this as it's only here to maintain compatibility
// with the current interface of the CoordinationUnits.
service_manager::ServiceKeepalive service_keepalive_;
InterfaceRegistry interface_registry_; InterfaceRegistry interface_registry_;
// The performance task runner. // The performance task runner.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment