diff options
author | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 06:07:45 +0000 |
---|---|---|
committer | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 06:09:03 +0000 |
commit | c90f0d8d1fd4e95d6d26fc1454bf9c8094d51ecb (patch) | |
tree | 8b47c23a049f5e6d9e00e7f970637e0acc7fd908 /content/browser/compositor/onscreen_display_client.cc | |
parent | e510e37dda59f01b402489d2b8fdc9b2f05d4f0c (diff) | |
download | chromium_src-c90f0d8d1fd4e95d6d26fc1454bf9c8094d51ecb.zip chromium_src-c90f0d8d1fd4e95d6d26fc1454bf9c8094d51ecb.tar.gz chromium_src-c90f0d8d1fd4e95d6d26fc1454bf9c8094d51ecb.tar.bz2 |
Enqueuing new frames in a Surface should cause Displays to reaggregate it
Keep track of which Surfaces were included in a Display last
frame, so if a new frame is enqueued in a Surface the Displays containing it will tell their clients to redraw. This way the browser compositor
doesn't have to commit if only the renderer contents changed.
BUG=
Review URL: https://codereview.chromium.org/432093003
Cr-Commit-Position: refs/heads/master@{#290103}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/compositor/onscreen_display_client.cc')
-rw-r--r-- | content/browser/compositor/onscreen_display_client.cc | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/content/browser/compositor/onscreen_display_client.cc b/content/browser/compositor/onscreen_display_client.cc index a071a21..1f5859d0 100644 --- a/content/browser/compositor/onscreen_display_client.cc +++ b/content/browser/compositor/onscreen_display_client.cc @@ -4,6 +4,7 @@ #include "content/browser/compositor/onscreen_display_client.h" +#include "base/debug/trace_event.h" #include "cc/output/output_surface.h" #include "cc/surfaces/surface_factory.h" #include "cc/surfaces/surface_manager.h" @@ -14,12 +15,15 @@ namespace content { OnscreenDisplayClient::OnscreenDisplayClient( const scoped_refptr<cc::ContextProvider>& onscreen_context_provider, scoped_ptr<cc::OutputSurface> software_surface, - cc::SurfaceManager* manager) + cc::SurfaceManager* manager, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) : onscreen_context_provider_(onscreen_context_provider), software_surface_(software_surface.Pass()), - display_(new cc::Display(this, - manager, - HostSharedBitmapManager::current())) { + display_( + new cc::Display(this, manager, HostSharedBitmapManager::current())), + task_runner_(task_runner), + scheduled_draw_(false), + weak_ptr_factory_(this) { } OnscreenDisplayClient::~OnscreenDisplayClient() { @@ -32,4 +36,20 @@ scoped_ptr<cc::OutputSurface> OnscreenDisplayClient::CreateOutputSurface() { .Pass(); } +void OnscreenDisplayClient::DisplayDamaged() { + if (scheduled_draw_) + return; + TRACE_EVENT0("content", "OnscreenDisplayClient::DisplayDamaged"); + scheduled_draw_ = true; + task_runner_->PostTask( + FROM_HERE, + base::Bind(&OnscreenDisplayClient::Draw, weak_ptr_factory_.GetWeakPtr())); +} + +void OnscreenDisplayClient::Draw() { + TRACE_EVENT0("content", "OnscreenDisplayClient::Draw"); + scheduled_draw_ = false; + display_->Draw(); +} + } // namespace content |