Index: content/renderer/gpu/renderer_compositor_frame_sink.cc |
diff --git a/content/renderer/gpu/compositor_output_surface.cc b/content/renderer/gpu/renderer_compositor_frame_sink.cc |
similarity index 61% |
rename from content/renderer/gpu/compositor_output_surface.cc |
rename to content/renderer/gpu/renderer_compositor_frame_sink.cc |
index bc5ec31812fa6073190e193af1f10ce5ba4803e1..4cfbdfc01e775f72f73d924ec91029753f1876b0 100644 |
--- a/content/renderer/gpu/compositor_output_surface.cc |
+++ b/content/renderer/gpu/renderer_compositor_frame_sink.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "content/renderer/gpu/compositor_output_surface.h" |
+#include "content/renderer/gpu/renderer_compositor_frame_sink.h" |
#include <utility> |
@@ -12,8 +12,8 @@ |
#include "base/threading/thread_task_runner_handle.h" |
#include "build/build_config.h" |
#include "cc/output/compositor_frame.h" |
+#include "cc/output/compositor_frame_sink_client.h" |
#include "cc/output/managed_memory_policy.h" |
-#include "cc/output/output_surface_client.h" |
#include "content/common/gpu/client/context_provider_command_buffer.h" |
#include "content/common/view_messages.h" |
#include "content/public/common/content_switches.h" |
@@ -26,88 +26,87 @@ |
namespace content { |
-CompositorOutputSurface::CompositorOutputSurface( |
+RendererCompositorFrameSink::RendererCompositorFrameSink( |
int32_t routing_id, |
- uint32_t output_surface_id, |
+ uint32_t compositor_frame_sink_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) |
- : OutputSurface(std::move(context_provider), |
- std::move(worker_context_provider), |
- nullptr), |
- output_surface_id_(output_surface_id), |
- output_surface_filter_( |
+ : CompositorFrameSink(std::move(context_provider), |
+ std::move(worker_context_provider), |
+ nullptr), |
+ compositor_frame_sink_id_(compositor_frame_sink_id), |
+ compositor_frame_sink_filter_( |
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(compositor_frame_sink_filter_); |
DCHECK(frame_swap_message_queue_); |
DCHECK(message_sender_); |
DCHECK(begin_frame_source_); |
capabilities_.delegated_rendering = true; |
} |
-CompositorOutputSurface::CompositorOutputSurface( |
+RendererCompositorFrameSink::RendererCompositorFrameSink( |
int32_t routing_id, |
- uint32_t output_surface_id, |
+ uint32_t compositor_frame_sink_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)), |
- output_surface_id_(output_surface_id), |
- output_surface_filter_( |
+ : CompositorFrameSink(std::move(vulkan_context_provider)), |
+ compositor_frame_sink_id_(compositor_frame_sink_id), |
+ compositor_frame_sink_filter_( |
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(compositor_frame_sink_filter_); |
DCHECK(frame_swap_message_queue_); |
DCHECK(message_sender_); |
DCHECK(begin_frame_source_); |
capabilities_.delegated_rendering = true; |
} |
-CompositorOutputSurface::~CompositorOutputSurface() = default; |
+RendererCompositorFrameSink::~RendererCompositorFrameSink() = default; |
-bool CompositorOutputSurface::BindToClient( |
- cc::OutputSurfaceClient* client) { |
- if (!cc::OutputSurface::BindToClient(client)) |
+bool RendererCompositorFrameSink::BindToClient( |
+ cc::CompositorFrameSinkClient* client) { |
+ if (!cc::CompositorFrameSink::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, |
- output_surface_proxy_); |
- output_surface_filter_->AddHandlerOnCompositorThread( |
- routing_id_, |
- output_surface_filter_handler_); |
+ compositor_frame_sink_proxy_ = new RendererCompositorFrameSinkProxy(this); |
+ compositor_frame_sink_filter_handler_ = |
+ base::Bind(&RendererCompositorFrameSinkProxy::OnMessageReceived, |
+ compositor_frame_sink_proxy_); |
+ compositor_frame_sink_filter_->AddHandlerOnCompositorThread( |
+ routing_id_, compositor_frame_sink_filter_handler_); |
return true; |
} |
-void CompositorOutputSurface::DetachFromClient() { |
+void RendererCompositorFrameSink::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. |
+ // The CompositorFrameSink itself is destroyed on the main thread. |
begin_frame_source_ = nullptr; |
- if (output_surface_proxy_) { |
- output_surface_proxy_->ClearOutputSurface(); |
- output_surface_filter_->RemoveHandlerOnCompositorThread( |
- routing_id_, output_surface_filter_handler_); |
+ if (compositor_frame_sink_proxy_) { |
+ compositor_frame_sink_proxy_->ClearCompositorFrameSink(); |
+ compositor_frame_sink_filter_->RemoveHandlerOnCompositorThread( |
+ routing_id_, compositor_frame_sink_filter_handler_); |
} |
- cc::OutputSurface::DetachFromClient(); |
+ cc::CompositorFrameSink::DetachFromClient(); |
} |
-void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) { |
+void RendererCompositorFrameSink::SwapBuffers(cc::CompositorFrame frame) { |
{ |
std::unique_ptr<FrameSwapMessageQueue::SendMessageScope> |
send_message_scope = |
@@ -117,48 +116,49 @@ void CompositorOutputSurface::SwapBuffers(cc::CompositorFrame frame) { |
frame_swap_message_queue_->DrainMessages(&messages); |
FrameSwapMessageQueue::TransferMessages(&messages, |
&messages_to_deliver_with_frame); |
- Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, output_surface_id_, |
- frame, |
+ Send(new ViewHostMsg_SwapCompositorFrame(routing_id_, |
+ compositor_frame_sink_id_, frame, |
messages_to_deliver_with_frame)); |
// ~send_message_scope. |
} |
} |
-void CompositorOutputSurface::BindFramebuffer() { |
+void RendererCompositorFrameSink::BindFramebuffer() { |
// This is a delegating output surface, no framebuffer/direct drawing support. |
NOTREACHED(); |
} |
-uint32_t CompositorOutputSurface::GetFramebufferCopyTextureFormat() { |
+uint32_t RendererCompositorFrameSink::GetFramebufferCopyTextureFormat() { |
// This is a delegating output surface, no framebuffer/direct drawing support. |
NOTREACHED(); |
return 0; |
} |
-void CompositorOutputSurface::OnMessageReceived(const IPC::Message& message) { |
+void RendererCompositorFrameSink::OnMessageReceived( |
+ const IPC::Message& message) { |
DCHECK(client_thread_checker_.CalledOnValidThread()); |
if (!HasClient()) |
return; |
- IPC_BEGIN_MESSAGE_MAP(CompositorOutputSurface, message) |
+ IPC_BEGIN_MESSAGE_MAP(RendererCompositorFrameSink, message) |
IPC_MESSAGE_HANDLER(ViewMsg_ReclaimCompositorResources, |
OnReclaimCompositorResources); |
IPC_END_MESSAGE_MAP() |
} |
-void CompositorOutputSurface::OnReclaimCompositorResources( |
- uint32_t output_surface_id, |
+void RendererCompositorFrameSink::OnReclaimCompositorResources( |
+ uint32_t compositor_frame_sink_id, |
bool is_swap_ack, |
const cc::ReturnedResourceArray& resources) { |
// Ignore message if it's a stale one coming from a different output surface |
// (e.g. after a lost context). |
- if (output_surface_id != output_surface_id_) |
+ if (compositor_frame_sink_id != compositor_frame_sink_id_) |
return; |
client_->ReclaimResources(resources); |
if (is_swap_ack) |
client_->DidSwapBuffersComplete(); |
} |
-bool CompositorOutputSurface::Send(IPC::Message* message) { |
+bool RendererCompositorFrameSink::Send(IPC::Message* message) { |
return message_sender_->Send(message); |
} |