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

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

Issue 10537028: aura: Drop unnecessary composites (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "" 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
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/compositor/compositor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 mouse_moved_handler_(NULL), 125 mouse_moved_handler_(NULL),
126 ALLOW_THIS_IN_INITIALIZER_LIST( 126 ALLOW_THIS_IN_INITIALIZER_LIST(
127 gesture_recognizer_(ui::GestureRecognizer::Create(this))), 127 gesture_recognizer_(ui::GestureRecognizer::Create(this))),
128 synthesize_mouse_move_(false), 128 synthesize_mouse_move_(false),
129 waiting_on_compositing_end_(false), 129 waiting_on_compositing_end_(false),
130 draw_on_compositing_end_(false), 130 draw_on_compositing_end_(false),
131 defer_draw_scheduling_(false), 131 defer_draw_scheduling_(false),
132 mouse_move_hold_count_(0), 132 mouse_move_hold_count_(0),
133 should_hold_mouse_moves_(false), 133 should_hold_mouse_moves_(false),
134 compositor_lock_(NULL), 134 compositor_lock_(NULL),
135 draw_on_compositor_unlock_(false), 135 draw_on_compositor_unlock_(false) {
136 draw_trace_count_(0) {
137 SetName("RootWindow"); 136 SetName("RootWindow");
138 should_hold_mouse_moves_ = !CommandLine::ForCurrentProcess()->HasSwitch( 137 should_hold_mouse_moves_ = !CommandLine::ForCurrentProcess()->HasSwitch(
139 switches::kAuraDisableHoldMouseMoves); 138 switches::kAuraDisableHoldMouseMoves);
140 139
141 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget())); 140 compositor_.reset(new ui::Compositor(this, host_->GetAcceleratedWidget()));
142 DCHECK(compositor_.get()); 141 DCHECK(compositor_.get());
143 compositor_->AddObserver(this); 142 compositor_->AddObserver(this);
144 } 143 }
145 144
146 RootWindow::~RootWindow() { 145 RootWindow::~RootWindow() {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 224
226 bool RootWindow::ConfineCursorToWindow() { 225 bool RootWindow::ConfineCursorToWindow() {
227 // We would like to be able to confine the cursor to that window. However, 226 // We would like to be able to confine the cursor to that window. However,
228 // currently, we do not have such functionality in X. So we just confine 227 // currently, we do not have such functionality in X. So we just confine
229 // to the root window. This is ok because this option is currently only 228 // to the root window. This is ok because this option is currently only
230 // being used in fullscreen mode, so root_window bounds = window bounds. 229 // being used in fullscreen mode, so root_window bounds = window bounds.
231 return host_->ConfineCursorToRootWindow(); 230 return host_->ConfineCursorToRootWindow();
232 } 231 }
233 232
234 void RootWindow::Draw() { 233 void RootWindow::Draw() {
234 defer_draw_scheduling_ = false;
235 if (waiting_on_compositing_end_) { 235 if (waiting_on_compositing_end_) {
236 draw_on_compositing_end_ = true; 236 draw_on_compositing_end_ = true;
237 defer_draw_scheduling_ = false;
238 return; 237 return;
239 } 238 }
240 if (compositor_lock_) { 239 if (compositor_lock_) {
241 draw_on_compositor_unlock_ = true; 240 draw_on_compositor_unlock_ = true;
242 defer_draw_scheduling_ = false;
243 return; 241 return;
244 } 242 }
245 waiting_on_compositing_end_ = true; 243 waiting_on_compositing_end_ = true;
246 244
247 TRACE_EVENT_ASYNC_BEGIN0("ui", "RootWindow::Draw", draw_trace_count_++); 245 TRACE_EVENT_ASYNC_BEGIN0("ui", "RootWindow::Draw",
246 compositor_->last_started_frame() + 1);
248 247
249 defer_draw_scheduling_ = false;
250 compositor_->Draw(false); 248 compositor_->Draw(false);
251 } 249 }
252 250
253 void RootWindow::ScheduleFullDraw() { 251 void RootWindow::ScheduleFullDraw() {
254 compositor_->ScheduleFullDraw(); 252 compositor_->ScheduleFullDraw();
255 } 253 }
256 254
257 bool RootWindow::DispatchMouseEvent(MouseEvent* event) { 255 bool RootWindow::DispatchMouseEvent(MouseEvent* event) {
258 if (mouse_move_hold_count_) { 256 if (mouse_move_hold_count_) {
259 if (event->type() == ui::ET_MOUSE_DRAGGED || 257 if (event->type() == ui::ET_MOUSE_DRAGGED ||
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 } 582 }
585 } 583 }
586 584
587 //////////////////////////////////////////////////////////////////////////////// 585 ////////////////////////////////////////////////////////////////////////////////
588 // RootWindow, ui::CompositorObserver implementation: 586 // RootWindow, ui::CompositorObserver implementation:
589 587
590 void RootWindow::OnCompositingStarted(ui::Compositor*) { 588 void RootWindow::OnCompositingStarted(ui::Compositor*) {
591 } 589 }
592 590
593 void RootWindow::OnCompositingEnded(ui::Compositor*) { 591 void RootWindow::OnCompositingEnded(ui::Compositor*) {
594 TRACE_EVENT_ASYNC_END0("ui", "RootWindow::Draw", draw_trace_count_); 592 TRACE_EVENT_ASYNC_END0("ui", "RootWindow::Draw",
593 compositor_->last_ended_frame());
595 waiting_on_compositing_end_ = false; 594 waiting_on_compositing_end_ = false;
596 if (draw_on_compositing_end_) { 595 if (draw_on_compositing_end_) {
597 draw_on_compositing_end_ = false; 596 draw_on_compositing_end_ = false;
598 597
599 // Call ScheduleDraw() instead of Draw() in order to allow other 598 // Call ScheduleDraw() instead of Draw() in order to allow other
600 // ui::CompositorObservers to be notified before starting another 599 // ui::CompositorObservers to be notified before starting another
601 // draw cycle. 600 // draw cycle.
602 ScheduleDraw(); 601 ScheduleDraw();
603 } 602 }
604 } 603 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 void RootWindow::UnlockCompositor() { 1029 void RootWindow::UnlockCompositor() {
1031 DCHECK(compositor_lock_); 1030 DCHECK(compositor_lock_);
1032 compositor_lock_ = NULL; 1031 compositor_lock_ = NULL;
1033 if (draw_on_compositor_unlock_) { 1032 if (draw_on_compositor_unlock_) {
1034 draw_on_compositor_unlock_ = false; 1033 draw_on_compositor_unlock_ = false;
1035 ScheduleDraw(); 1034 ScheduleDraw();
1036 } 1035 }
1037 } 1036 }
1038 1037
1039 } // namespace aura 1038 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.h ('k') | ui/compositor/compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698