summaryrefslogtreecommitdiffstats
path: root/cc/surfaces/surface.cc
diff options
context:
space:
mode:
authorenne <enne@chromium.org>2016-03-08 16:25:12 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-09 00:26:06 +0000
commit4e3c9d5b507f8a7cfb99ef3cc855184943a1dbd8 (patch)
treee37866af865af000937b9f5e75815883260115e3 /cc/surfaces/surface.cc
parent09361b7a2000298da27d831553547eed54a6f894 (diff)
downloadchromium_src-4e3c9d5b507f8a7cfb99ef3cc855184943a1dbd8.zip
chromium_src-4e3c9d5b507f8a7cfb99ef3cc855184943a1dbd8.tar.gz
chromium_src-4e3c9d5b507f8a7cfb99ef3cc855184943a1dbd8.tar.bz2
Hook up BeginFrameSource to SurfaceFactoryClient via SurfaceManager
SurfaceManager now maintains a dag of surface id namespaces. Optionally, a single BeginFrameSource input can be attached to a single namespace node. Every namespace node also has a SurfaceFactoryClient. This client is informed of a current BeginFrameSource, which is chosen from any BeginFrameSource attached to it or a parent of that node. Any children of that namespace also are able to use that source. SurfaceManager is responsible for picking which source to use, of which it currently just picks the first one until that source goes is removed after which it arbitrarily picks another valid one. In practice, this means that a window moved to another display in ChromeOS will switch its BeginFrameSource after the window is dropped onto the new window. Because the users of this dag all have very different requirements, the ordering of SurfaceFactoryClient registration, namespace hierarchy registration, and BeginFrameSource attaching are not particularly strict. BeginFrameSources, SurfaceFactoryClients, and hierarchies can be registered and unregistered in any order with respect to each other. BUG=401331 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1673783004 Cr-Commit-Position: refs/heads/master@{#379988}
Diffstat (limited to 'cc/surfaces/surface.cc')
-rw-r--r--cc/surfaces/surface.cc31
1 files changed, 0 insertions, 31 deletions
diff --git a/cc/surfaces/surface.cc b/cc/surfaces/surface.cc
index 6a96230..281a690 100644
--- a/cc/surfaces/surface.cc
+++ b/cc/surfaces/surface.cc
@@ -39,9 +39,6 @@ Surface::~Surface() {
}
if (!draw_callback_.is_null())
draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED);
-
- if (factory_)
- factory_->SetBeginFrameSource(surface_id_, NULL);
}
void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame,
@@ -178,34 +175,6 @@ void Surface::SatisfyDestructionDependencies(
destruction_dependencies_.end());
}
-void Surface::AddBeginFrameSource(BeginFrameSource* begin_frame_source) {
- DCHECK(base::STLIsSorted(begin_frame_sources_));
- DCHECK(!ContainsValue(begin_frame_sources_, begin_frame_source))
- << begin_frame_source;
- begin_frame_sources_.insert(begin_frame_source);
- UpdatePrimaryBeginFrameSource();
-}
-
-void Surface::RemoveBeginFrameSource(BeginFrameSource* begin_frame_source) {
- size_t erase_count = begin_frame_sources_.erase(begin_frame_source);
- DCHECK_EQ(1u, erase_count);
- UpdatePrimaryBeginFrameSource();
-}
-
-void Surface::UpdatePrimaryBeginFrameSource() {
- // Ensure the BeginFrameSources are sorted so our we make a stable decision
- // regarding which source is primary.
- // TODO(brianderson): Do something smarter based on coverage instead.
- DCHECK(base::STLIsSorted(begin_frame_sources_));
-
- BeginFrameSource* primary_source = nullptr;
- if (!begin_frame_sources_.empty())
- primary_source = *begin_frame_sources_.begin();
-
- if (factory_)
- factory_->SetBeginFrameSource(surface_id_, primary_source);
-}
-
void Surface::ClearCopyRequests() {
if (current_frame_) {
for (const auto& render_pass :