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

Unified Diff: aura/desktop.cc

Issue 7770002: gfx::Compositor: SchedulePaint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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 | « aura/desktop.h ('k') | aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: aura/desktop.cc
diff --git a/aura/desktop.cc b/aura/desktop.cc
index b0ffbad17452686af4bd277892b8b750238e9e6b..bca7fd5570c8974753c0d52b8b121f9babb0b09c 100644
--- a/aura/desktop.cc
+++ b/aura/desktop.cc
@@ -17,8 +17,11 @@ namespace aura {
Desktop* Desktop::instance_ = NULL;
Desktop::Desktop()
- : host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768))) {
- compositor_ = ui::Compositor::Create(host_->GetAcceleratedWidget(),
+ : host_(aura::DesktopHost::Create(gfx::Rect(200, 200, 1024, 768))),
+ ALLOW_THIS_IN_INITIALIZER_LIST(schedule_paint_(this)) {
+ DCHECK(MessageLoopForUI::current())
+ << "The UI message loop must be initialized first.";
+ compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(),
host_->GetSize());
host_->SetDesktop(this);
DCHECK(compositor_.get());
@@ -38,7 +41,6 @@ void Desktop::SetSize(const gfx::Size& size) {
void Desktop::Run() {
Show();
- MessageLoop main_message_loop(MessageLoop::TYPE_UI);
MessageLoopForUI::current()->Run(host_);
}
@@ -56,6 +58,13 @@ bool Desktop::OnKeyEvent(const KeyEvent& event) {
return window_->HandleKeyEvent(event);
}
+void Desktop::ScheduleCompositorPaint() {
+ if (schedule_paint_.empty()) {
+ MessageLoop::current()->PostTask(FROM_HERE,
+ schedule_paint_.NewRunnableMethod(&Desktop::Draw));
+ }
+}
+
// static
Desktop* Desktop::GetInstance() {
if (!instance_) {
« no previous file with comments | « aura/desktop.h ('k') | aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698