Index: content/browser/compositor/onscreen_display_client.cc |
diff --git a/content/browser/compositor/onscreen_display_client.cc b/content/browser/compositor/onscreen_display_client.cc |
index a071a213a28c3b750be768eada7f6e694893b2d2..1f5859d025380af06066969d2fe389dba200ec3f 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 |