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

Unified Diff: services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h

Issue 2964103002: [GRC] Decouple Render Process CPU Measurement from CU Graph (Closed)
Patch Set: Rebase 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
Index: services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h
diff --git a/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h b/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h
new file mode 100644
index 0000000000000000000000000000000000000000..6bc9e88dfdd3cc800ffeb963ddaf56cbd2eefafc
--- /dev/null
+++ b/services/resource_coordinator/coordination_unit/mock_coordination_unit_graphs.h
@@ -0,0 +1,106 @@
+// 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.
+
+#ifndef SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_MOCK_COORDINATION_UNIT_GRAPHS_H_
+#define SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_MOCK_COORDINATION_UNIT_GRAPHS_H_
+
+#include <memory>
+
+namespace resource_coordinator {
+
+class CoordinationUnitImpl;
+
+// The following coordination unit graph topology is created to emulate a
+// scenario when a single tab are executes in a single process:
+//
+// T P
+// \ /
+// F
+//
+// Where:
+// T: tab
+// F: frame
+// P: process
+struct MockSingleTabInSingleProcessCoordinationUnitGraph {
+ MockSingleTabInSingleProcessCoordinationUnitGraph();
+ ~MockSingleTabInSingleProcessCoordinationUnitGraph();
+ std::unique_ptr<CoordinationUnitImpl> frame;
+ std::unique_ptr<CoordinationUnitImpl> process;
+ std::unique_ptr<CoordinationUnitImpl> tab;
+};
+
+// The following coordination unit graph topology is created to emulate a
+// scenario where multiple tabs are executing in a single process:
+//
+// T P OT
+// \ / \ /
+// F OF
+//
+// Where:
+// T: tab
+// OT: other_tab
+// F: frame
+// OF: other_frame
+// P: process
+struct MockMultipleTabsInSingleProcessCoordinationUnitGraph
+ : public MockSingleTabInSingleProcessCoordinationUnitGraph {
+ MockMultipleTabsInSingleProcessCoordinationUnitGraph();
+ ~MockMultipleTabsInSingleProcessCoordinationUnitGraph();
+ std::unique_ptr<CoordinationUnitImpl> other_frame;
+ std::unique_ptr<CoordinationUnitImpl> other_tab;
+};
+
+// The following coordination unit graph topology is created to emulate a
+// scenario where a single tab that has frames executing in different
+// processes (e.g. out-of-process iFrames):
+//
+// T P
+// \ /
+// F OP
+// \ /
+// CF
+//
+// Where:
+// T: tab
+// F: frame
+// CF: chid_frame
+// P: process
+// OP: other_process
+struct MockSingleTabWithMultipleProcessesCoordinationUnitGraph
+ : public MockSingleTabInSingleProcessCoordinationUnitGraph {
+ MockSingleTabWithMultipleProcessesCoordinationUnitGraph();
+ ~MockSingleTabWithMultipleProcessesCoordinationUnitGraph();
+ std::unique_ptr<CoordinationUnitImpl> child_frame;
+ std::unique_ptr<CoordinationUnitImpl> other_process;
+};
+
+// The following coordination unit graph topology is created to emulate a
+// scenario where multiple tabs are utilizing multiple processes (e.g.
+// out-of-process iFrames and multiple tabs in a process):
+//
+// T P OT
+// \ / \ /
+// F OF OP
+// \ /
+// CF
+//
+// Where:
+// T: tab_coordination_unit
+// OT: other_tab_coordination_unit
+// F: frame_coordination_unit
+// OF: other_frame_coordination_unit
+// CF: another_frame_coordination_unit
+// P: process_coordination_unit
+// OP: other_process_coordination_unit
+struct MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph
+ : public MockMultipleTabsInSingleProcessCoordinationUnitGraph {
+ MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph();
+ ~MockMultipleTabsWithMultipleProcessesCoordinationUnitGraph();
+ std::unique_ptr<CoordinationUnitImpl> child_frame;
+ std::unique_ptr<CoordinationUnitImpl> other_process;
+};
+
+} // namespace resource_coordinator
+
+#endif // SERVICES_RESOURCE_COORDINATOR_COORDINATION_UNIT_MOCK_COORDINATION_UNIT_GRAPHS_H_

Powered by Google App Engine
This is Rietveld 408576698