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

Unified Diff: content/renderer/android/synchronous_compositor_filter.cc

Issue 1773873002: sync compositor: Handle context loss (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
Index: content/renderer/android/synchronous_compositor_filter.cc
diff --git a/content/renderer/android/synchronous_compositor_filter.cc b/content/renderer/android/synchronous_compositor_filter.cc
index b01ce0712c766a177758a1ff473a7115b71360c6..ae42cc31d455758251ef66fc2509af7fa1b7eaf3 100644
--- a/content/renderer/android/synchronous_compositor_filter.cc
+++ b/content/renderer/android/synchronous_compositor_filter.cc
@@ -4,6 +4,8 @@
#include "content/renderer/android/synchronous_compositor_filter.h"
+#include <utility>
+
#include "base/callback.h"
#include "base/stl_util.h"
#include "base/thread_task_runner_handle.h"
@@ -128,7 +130,11 @@ void SynchronousCompositorFilter::RegisterOutputSurface(
Entry& entry = entry_map_[routing_id];
DCHECK(!entry.output_surface);
entry.output_surface = output_surface;
- CheckIsReady(routing_id);
+
+ SynchronousCompositorProxy* proxy = FindProxy(routing_id);
+ if (proxy) {
+ proxy->SetOutputSurface(output_surface);
+ }
}
void SynchronousCompositorFilter::UnregisterOutputSurface(
@@ -140,8 +146,10 @@ void SynchronousCompositorFilter::UnregisterOutputSurface(
Entry& entry = entry_map_[routing_id];
DCHECK_EQ(output_surface, entry.output_surface);
- if (entry.IsReady())
- UnregisterObjects(routing_id);
+ SynchronousCompositorProxy* proxy = FindProxy(routing_id);
+ if (proxy) {
+ proxy->SetOutputSurface(nullptr);
+ }
entry.output_surface = nullptr;
RemoveEntryIfNeeded(routing_id);
}
@@ -178,11 +186,12 @@ void SynchronousCompositorFilter::CheckIsReady(int routing_id) {
Entry& entry = entry_map_[routing_id];
if (filter_ready_ && entry.IsReady()) {
DCHECK(!sync_compositor_map_.contains(routing_id));
- sync_compositor_map_.add(
- routing_id,
- make_scoped_ptr(new SynchronousCompositorProxy(
- routing_id, this, entry.output_surface, entry.begin_frame_source,
- entry.synchronous_input_handler_proxy, &input_handler_)));
+ scoped_ptr<SynchronousCompositorProxy> proxy(new SynchronousCompositorProxy(
+ routing_id, this, entry.begin_frame_source,
+ entry.synchronous_input_handler_proxy, &input_handler_));
+ if (entry.output_surface)
+ proxy->SetOutputSurface(entry.output_surface);
+ sync_compositor_map_.add(routing_id, std::move(proxy));
}
}
@@ -269,8 +278,7 @@ SynchronousCompositorFilter::Entry::Entry()
synchronous_input_handler_proxy(nullptr) {}
bool SynchronousCompositorFilter::Entry::IsReady() {
- return begin_frame_source && output_surface &&
- synchronous_input_handler_proxy;
+ return begin_frame_source && synchronous_input_handler_proxy;
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698