Commit e5cc6b1b authored by dtrainor's avatar dtrainor Committed by Commit bot

Fix DelegatedOutputSurface in Blimp

Make sure to build a BeginFrameSource when binding to the
OutputSurfaceClient.  Without this the compositor doesn't push frames.

This was broken by https://codereview.chromium.org/2083423006 because
BlimpLayerTreeSettings sets use_output_surface_begin_frame_source but
one wasn't provided by the DelegatedOutputSurface.

Infrastructure to add a Blimp test for this is almost complete and will
be added in a follow up CL!
BUG=

Review-Url: https://codereview.chromium.org/2308143002
Cr-Commit-Position: refs/heads/master@{#416395}
parent c4a5b6ba
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "base/threading/thread_task_runner_handle.h"
#include "cc/output/compositor_frame.h" #include "cc/output/compositor_frame.h"
#include "cc/output/output_surface_client.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/scheduler/delay_based_time_source.h"
namespace blimp { namespace blimp {
namespace client { namespace client {
...@@ -46,6 +50,11 @@ uint32_t DelegatedOutputSurface::GetFramebufferCopyTextureFormat() { ...@@ -46,6 +50,11 @@ uint32_t DelegatedOutputSurface::GetFramebufferCopyTextureFormat() {
bool DelegatedOutputSurface::BindToClient(cc::OutputSurfaceClient* client) { bool DelegatedOutputSurface::BindToClient(cc::OutputSurfaceClient* client) {
bool success = cc::OutputSurface::BindToClient(client); bool success = cc::OutputSurface::BindToClient(client);
if (success) { if (success) {
begin_frame_source_ = base::MakeUnique<cc::DelayBasedBeginFrameSource>(
base::MakeUnique<cc::DelayBasedTimeSource>(
base::ThreadTaskRunnerHandle::Get().get()));
client->SetBeginFrameSource(begin_frame_source_.get());
main_task_runner_->PostTask( main_task_runner_->PostTask(
FROM_HERE, base::Bind(&BlimpOutputSurfaceClient::BindToOutputSurface, FROM_HERE, base::Bind(&BlimpOutputSurfaceClient::BindToOutputSurface,
client_, weak_factory_.GetWeakPtr())); client_, weak_factory_.GetWeakPtr()));
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ #ifndef BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_
#define BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_ #define BLIMP_CLIENT_CORE_COMPOSITOR_DELEGATED_OUTPUT_SURFACE_H_
#include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "blimp/client/core/compositor/blimp_output_surface.h" #include "blimp/client/core/compositor/blimp_output_surface.h"
...@@ -15,6 +17,7 @@ class SingleThreadTaskRunner; ...@@ -15,6 +17,7 @@ class SingleThreadTaskRunner;
} // namespace base } // namespace base
namespace cc { namespace cc {
class BeginFrameSource;
class ContextProvider; class ContextProvider;
} // namespace cc } // namespace cc
...@@ -50,6 +53,11 @@ class DelegatedOutputSurface : public cc::OutputSurface, ...@@ -50,6 +53,11 @@ class DelegatedOutputSurface : public cc::OutputSurface,
bool bound_to_client_; bool bound_to_client_;
// This OutputSurface is responsible for providing the BeginFrameSource to
// drive frame creation. This will be built on the compositor impl thread at
// BindToClient call time.
std::unique_ptr<cc::BeginFrameSource> begin_frame_source_;
base::WeakPtrFactory<DelegatedOutputSurface> weak_factory_; base::WeakPtrFactory<DelegatedOutputSurface> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(DelegatedOutputSurface); DISALLOW_COPY_AND_ASSIGN(DelegatedOutputSurface);
......
...@@ -87,10 +87,6 @@ void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) { ...@@ -87,10 +87,6 @@ void PopulateCommonLayerTreeSettings(cc::LayerTreeSettings* settings) {
// TODO(danakj): Only do this on low end devices. // TODO(danakj): Only do this on low end devices.
settings->create_low_res_tiling = true; settings->create_low_res_tiling = true;
// TODO(dtrainor): Investigate whether or not we want to use an external
// source here.
// settings->use_external_begin_frame_source = true;
#elif !defined(OS_MACOSX) #elif !defined(OS_MACOSX)
settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; settings->scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
settings->solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); settings->solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment