[go: nahoru, domu]

cc: Use correct message loop proxy in BlockingTaskRunner

The compositor makes it possible to customize the message loop proxy
both on the main and impl threads. However BlockingTaskRunner just uses
base::MessageLoopProxy::current() directly and thus overrides this
choice. Using the correct message loop proxy is important because
clients of BlockingTaskRunner have an implicit dependency on the
ordering of tasks posted to BlockingTaskRunner vs. all other tasks
posted to the task runner for that same thread.

This patch fixes the problem by removing the thread-local
BlockingTaskRunner::current() instance in favor of an explicitly
constructed instance which is given a specific SingleThreadTaskRunner
to use. The resource provider is changed to pass a Proxy-owned
blocking task runner to the clients which need one.

BUG=391005
TEST=1. Apply https://codereview.chromium.org/363383002
     2. out/Debug/chrome --disable-impl-side-painting --ignore-gpu-blacklist tools/perf/page_sets/tough_scheduling_cases/raf_canvas.html

Review URL: https://codereview.chromium.org/485043003

Cr-Commit-Position: refs/heads/master@{#293353}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 109b54b..43a6c6d 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -399,6 +399,8 @@
     "resources/shared_bitmap_manager.h",
     "resources/single_release_callback.cc",
     "resources/single_release_callback.h",
+    "resources/single_release_callback_impl.cc",
+    "resources/single_release_callback_impl.h",
     "resources/skpicture_content_layer_updater.cc",
     "resources/skpicture_content_layer_updater.h",
     "resources/task_graph_runner.cc",
@@ -724,6 +726,7 @@
     "scheduler/scheduler_unittest.cc",
     "test/layer_tree_json_parser_unittest.cc",
     "test/test_web_graphics_context_3d_unittest.cc",
+    "trees/blocking_task_runner_unittest.cc",
     "trees/damage_tracker_unittest.cc",
     "trees/layer_sorter_unittest.cc",
     "trees/layer_tree_host_common_unittest.cc",