[go: nahoru, domu]

Refactor client visibility handling

Currently, ContextSupport::SetClientVisibile relies on the caller
remembering to pair visible/not-visible calls. Failure to do so will
result in a "leak", where the context support will always think there
are visible clients.

To avoid this, visibility handling now uses ScopedVisibility objects
which will dcheck if visible > not visible updates are not paired.

This change also introduces a new ContextCacheController object which
handles trimming context caches based on visibility. This simplifies
handling in clients of the ContextProvider and removes this logic
from ContextSupport.

CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel

Review-Url: https://codereview.chromium.org/2278283003
Cr-Commit-Position: refs/heads/master@{#415491}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 801ee86..d4207c5 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -209,6 +209,8 @@
     "output/compositor_frame.h",
     "output/compositor_frame_metadata.cc",
     "output/compositor_frame_metadata.h",
+    "output/context_cache_controller.cc",
+    "output/context_cache_controller.h",
     "output/context_provider.h",
     "output/copy_output_request.cc",
     "output/copy_output_request.h",
@@ -852,6 +854,7 @@
     "output/begin_frame_args_unittest.cc",
     "output/bsp_tree_unittest.cc",
     "output/buffer_to_texture_target_map_unittest.cc",
+    "output/context_cache_controller_unittest.cc",
     "output/delegating_renderer_unittest.cc",
     "output/filter_operations_unittest.cc",
     "output/gl_renderer_unittest.cc",