Commit cd9faf6a authored by Etienne Pierre-doray's avatar Etienne Pierre-doray Committed by Commit Bot

[scheduler]: Expose agent ClusterId in FrameSchedulerImpl.

This will be used in follow up to compute agent
interference metric.
https://chromium-review.googlesource.com/c/chromium/src/+/1888091

Bug: 1019856
Change-Id: I493a253a4370cc24455efb0290a13f1579d7773e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881726Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Reviewed-by: default avatarYuta Kitamura <yutak@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711428}
parent 2ee7cfa5
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
#include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.h" #include "third_party/blink/renderer/core/editing/spellcheck/spell_checker.h"
#include "third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.h" #include "third_party/blink/renderer/core/editing/suggestion/text_suggestion_controller.h"
#include "third_party/blink/renderer/core/editing/surrounding_text.h" #include "third_party/blink/renderer/core/editing/surrounding_text.h"
#include "third_party/blink/renderer/core/execution_context/window_agent.h"
#include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h" #include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h"
#include "third_party/blink/renderer/core/frame/ad_tracker.h" #include "third_party/blink/renderer/core/frame/ad_tracker.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
...@@ -1471,6 +1472,11 @@ void LocalFrame::UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) { ...@@ -1471,6 +1472,11 @@ void LocalFrame::UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) {
Client()->DidChangeActiveSchedulerTrackedFeatures(features_mask); Client()->DidChangeActiveSchedulerTrackedFeatures(features_mask);
} }
const base::UnguessableToken& LocalFrame::GetAgentClusterId() const {
return GetDocument() ? GetDocument()->GetWindowAgent().cluster_id()
: base::UnguessableToken::Null();
}
const mojo::Remote<mojom::blink::ReportingServiceProxy>& const mojo::Remote<mojom::blink::ReportingServiceProxy>&
LocalFrame::GetReportingService() const { LocalFrame::GetReportingService() const {
if (!reporting_service_) { if (!reporting_service_) {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/time/default_tick_clock.h" #include "base/time/default_tick_clock.h"
#include "base/unguessable_token.h"
#include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h" #include "mojo/public/cpp/bindings/pending_associated_receiver.h"
...@@ -484,6 +485,7 @@ class CORE_EXPORT LocalFrame final : public Frame, ...@@ -484,6 +485,7 @@ class CORE_EXPORT LocalFrame final : public Frame,
ukm::SourceId GetUkmSourceId() override; ukm::SourceId GetUkmSourceId() override;
void UpdateTaskTime(base::TimeDelta time) override; void UpdateTaskTime(base::TimeDelta time) override;
void UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) override; void UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) override;
const base::UnguessableToken& GetAgentClusterId() const override;
// Activates the user activation states of this frame and all its ancestors. // Activates the user activation states of this frame and all its ancestors.
void NotifyUserActivation(bool need_browser_verification); void NotifyUserActivation(bool need_browser_verification);
......
...@@ -1146,6 +1146,10 @@ FrameSchedulerImpl::CreateWebSchedulingTaskQueue( ...@@ -1146,6 +1146,10 @@ FrameSchedulerImpl::CreateWebSchedulingTaskQueue(
task_queue.get()); task_queue.get());
} }
const base::UnguessableToken& FrameSchedulerImpl::GetAgentClusterId() const {
return delegate_->GetAgentClusterId();
}
// static // static
MainThreadTaskQueue::QueueTraits MainThreadTaskQueue::QueueTraits
FrameSchedulerImpl::ThrottleableTaskQueueTraits() { FrameSchedulerImpl::ThrottleableTaskQueueTraits() {
......
...@@ -187,6 +187,8 @@ class PLATFORM_EXPORT FrameSchedulerImpl : public FrameScheduler, ...@@ -187,6 +187,8 @@ class PLATFORM_EXPORT FrameSchedulerImpl : public FrameScheduler,
std::unique_ptr<WebSchedulingTaskQueue> CreateWebSchedulingTaskQueue( std::unique_ptr<WebSchedulingTaskQueue> CreateWebSchedulingTaskQueue(
WebSchedulingPriority) override; WebSchedulingPriority) override;
const base::UnguessableToken& GetAgentClusterId() const;
protected: protected:
FrameSchedulerImpl(MainThreadSchedulerImpl* main_thread_scheduler, FrameSchedulerImpl(MainThreadSchedulerImpl* main_thread_scheduler,
PageSchedulerImpl* parent_page_scheduler, PageSchedulerImpl* parent_page_scheduler,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/task/sequence_manager/test/sequence_manager_for_test.h" #include "base/task/sequence_manager/test/sequence_manager_for_test.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h" #include "base/test/task_environment.h"
#include "base/unguessable_token.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/features.h"
...@@ -54,6 +55,10 @@ class FrameSchedulerDelegateForTesting : public FrameScheduler::Delegate { ...@@ -54,6 +55,10 @@ class FrameSchedulerDelegateForTesting : public FrameScheduler::Delegate {
update_task_time_calls_++; update_task_time_calls_++;
} }
const base::UnguessableToken& GetAgentClusterId() const override {
return base::UnguessableToken::Null();
}
MOCK_METHOD1(UpdateActiveSchedulerTrackedFeatures, void(uint64_t)); MOCK_METHOD1(UpdateActiveSchedulerTrackedFeatures, void(uint64_t));
int update_task_time_calls_ = 0; int update_task_time_calls_ = 0;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/unguessable_token.h"
#include "services/metrics/public/cpp/ukm_source_id.h" #include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/mojom/loader/pause_subresource_loading_handle.mojom-blink.h" #include "third_party/blink/public/mojom/loader/pause_subresource_loading_handle.mojom-blink.h"
#include "third_party/blink/public/platform/scheduler/web_resource_loading_task_runner_handle.h" #include "third_party/blink/public/platform/scheduler/web_resource_loading_task_runner_handle.h"
...@@ -49,6 +50,8 @@ class FrameScheduler : public FrameOrWorkerScheduler { ...@@ -49,6 +50,8 @@ class FrameScheduler : public FrameOrWorkerScheduler {
// accordingly. // accordingly.
virtual void UpdateActiveSchedulerTrackedFeatures( virtual void UpdateActiveSchedulerTrackedFeatures(
uint64_t features_mask) = 0; uint64_t features_mask) = 0;
virtual const base::UnguessableToken& GetAgentClusterId() const = 0;
}; };
~FrameScheduler() override = default; ~FrameScheduler() override = default;
......
...@@ -464,6 +464,10 @@ class FrameSchedulerDelegateWithUkmSourceId : public FrameScheduler::Delegate { ...@@ -464,6 +464,10 @@ class FrameSchedulerDelegateWithUkmSourceId : public FrameScheduler::Delegate {
void UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) override {} void UpdateActiveSchedulerTrackedFeatures(uint64_t features_mask) override {}
const base::UnguessableToken& GetAgentClusterId() const override {
return base::UnguessableToken::Null();
}
private: private:
ukm::SourceId source_id_; ukm::SourceId source_id_;
}; };
......
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