OLD | NEW |
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/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); | 479 root_web_layer_->SetAnchorPoint(gfx::PointF(0.f, 0.f)); |
480 // TODO(piman): remove after crbug.com/235302 is fixed. | 480 // TODO(piman): remove after crbug.com/235302 is fixed. |
481 root_web_layer_->SetMasksToBounds(true); | 481 root_web_layer_->SetMasksToBounds(true); |
482 | 482 |
483 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 483 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
484 | 484 |
485 cc::LayerTreeSettings settings; | 485 cc::LayerTreeSettings settings; |
486 settings.refresh_rate = | 486 settings.refresh_rate = |
487 g_test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate; | 487 g_test_compositor_enabled ? kTestRefreshRate : kDefaultRefreshRate; |
488 settings.partial_swap_enabled = | 488 settings.partial_swap_enabled = |
489 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); | 489 !command_line->HasSwitch(switches::kUIDisablePartialSwap); |
490 settings.per_tile_painting_enabled = | 490 settings.per_tile_painting_enabled = |
491 command_line->HasSwitch(cc::switches::kUIEnablePerTilePainting); | 491 command_line->HasSwitch(switches::kUIEnablePerTilePainting); |
492 | 492 |
493 // These flags should be mirrored by renderer versions in content/renderer/. | 493 // These flags should be mirrored by renderer versions in content/renderer/. |
494 settings.initial_debug_state.show_debug_borders = | 494 settings.initial_debug_state.show_debug_borders = |
495 command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders); | 495 command_line->HasSwitch(switches::kUIShowCompositedLayerBorders); |
496 settings.initial_debug_state.show_fps_counter = | 496 settings.initial_debug_state.show_fps_counter = |
497 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); | 497 command_line->HasSwitch(switches::kUIShowFPSCounter); |
498 settings.initial_debug_state.show_paint_rects = | 498 settings.initial_debug_state.show_paint_rects = |
499 command_line->HasSwitch(switches::kUIShowPaintRects); | 499 command_line->HasSwitch(switches::kUIShowPaintRects); |
500 settings.initial_debug_state.show_property_changed_rects = | 500 settings.initial_debug_state.show_property_changed_rects = |
501 command_line->HasSwitch(cc::switches::kUIShowPropertyChangedRects); | 501 command_line->HasSwitch(switches::kUIShowPropertyChangedRects); |
502 settings.initial_debug_state.show_surface_damage_rects = | 502 settings.initial_debug_state.show_surface_damage_rects = |
503 command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); | 503 command_line->HasSwitch(switches::kUIShowSurfaceDamageRects); |
504 settings.initial_debug_state.show_screen_space_rects = | 504 settings.initial_debug_state.show_screen_space_rects = |
505 command_line->HasSwitch(cc::switches::kUIShowScreenSpaceRects); | 505 command_line->HasSwitch(switches::kUIShowScreenSpaceRects); |
506 settings.initial_debug_state.show_replica_screen_space_rects = | 506 settings.initial_debug_state.show_replica_screen_space_rects = |
507 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); | 507 command_line->HasSwitch(switches::kUIShowReplicaScreenSpaceRects); |
508 settings.initial_debug_state.show_occluding_rects = | 508 settings.initial_debug_state.show_occluding_rects = |
509 command_line->HasSwitch(cc::switches::kUIShowOccludingRects); | 509 command_line->HasSwitch(switches::kUIShowOccludingRects); |
510 settings.initial_debug_state.show_non_occluding_rects = | 510 settings.initial_debug_state.show_non_occluding_rects = |
511 command_line->HasSwitch(cc::switches::kUIShowNonOccludingRects); | 511 command_line->HasSwitch(switches::kUIShowNonOccludingRects); |
512 | 512 |
513 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = | 513 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
514 g_compositor_thread ? g_compositor_thread->message_loop_proxy() : NULL; | 514 g_compositor_thread ? g_compositor_thread->message_loop_proxy() : NULL; |
515 | 515 |
516 host_ = cc::LayerTreeHost::Create(this, settings, compositor_task_runner); | 516 host_ = cc::LayerTreeHost::Create(this, settings, compositor_task_runner); |
517 host_->SetRootLayer(root_web_layer_); | 517 host_->SetRootLayer(root_web_layer_); |
518 host_->SetLayerTreeHostClientReady(); | 518 host_->SetLayerTreeHostClientReady(); |
519 } | 519 } |
520 | 520 |
521 Compositor::~Compositor() { | 521 Compositor::~Compositor() { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 COMPOSITOR_EXPORT void DisableTestCompositor() { | 836 COMPOSITOR_EXPORT void DisableTestCompositor() { |
837 ResetImplicitFactory(); | 837 ResetImplicitFactory(); |
838 g_test_compositor_enabled = false; | 838 g_test_compositor_enabled = false; |
839 } | 839 } |
840 | 840 |
841 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { | 841 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { |
842 return g_test_compositor_enabled; | 842 return g_test_compositor_enabled; |
843 } | 843 } |
844 | 844 |
845 } // namespace ui | 845 } // namespace ui |
OLD | NEW |