[go: nahoru, domu]

Support ADPF on the browser IO thread.

ADPF (Android Dynamic Performance Framework) allows dynamic
performance hinting to the Android platform. The IO thread was
initially excluded as an oversight.

# crbug.com/1414157

Validate-Test-Flakiness: skip
Bug: 1415334
Change-Id: I751d7f710572b41554c55092d588f00bf7cb6532
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4245317
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1106254}
diff --git a/cc/slim/frame_sink_impl.cc b/cc/slim/frame_sink_impl.cc
index fb8e04c..d151eba 100644
--- a/cc/slim/frame_sink_impl.cc
+++ b/cc/slim/frame_sink_impl.cc
@@ -42,12 +42,14 @@
         compositor_frame_sink_associated_remote,
     mojo::PendingReceiver<viz::mojom::CompositorFrameSinkClient>
         client_receiver,
-    scoped_refptr<viz::ContextProvider> context_provider)
+    scoped_refptr<viz::ContextProvider> context_provider,
+    base::PlatformThreadId io_thread_id)
     : task_runner_(std::move(task_runner)),
       pending_compositor_frame_sink_associated_remote_(
           std::move(compositor_frame_sink_associated_remote)),
       pending_client_receiver_(std::move(client_receiver)),
-      context_provider_(std::move(context_provider)) {}
+      context_provider_(std::move(context_provider)),
+      io_thread_id_(io_thread_id) {}
 
 FrameSinkImpl::~FrameSinkImpl() {
   resource_provider_.ShutdownAndReleaseAllResources();
@@ -88,6 +90,9 @@
 #if BUILDFLAG(IS_ANDROID)
   std::vector<int32_t> thread_ids;
   thread_ids.push_back(base::PlatformThread::CurrentId());
+  if (io_thread_id_ != base::kInvalidThreadId) {
+    thread_ids.push_back(io_thread_id_);
+  }
   frame_sink_remote_->SetThreadIds(thread_ids);
 #endif
   return true;