| Index: content/browser/android/in_process/synchronous_compositor_impl.cc
|
| diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc
|
| index 702164b5a8fcefc139ed4ea4b00d57e9dbec8071..cc69d8d8097db5d9203f70c7ad189bd7dd962d00 100644
|
| --- a/content/browser/android/in_process/synchronous_compositor_impl.cc
|
| +++ b/content/browser/android/in_process/synchronous_compositor_impl.cc
|
| @@ -4,9 +4,11 @@
|
|
|
| #include "content/browser/android/in_process/synchronous_compositor_impl.h"
|
|
|
| +#include "base/auto_reset.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "cc/input/input_handler.h"
|
| +#include "content/browser/android/in_process/synchronous_compositor_external_begin_frame_source.h"
|
| #include "content/browser/android/in_process/synchronous_compositor_factory_impl.h"
|
| #include "content/browser/android/in_process/synchronous_input_event_filter.h"
|
| #include "content/browser/renderer_host/render_widget_host_view_android.h"
|
| @@ -65,8 +67,10 @@ SynchronousCompositorImpl* SynchronousCompositorImpl::FromRoutingID(
|
| SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents)
|
| : compositor_client_(NULL),
|
| output_surface_(NULL),
|
| + begin_frame_source_(NULL),
|
| contents_(contents),
|
| input_handler_(NULL),
|
| + invoking_composite_(false),
|
| weak_ptr_factory_(this) {
|
| DCHECK(contents);
|
| }
|
| @@ -94,6 +98,12 @@ void SynchronousCompositor::SetRecordFullDocument(bool record_full_document) {
|
| g_factory.Get().SetRecordFullDocument(record_full_document);
|
| }
|
|
|
| +void SynchronousCompositorImpl::SetExternalBeginFrameSource(
|
| + SynchronousCompositorExternalBeginFrameSource* begin_frame_source) {
|
| + DCHECK(!begin_frame_source_);
|
| + begin_frame_source_ = begin_frame_source;
|
| +}
|
| +
|
| bool SynchronousCompositorImpl::InitializeHwDraw() {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(output_surface_);
|
| @@ -124,6 +134,9 @@ scoped_ptr<cc::CompositorFrame> SynchronousCompositorImpl::DemandDrawHw(
|
| const gfx::Transform& transform_for_tile_priority) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(output_surface_);
|
| + DCHECK(!invoking_composite_);
|
| + DCHECK(begin_frame_source_);
|
| + base::AutoReset<bool> invoking_composite_resetter(&invoking_composite_, true);
|
|
|
| scoped_ptr<cc::CompositorFrame> frame =
|
| output_surface_->DemandDrawHw(surface_size,
|
| @@ -135,6 +148,9 @@ scoped_ptr<cc::CompositorFrame> SynchronousCompositorImpl::DemandDrawHw(
|
| if (frame.get())
|
| UpdateFrameMetaData(frame->metadata);
|
|
|
| + begin_frame_source_->BeginFrame();
|
| + SetContinuousInvalidate(begin_frame_source_->NeedsBeginFrames());
|
| +
|
| return frame.Pass();
|
| }
|
|
|
| @@ -147,10 +163,17 @@ void SynchronousCompositorImpl::ReturnResources(
|
| bool SynchronousCompositorImpl::DemandDrawSw(SkCanvas* canvas) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(output_surface_);
|
| + DCHECK(!invoking_composite_);
|
| + DCHECK(begin_frame_source_);
|
| + base::AutoReset<bool> invoking_composite_resetter(&invoking_composite_, true);
|
|
|
| scoped_ptr<cc::CompositorFrame> frame = output_surface_->DemandDrawSw(canvas);
|
| if (frame.get())
|
| UpdateFrameMetaData(frame->metadata);
|
| +
|
| + begin_frame_source_->BeginFrame();
|
| + SetContinuousInvalidate(begin_frame_source_->NeedsBeginFrames());
|
| +
|
| return !!frame.get();
|
| }
|
|
|
| @@ -227,10 +250,11 @@ void SynchronousCompositorImpl::DidStopFlinging() {
|
| rwhv->DidStopFlinging();
|
| }
|
|
|
| -void SynchronousCompositorImpl::SetContinuousInvalidate(bool enable) {
|
| +void SynchronousCompositorImpl::SetContinuousInvalidate(
|
| + bool needs_begin_frames) const {
|
| DCHECK(CalledOnValidThread());
|
| if (compositor_client_)
|
| - compositor_client_->SetContinuousInvalidate(enable);
|
| + compositor_client_->SetContinuousInvalidate(needs_begin_frames);
|
| }
|
|
|
| InputEventAckState SynchronousCompositorImpl::HandleInputEvent(
|
|
|