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

Unified Diff: content/renderer/gpu/compositor_output_surface.cc

Issue 2299003002: Remove uses of external begin frame sources (Closed)
Patch Set: Remove Blimp conditional Created 4 years, 3 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/renderer/gpu/compositor_output_surface.h ('k') | content/renderer/gpu/render_widget_compositor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/gpu/compositor_output_surface.cc
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/compositor_output_surface.cc
index de11e048870d5df9c093e4b0caf36c5c17496122..ae668f5404afe6073873c348e6511b28c71d92c8 100644
--- a/content/renderer/gpu/compositor_output_surface.cc
+++ b/content/renderer/gpu/compositor_output_surface.cc
@@ -29,6 +29,7 @@ namespace content {
CompositorOutputSurface::CompositorOutputSurface(
int32_t routing_id,
uint32_t output_surface_id,
+ std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
scoped_refptr<cc::ContextProvider> context_provider,
scoped_refptr<cc::ContextProvider> worker_context_provider,
scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue)
@@ -40,16 +41,19 @@ CompositorOutputSurface::CompositorOutputSurface(
RenderThreadImpl::current()->compositor_message_filter()),
message_sender_(RenderThreadImpl::current()->sync_message_filter()),
frame_swap_message_queue_(swap_frame_message_queue),
+ begin_frame_source_(std::move(begin_frame_source)),
routing_id_(routing_id) {
DCHECK(output_surface_filter_);
DCHECK(frame_swap_message_queue_);
DCHECK(message_sender_);
+ DCHECK(begin_frame_source_);
capabilities_.delegated_rendering = true;
}
CompositorOutputSurface::CompositorOutputSurface(
int32_t routing_id,
uint32_t output_surface_id,
+ std::unique_ptr<cc::BeginFrameSource> begin_frame_source,
scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider,
scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue)
: OutputSurface(std::move(vulkan_context_provider)),
@@ -58,10 +62,12 @@ CompositorOutputSurface::CompositorOutputSurface(
RenderThreadImpl::current()->compositor_message_filter()),
message_sender_(RenderThreadImpl::current()->sync_message_filter()),
frame_swap_message_queue_(swap_frame_message_queue),
+ begin_frame_source_(std::move(begin_frame_source)),
routing_id_(routing_id) {
DCHECK(output_surface_filter_);
DCHECK(frame_swap_message_queue_);
DCHECK(message_sender_);
+ DCHECK(begin_frame_source_);
capabilities_.delegated_rendering = true;
}
@@ -72,6 +78,9 @@ bool CompositorOutputSurface::BindToClient(
if (!cc::OutputSurface::BindToClient(client))
return false;
+ DCHECK(begin_frame_source_);
+ client_->SetBeginFrameSource(begin_frame_source_.get());
+
output_surface_proxy_ = new CompositorOutputSurfaceProxy(this);
output_surface_filter_handler_ =
base::Bind(&CompositorOutputSurfaceProxy::OnMessageReceived,
@@ -94,6 +103,11 @@ bool CompositorOutputSurface::BindToClient(
void CompositorOutputSurface::DetachFromClient() {
if (!HasClient())
return;
+ client_->SetBeginFrameSource(nullptr);
+ // Destroy the begin frame source on the same thread it was bound on.
+ // The OutputSurface itself is destroyed on the main thread.
+ begin_frame_source_ = nullptr;
+
if (output_surface_proxy_) {
output_surface_proxy_->ClearOutputSurface();
output_surface_filter_->RemoveHandlerOnCompositorThread(
« no previous file with comments | « content/renderer/gpu/compositor_output_surface.h ('k') | content/renderer/gpu/render_widget_compositor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698