| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <deque> | 10 #include <deque> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 17 #include "base/stl_util.h" | 17 #include "base/stl_util.h" |
| 18 #include "base/strings/string_split.h" |
| 18 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 19 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
| 20 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
| 21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 22 #include "cc/animation/animation_host.h" | 23 #include "cc/animation/animation_host.h" |
| 23 #include "cc/animation/animation_id_provider.h" | 24 #include "cc/animation/animation_id_provider.h" |
| 24 #include "cc/animation/animation_timeline.h" | 25 #include "cc/animation/animation_timeline.h" |
| 25 #include "cc/base/switches.h" | 26 #include "cc/base/switches.h" |
| 26 #include "cc/input/input_handler.h" | 27 #include "cc/input/input_handler.h" |
| 27 #include "cc/layers/layer.h" | 28 #include "cc/layers/layer.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #if defined(OS_WIN) | 102 #if defined(OS_WIN) |
| 102 settings.renderer_settings.finish_rendering_on_resize = true; | 103 settings.renderer_settings.finish_rendering_on_resize = true; |
| 103 #elif defined(OS_MACOSX) | 104 #elif defined(OS_MACOSX) |
| 104 settings.renderer_settings.release_overlay_resources_after_gpu_query = true; | 105 settings.renderer_settings.release_overlay_resources_after_gpu_query = true; |
| 105 #endif | 106 #endif |
| 106 settings.renderer_settings.gl_composited_texture_quad_border = | 107 settings.renderer_settings.gl_composited_texture_quad_border = |
| 107 command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder); | 108 command_line->HasSwitch(cc::switches::kGlCompositedTextureQuadBorder); |
| 108 settings.renderer_settings.show_overdraw_feedback = | 109 settings.renderer_settings.show_overdraw_feedback = |
| 109 command_line->HasSwitch(cc::switches::kShowOverdrawFeedback); | 110 command_line->HasSwitch(cc::switches::kShowOverdrawFeedback); |
| 110 | 111 |
| 111 // These flags should be mirrored by renderer versions in content/renderer/. | 112 if (command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders)) { |
| 112 settings.initial_debug_state.show_debug_borders = | 113 std::string layer_borders_string = command_line->GetSwitchValueASCII( |
| 113 command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders); | 114 cc::switches::kUIShowCompositedLayerBorders); |
| 115 std::vector<base::StringPiece> entries = base::SplitStringPiece( |
| 116 layer_borders_string, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 117 if (entries.empty()) { |
| 118 settings.initial_debug_state.show_debug_borders.set(); |
| 119 } else { |
| 120 for (const auto& entry : entries) { |
| 121 const struct { |
| 122 const char* name; |
| 123 cc::DebugBorderType type; |
| 124 } kBorders[] = {{cc::switches::kCompositedRenderPassBorders, |
| 125 cc::DebugBorderType::RENDERPASS}, |
| 126 {cc::switches::kCompositedSurfaceBorders, |
| 127 cc::DebugBorderType::SURFACE}, |
| 128 {cc::switches::kCompositedLayerBorders, |
| 129 cc::DebugBorderType::LAYER}}; |
| 130 for (const auto& border : kBorders) { |
| 131 if (border.name == entry) { |
| 132 settings.initial_debug_state.show_debug_borders.set(border.type); |
| 133 break; |
| 134 } |
| 135 } |
| 136 } |
| 137 } |
| 138 } |
| 114 settings.initial_debug_state.show_fps_counter = | 139 settings.initial_debug_state.show_fps_counter = |
| 115 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); | 140 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); |
| 116 settings.initial_debug_state.show_layer_animation_bounds_rects = | 141 settings.initial_debug_state.show_layer_animation_bounds_rects = |
| 117 command_line->HasSwitch(cc::switches::kUIShowLayerAnimationBounds); | 142 command_line->HasSwitch(cc::switches::kUIShowLayerAnimationBounds); |
| 118 settings.initial_debug_state.show_paint_rects = | 143 settings.initial_debug_state.show_paint_rects = |
| 119 command_line->HasSwitch(switches::kUIShowPaintRects); | 144 command_line->HasSwitch(switches::kUIShowPaintRects); |
| 120 settings.initial_debug_state.show_property_changed_rects = | 145 settings.initial_debug_state.show_property_changed_rects = |
| 121 command_line->HasSwitch(cc::switches::kUIShowPropertyChangedRects); | 146 command_line->HasSwitch(cc::switches::kUIShowPropertyChangedRects); |
| 122 settings.initial_debug_state.show_surface_damage_rects = | 147 settings.initial_debug_state.show_surface_damage_rects = |
| 123 command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); | 148 command_line->HasSwitch(cc::switches::kUIShowSurfaceDamageRects); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 void Compositor::TimeoutLocks() { | 595 void Compositor::TimeoutLocks() { |
| 571 // Make a copy, we're going to cause |active_locks_| to become | 596 // Make a copy, we're going to cause |active_locks_| to become |
| 572 // empty. | 597 // empty. |
| 573 std::vector<CompositorLock*> locks = active_locks_; | 598 std::vector<CompositorLock*> locks = active_locks_; |
| 574 for (auto* lock : locks) | 599 for (auto* lock : locks) |
| 575 lock->TimeoutLock(); | 600 lock->TimeoutLock(); |
| 576 DCHECK(active_locks_.empty()); | 601 DCHECK(active_locks_.empty()); |
| 577 } | 602 } |
| 578 | 603 |
| 579 } // namespace ui | 604 } // namespace ui |
| OLD | NEW |