| Index: blimp/client/core/compositor/blimp_compositor_frame_sink.cc
|
| diff --git a/blimp/client/core/compositor/delegated_output_surface.cc b/blimp/client/core/compositor/blimp_compositor_frame_sink.cc
|
| similarity index 55%
|
| rename from blimp/client/core/compositor/delegated_output_surface.cc
|
| rename to blimp/client/core/compositor/blimp_compositor_frame_sink.cc
|
| index 5c2a5a5290fcde4bcb8f6340d01274a344ba9a01..79b467dd3fe072ce053eb528dd36013a2a140ac0 100644
|
| --- a/blimp/client/core/compositor/delegated_output_surface.cc
|
| +++ b/blimp/client/core/compositor/blimp_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 "blimp/client/core/compositor/delegated_output_surface.h"
|
| +#include "blimp/client/core/compositor/blimp_compositor_frame_sink.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/logging.h"
|
| @@ -11,44 +11,45 @@
|
| #include "base/threading/thread_checker.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "cc/output/compositor_frame.h"
|
| -#include "cc/output/output_surface_client.h"
|
| +#include "cc/output/compositor_frame_sink_client.h"
|
| #include "cc/scheduler/begin_frame_source.h"
|
| #include "cc/scheduler/delay_based_time_source.h"
|
|
|
| namespace blimp {
|
| namespace client {
|
|
|
| -DelegatedOutputSurface::DelegatedOutputSurface(
|
| +BlimpCompositorFrameSink::BlimpCompositorFrameSink(
|
| scoped_refptr<cc::ContextProvider> compositor_context_provider,
|
| scoped_refptr<cc::ContextProvider> worker_context_provider,
|
| scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
|
| - base::WeakPtr<BlimpOutputSurfaceClient> client)
|
| - : cc::OutputSurface(std::move(compositor_context_provider),
|
| - std::move(worker_context_provider),
|
| - nullptr),
|
| + base::WeakPtr<BlimpCompositorFrameSinkProxy> main_thread_proxy)
|
| + : cc::CompositorFrameSink(std::move(compositor_context_provider),
|
| + std::move(worker_context_provider),
|
| + nullptr),
|
| main_task_runner_(std::move(main_task_runner)),
|
| - blimp_client_(client),
|
| + main_thread_proxy_(main_thread_proxy),
|
| bound_to_client_(false),
|
| weak_factory_(this) {
|
| DCHECK(main_task_runner_->BelongsToCurrentThread());
|
| capabilities_.delegated_rendering = true;
|
| }
|
|
|
| -DelegatedOutputSurface::~DelegatedOutputSurface() = default;
|
| +BlimpCompositorFrameSink::~BlimpCompositorFrameSink() = default;
|
|
|
| -void DelegatedOutputSurface::ReclaimCompositorResources(
|
| +void BlimpCompositorFrameSink::ReclaimCompositorResources(
|
| const cc::ReturnedResourceArray& resources) {
|
| DCHECK(client_thread_checker_.CalledOnValidThread());
|
| client_->ReclaimResources(resources);
|
| }
|
|
|
| -uint32_t DelegatedOutputSurface::GetFramebufferCopyTextureFormat() {
|
| +uint32_t BlimpCompositorFrameSink::GetFramebufferCopyTextureFormat() {
|
| NOTREACHED() << "Should not be called on delegated output surface";
|
| return 0;
|
| }
|
|
|
| -bool DelegatedOutputSurface::BindToClient(cc::OutputSurfaceClient* client) {
|
| - bool success = cc::OutputSurface::BindToClient(client);
|
| +bool BlimpCompositorFrameSink::BindToClient(
|
| + cc::CompositorFrameSinkClient* client) {
|
| + bool success = cc::CompositorFrameSink::BindToClient(client);
|
| if (success) {
|
| begin_frame_source_ = base::MakeUnique<cc::DelayBasedBeginFrameSource>(
|
| base::MakeUnique<cc::DelayBasedTimeSource>(
|
| @@ -56,29 +57,29 @@ bool DelegatedOutputSurface::BindToClient(cc::OutputSurfaceClient* client) {
|
| client->SetBeginFrameSource(begin_frame_source_.get());
|
|
|
| main_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&BlimpOutputSurfaceClient::BindToOutputSurface,
|
| - blimp_client_, weak_factory_.GetWeakPtr()));
|
| + FROM_HERE, base::Bind(&BlimpCompositorFrameSinkProxy::BindToProxyClient,
|
| + main_thread_proxy_, weak_factory_.GetWeakPtr()));
|
| }
|
| return success;
|
| }
|
|
|
| -void DelegatedOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
|
| +void BlimpCompositorFrameSink::SwapBuffers(cc::CompositorFrame frame) {
|
| DCHECK(client_thread_checker_.CalledOnValidThread());
|
|
|
| main_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&BlimpOutputSurfaceClient::SwapCompositorFrame,
|
| - blimp_client_, base::Passed(&frame)));
|
| - cc::OutputSurface::PostSwapBuffersComplete();
|
| + FROM_HERE, base::Bind(&BlimpCompositorFrameSinkProxy::SwapCompositorFrame,
|
| + main_thread_proxy_, base::Passed(&frame)));
|
| + cc::CompositorFrameSink::PostSwapBuffersComplete();
|
| }
|
|
|
| -void DelegatedOutputSurface::DetachFromClient() {
|
| - cc::OutputSurface::DetachFromClient();
|
| +void BlimpCompositorFrameSink::DetachFromClient() {
|
| + cc::CompositorFrameSink::DetachFromClient();
|
|
|
| if (bound_to_client_ == true) {
|
| bound_to_client_ = false;
|
| main_task_runner_->PostTask(
|
| - FROM_HERE, base::Bind(&BlimpOutputSurfaceClient::UnbindOutputSurface,
|
| - blimp_client_));
|
| + FROM_HERE, base::Bind(&BlimpCompositorFrameSinkProxy::UnbindProxyClient,
|
| + main_thread_proxy_));
|
| }
|
|
|
| weak_factory_.InvalidateWeakPtrs();
|
|
|