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

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

Issue 9288053: Remove old (pre-webkit) compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 8 years, 10 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/aura.gyp ('k') | ui/aura/test/test_suite.cc » ('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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/string_split.h" 15 #include "base/string_split.h"
16 #include "ui/aura/aura_switches.h" 16 #include "ui/aura/aura_switches.h"
17 #include "ui/aura/client/activation_client.h" 17 #include "ui/aura/client/activation_client.h"
18 #include "ui/aura/root_window_host.h" 18 #include "ui/aura/root_window_host.h"
19 #include "ui/aura/root_window_observer.h" 19 #include "ui/aura/root_window_observer.h"
20 #include "ui/aura/event.h" 20 #include "ui/aura/event.h"
21 #include "ui/aura/event_filter.h" 21 #include "ui/aura/event_filter.h"
22 #include "ui/aura/focus_manager.h" 22 #include "ui/aura/focus_manager.h"
23 #include "ui/aura/gestures/gesture_recognizer.h" 23 #include "ui/aura/gestures/gesture_recognizer.h"
24 #include "ui/aura/screen_aura.h" 24 #include "ui/aura/screen_aura.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/aura/window_delegate.h" 26 #include "ui/aura/window_delegate.h"
27 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
28 #include "ui/gfx/compositor/compositor.h" 28 #include "ui/gfx/compositor/compositor.h"
29 #include "ui/gfx/compositor/compositor_cc.h"
29 #include "ui/gfx/compositor/layer.h" 30 #include "ui/gfx/compositor/layer.h"
30 #include "ui/gfx/compositor/layer_animator.h" 31 #include "ui/gfx/compositor/layer_animator.h"
31 32
32 #ifdef USE_WEBKIT_COMPOSITOR
33 #include "ui/gfx/compositor/compositor_cc.h"
34 #endif
35
36 using std::string; 33 using std::string;
37 using std::vector; 34 using std::vector;
38 35
39 namespace aura { 36 namespace aura {
40 37
41 namespace { 38 namespace {
42 39
43 // Default bounds for the host window. 40 // Default bounds for the host window.
44 static const int kDefaultHostWindowX = 200; 41 static const int kDefaultHostWindowX = 200;
45 static const int kDefaultHostWindowY = 200; 42 static const int kDefaultHostWindowY = 200;
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 mouse_pressed_handler_(NULL), 394 mouse_pressed_handler_(NULL),
398 mouse_moved_handler_(NULL), 395 mouse_moved_handler_(NULL),
399 focused_window_(NULL), 396 focused_window_(NULL),
400 touch_event_handler_(NULL), 397 touch_event_handler_(NULL),
401 gesture_handler_(NULL), 398 gesture_handler_(NULL),
402 gesture_recognizer_(new GestureRecognizer()) { 399 gesture_recognizer_(new GestureRecognizer()) {
403 SetName("RootWindow"); 400 SetName("RootWindow");
404 gfx::Screen::SetInstance(screen_); 401 gfx::Screen::SetInstance(screen_);
405 last_mouse_location_ = host_->QueryMouseLocation(); 402 last_mouse_location_ = host_->QueryMouseLocation();
406 403
407 if (ui::Compositor::compositor_factory()) { 404 ui::CompositorCC::Initialize(false);
408 compositor_ = (*ui::Compositor::compositor_factory())(this); 405 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(),
409 } else { 406 host_->GetSize());
410 #ifdef USE_WEBKIT_COMPOSITOR
411 ui::CompositorCC::Initialize(false);
412 #endif
413 compositor_ = ui::Compositor::Create(this, host_->GetAcceleratedWidget(),
414 host_->GetSize());
415 }
416 DCHECK(compositor_.get()); 407 DCHECK(compositor_.get());
417 } 408 }
418 409
419 RootWindow::~RootWindow() { 410 RootWindow::~RootWindow() {
420 // Make sure to destroy the compositor before terminating so that state is 411 // Make sure to destroy the compositor before terminating so that state is
421 // cleared and we don't hit asserts. 412 // cleared and we don't hit asserts.
422 compositor_ = NULL; 413 compositor_ = NULL;
423 // An observer may have been added by an animation on the RootWindow. 414 // An observer may have been added by an animation on the RootWindow.
424 layer()->GetAnimator()->RemoveObserver(this); 415 layer()->GetAnimator()->RemoveObserver(this);
425 #ifdef USE_WEBKIT_COMPOSITOR 416 ui::CompositorCC::Terminate();
426 if (!ui::Compositor::compositor_factory())
427 ui::CompositorCC::Terminate();
428 #endif
429 if (instance_ == this) 417 if (instance_ == this)
430 instance_ = NULL; 418 instance_ = NULL;
431 } 419 }
432 420
433 void RootWindow::HandleMouseMoved(const MouseEvent& event, Window* target) { 421 void RootWindow::HandleMouseMoved(const MouseEvent& event, Window* target) {
434 if (target == mouse_moved_handler_) 422 if (target == mouse_moved_handler_)
435 return; 423 return;
436 424
437 // Send an exited event. 425 // Send an exited event.
438 if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) { 426 if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { 650 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) {
663 bounds.set_size(gfx::Size(parsed_width, parsed_height)); 651 bounds.set_size(gfx::Size(parsed_width, parsed_height));
664 } else if (use_fullscreen_host_window_) { 652 } else if (use_fullscreen_host_window_) {
665 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize()); 653 bounds = gfx::Rect(RootWindowHost::GetNativeScreenSize());
666 } 654 }
667 655
668 return bounds; 656 return bounds;
669 } 657 }
670 658
671 } // namespace aura 659 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698