Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: ui/compositor/compositor.cc

Issue 10537028: aura: Drop unnecessary composites (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More conservative culling of scheduleComposite(). Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/compositor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 6d5e1f1c5b43062db046dc736af49697ff2b4467..4004a537804e6c6062a2ab858fdaf027fe536cdb 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -131,7 +131,10 @@ Compositor::Compositor(CompositorDelegate* delegate,
widget_(widget),
root_web_layer_(WebKit::WebLayer::create()),
swap_posted_(false),
- device_scale_factor_(0.0f) {
+ device_scale_factor_(0.0f),
+ last_started_frame_(0),
+ last_ended_frame_(0),
+ disable_schedule_composite_(false) {
WebKit::WebLayerTreeView::Settings settings;
CommandLine* command_line = CommandLine::ForCurrentProcess();
settings.showFPSCounter =
@@ -178,9 +181,11 @@ void Compositor::Terminate() {
void Compositor::ScheduleDraw() {
if (g_compositor_thread) {
+ disable_schedule_composite_ = true;
piman 2012/06/06 20:17:24 nit: it's probably not useful to do this here, sin
jonathan.backer 2012/06/06 20:31:43 Thanks. Tried to squeeze this in before a meeting.
// TODO(nduca): Temporary while compositor calls
// compositeImmediately() directly.
layout();
+ disable_schedule_composite_ = false;
host_.composite();
} else if (delegate_) {
delegate_->ScheduleDraw();
@@ -204,6 +209,8 @@ void Compositor::Draw(bool force_clear) {
if (!root_layer_)
return;
+ last_started_frame_++;
+
// TODO(nduca): Temporary while compositor calls
// compositeImmediately() directly.
layout();
@@ -290,8 +297,12 @@ void Compositor::updateAnimations(double frameBeginTime) {
}
void Compositor::layout() {
+ // We're sending damage that will be addressed during this composite
+ // cycle, so we don't need to schedule another composite to address it.
+ disable_schedule_composite_ = true;
if (root_layer_)
root_layer_->SendDamagedRects();
+ disable_schedule_composite_ = false;
}
void Compositor::applyScrollAndScale(const WebKit::WebSize& scrollDelta,
@@ -323,7 +334,8 @@ void Compositor::didCompleteSwapBuffers() {
}
void Compositor::scheduleComposite() {
- ScheduleDraw();
+ if (!disable_schedule_composite_)
+ ScheduleDraw();
}
void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels,
@@ -350,6 +362,7 @@ void Compositor::SwizzleRGBAToBGRAAndFlip(unsigned char* pixels,
}
void Compositor::NotifyEnd() {
+ last_ended_frame_++;
FOR_EACH_OBSERVER(CompositorObserver,
observer_list_,
OnCompositingEnded(this));
« no previous file with comments | « ui/compositor/compositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698