Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1099)

Unified Diff: content/browser/android/synchronous_compositor_browser_filter.cc

Issue 2452893002: sync compositor: Signal futures on channel shutdown (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/android/synchronous_compositor_browser_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/synchronous_compositor_browser_filter.cc
diff --git a/content/browser/android/synchronous_compositor_browser_filter.cc b/content/browser/android/synchronous_compositor_browser_filter.cc
index 41999b3778320406491c7a14c2644b7e80f4ceaf..d1a7b9f9c9873fd7c0e646256f5d12e43d0be213 100644
--- a/content/browser/android/synchronous_compositor_browser_filter.cc
+++ b/content/browser/android/synchronous_compositor_browser_filter.cc
@@ -19,14 +19,13 @@ namespace content {
SynchronousCompositorBrowserFilter::SynchronousCompositorBrowserFilter(
int process_id)
: BrowserMessageFilter(SyncCompositorMsgStart),
- render_process_host_(RenderProcessHost::FromID(process_id)),
- window_android_in_vsync_(nullptr) {
+ render_process_host_(RenderProcessHost::FromID(process_id)) {
DCHECK(render_process_host_);
}
SynchronousCompositorBrowserFilter::~SynchronousCompositorBrowserFilter() {
DCHECK(compositor_host_pending_renderer_state_.empty());
- // TODO(boliu): signal pending frames.
+ DCHECK(future_map_.empty());
}
void SynchronousCompositorBrowserFilter::SyncStateAfterVSync(
@@ -96,6 +95,11 @@ void SynchronousCompositorBrowserFilter::SetFrameFuture(
scoped_refptr<SynchronousCompositor::FrameFuture> frame_future) {
DCHECK(frame_future);
base::AutoLock lock(future_map_lock_);
+ if (!filter_ready_) {
+ frame_future->setFrame(nullptr);
+ return;
+ }
+
auto itr = future_map_.find(routing_id);
if (itr == future_map_.end()) {
auto emplace_result = future_map_.emplace(routing_id, FrameFutureQueue());
@@ -112,6 +116,30 @@ void SynchronousCompositorBrowserFilter::SetFrameFuture(
itr->second.emplace_back(std::move(frame_future));
}
+void SynchronousCompositorBrowserFilter::OnFilterAdded(IPC::Channel* channel) {
+ base::AutoLock lock(future_map_lock_);
+ filter_ready_ = true;
+}
+
+void SynchronousCompositorBrowserFilter::OnFilterRemoved() {
+ SignalAllFutures();
+}
+
+void SynchronousCompositorBrowserFilter::OnChannelClosing() {
+ SignalAllFutures();
+}
+
+void SynchronousCompositorBrowserFilter::SignalAllFutures() {
+ base::AutoLock lock(future_map_lock_);
+ for (auto& pair : future_map_) {
+ for (auto& future_ptr : pair.second) {
+ future_ptr->setFrame(nullptr);
+ }
+ }
+ future_map_.clear();
+ filter_ready_ = false;
+}
+
void SynchronousCompositorBrowserFilter::OnCompositingDidCommit() {
NOTREACHED();
}
« no previous file with comments | « content/browser/android/synchronous_compositor_browser_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698