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

Side by Side Diff: ui/aura/root_window.cc

Issue 10453117: Tighter sync and faster ACK on SwapBuffers/PostSubBuffers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 mouse_moved_handler_(NULL), 124 mouse_moved_handler_(NULL),
125 ALLOW_THIS_IN_INITIALIZER_LIST( 125 ALLOW_THIS_IN_INITIALIZER_LIST(
126 gesture_recognizer_(ui::GestureRecognizer::Create(this))), 126 gesture_recognizer_(ui::GestureRecognizer::Create(this))),
127 synthesize_mouse_move_(false), 127 synthesize_mouse_move_(false),
128 waiting_on_compositing_end_(false), 128 waiting_on_compositing_end_(false),
129 draw_on_compositing_end_(false), 129 draw_on_compositing_end_(false),
130 defer_draw_scheduling_(false), 130 defer_draw_scheduling_(false),
131 mouse_move_hold_count_(0), 131 mouse_move_hold_count_(0),
132 should_hold_mouse_moves_(false), 132 should_hold_mouse_moves_(false),
133 compositor_lock_(NULL), 133 compositor_lock_(NULL),
134 draw_on_compositor_unlock_(false), 134 draw_on_compositor_unlock_(false) {
135 draw_trace_count_(0) {
136 SetName("RootWindow"); 135 SetName("RootWindow");
137 should_hold_mouse_moves_ = !CommandLine::ForCurrentProcess()->HasSwitch( 136 should_hold_mouse_moves_ = !CommandLine::ForCurrentProcess()->HasSwitch(
138 switches::kAuraDisableHoldMouseMoves); 137 switches::kAuraDisableHoldMouseMoves);
139 138
140 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget())); 139 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget()));
141 DCHECK(compositor_.get()); 140 DCHECK(compositor_.get());
142 compositor_->AddObserver(this); 141 compositor_->AddObserver(this);
143 } 142 }
144 143
145 RootWindow::~RootWindow() { 144 RootWindow::~RootWindow() {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 defer_draw_scheduling_ = false; 235 defer_draw_scheduling_ = false;
237 return; 236 return;
238 } 237 }
239 if (compositor_lock_) { 238 if (compositor_lock_) {
240 draw_on_compositor_unlock_ = true; 239 draw_on_compositor_unlock_ = true;
241 defer_draw_scheduling_ = false; 240 defer_draw_scheduling_ = false;
242 return; 241 return;
243 } 242 }
244 waiting_on_compositing_end_ = true; 243 waiting_on_compositing_end_ = true;
245 244
246 TRACE_EVENT_ASYNC_BEGIN0("ui", "RootWindow::Draw", draw_trace_count_++); 245 TRACE_EVENT_ASYNC_BEGIN0("ui", "RootWindow::Draw",
246 compositor_->last_started_id() + 1);
247 247
248 defer_draw_scheduling_ = false;
249 compositor_->Draw(false); 248 compositor_->Draw(false);
250 } 249 }
251 250
252 void RootWindow::ScheduleFullDraw() { 251 void RootWindow::ScheduleFullDraw() {
253 compositor_->ScheduleFullDraw(); 252 compositor_->ScheduleFullDraw();
254 } 253 }
255 254
256 bool RootWindow::DispatchMouseEvent(MouseEvent* event) { 255 bool RootWindow::DispatchMouseEvent(MouseEvent* event) {
257 if (mouse_move_hold_count_) { 256 if (mouse_move_hold_count_) {
258 if (event->type() == ui::ET_MOUSE_DRAGGED || 257 if (event->type() == ui::ET_MOUSE_DRAGGED ||
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr())); 581 base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()));
583 } 582 }
584 } 583 }
585 584
586 //////////////////////////////////////////////////////////////////////////////// 585 ////////////////////////////////////////////////////////////////////////////////
587 // RootWindow, ui::CompositorObserver implementation: 586 // RootWindow, ui::CompositorObserver implementation:
588 587
589 void RootWindow::OnCompositingStarted(ui::Compositor*) { 588 void RootWindow::OnCompositingStarted(ui::Compositor*) {
590 } 589 }
591 590
591 void RootWindow::OnCompositingWillEnd(ui::Compositor*) {
592 defer_draw_scheduling_ = false;
piman 2012/06/04 18:20:39 A possible issue with this is that if other observ
jonathan.backer 2012/06/05 13:35:58 Your point is taken. It's a potential problem. I
593 }
594
592 void RootWindow::OnCompositingEnded(ui::Compositor*) { 595 void RootWindow::OnCompositingEnded(ui::Compositor*) {
593 TRACE_EVENT_ASYNC_END0("ui", "RootWindow::Draw", draw_trace_count_); 596 TRACE_EVENT_ASYNC_END0("ui", "RootWindow::Draw",
597 compositor_->last_ended_id());
594 waiting_on_compositing_end_ = false; 598 waiting_on_compositing_end_ = false;
595 if (draw_on_compositing_end_) { 599 if (draw_on_compositing_end_) {
596 draw_on_compositing_end_ = false; 600 draw_on_compositing_end_ = false;
597 601
598 // Call ScheduleDraw() instead of Draw() in order to allow other 602 // Call ScheduleDraw() instead of Draw() in order to allow other
599 // ui::CompositorObservers to be notified before starting another 603 // ui::CompositorObservers to be notified before starting another
600 // draw cycle. 604 // draw cycle.
601 ScheduleDraw(); 605 ScheduleDraw();
602 } 606 }
603 } 607 }
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 void RootWindow::UnlockCompositor() { 1030 void RootWindow::UnlockCompositor() {
1027 DCHECK(compositor_lock_); 1031 DCHECK(compositor_lock_);
1028 compositor_lock_ = NULL; 1032 compositor_lock_ = NULL;
1029 if (draw_on_compositor_unlock_) { 1033 if (draw_on_compositor_unlock_) {
1030 draw_on_compositor_unlock_ = false; 1034 draw_on_compositor_unlock_ = false;
1031 ScheduleDraw(); 1035 ScheduleDraw();
1032 } 1036 }
1033 } 1037 }
1034 1038
1035 } // namespace aura 1039 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698