| 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 16 matching lines...) Expand all Loading... |
| 27 #include "third_party/skia/include/core/SkBitmap.h" | 27 #include "third_party/skia/include/core/SkBitmap.h" |
| 28 #include "ui/compositor/compositor_observer.h" | 28 #include "ui/compositor/compositor_observer.h" |
| 29 #include "ui/compositor/compositor_switches.h" | 29 #include "ui/compositor/compositor_switches.h" |
| 30 #include "ui/compositor/compositor_vsync_manager.h" | 30 #include "ui/compositor/compositor_vsync_manager.h" |
| 31 #include "ui/compositor/dip_util.h" | 31 #include "ui/compositor/dip_util.h" |
| 32 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
| 33 #include "ui/gfx/frame_time.h" | 33 #include "ui/gfx/frame_time.h" |
| 34 #include "ui/gl/gl_context.h" | 34 #include "ui/gl/gl_context.h" |
| 35 #include "ui/gl/gl_switches.h" | 35 #include "ui/gl/gl_switches.h" |
| 36 | 36 |
| 37 extern char GetZCopy(); |
| 38 |
| 37 namespace { | 39 namespace { |
| 38 | 40 |
| 39 const double kDefaultRefreshRate = 60.0; | 41 const double kDefaultRefreshRate = 60.0; |
| 40 const double kTestRefreshRate = 200.0; | 42 const double kTestRefreshRate = 200.0; |
| 41 | 43 |
| 42 enum SwapType { | 44 enum SwapType { |
| 43 DRAW_SWAP, | 45 DRAW_SWAP, |
| 44 }; | 46 }; |
| 45 | 47 |
| 46 bool g_compositor_initialized = false; | 48 bool g_compositor_initialized = false; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 settings.initial_debug_state.show_replica_screen_space_rects = | 236 settings.initial_debug_state.show_replica_screen_space_rects = |
| 235 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); | 237 command_line->HasSwitch(cc::switches::kUIShowReplicaScreenSpaceRects); |
| 236 settings.initial_debug_state.show_occluding_rects = | 238 settings.initial_debug_state.show_occluding_rects = |
| 237 command_line->HasSwitch(cc::switches::kUIShowOccludingRects); | 239 command_line->HasSwitch(cc::switches::kUIShowOccludingRects); |
| 238 settings.initial_debug_state.show_non_occluding_rects = | 240 settings.initial_debug_state.show_non_occluding_rects = |
| 239 command_line->HasSwitch(cc::switches::kUIShowNonOccludingRects); | 241 command_line->HasSwitch(cc::switches::kUIShowNonOccludingRects); |
| 240 | 242 |
| 241 settings.initial_debug_state.SetRecordRenderingStats( | 243 settings.initial_debug_state.SetRecordRenderingStats( |
| 242 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); | 244 command_line->HasSwitch(cc::switches::kEnableGpuBenchmarking)); |
| 243 | 245 |
| 246 if (GetZCopy()) { |
| 247 settings.impl_side_painting = true; |
| 248 settings.use_map_image = true; |
| 249 } |
| 250 |
| 244 base::TimeTicks before_create = base::TimeTicks::Now(); | 251 base::TimeTicks before_create = base::TimeTicks::Now(); |
| 245 if (!!g_compositor_thread) { | 252 if (!!g_compositor_thread) { |
| 246 host_ = cc::LayerTreeHost::CreateThreaded( | 253 host_ = cc::LayerTreeHost::CreateThreaded( |
| 247 this, NULL, settings, g_compositor_thread->message_loop_proxy()); | 254 this, NULL, settings, g_compositor_thread->message_loop_proxy()); |
| 248 } else { | 255 } else { |
| 249 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); | 256 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, this, NULL, settings); |
| 250 } | 257 } |
| 251 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", | 258 UMA_HISTOGRAM_TIMES("GPU.CreateBrowserCompositor", |
| 252 base::TimeTicks::Now() - before_create); | 259 base::TimeTicks::Now() - before_create); |
| 253 host_->SetRootLayer(root_web_layer_); | 260 host_->SetRootLayer(root_web_layer_); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 // CompositorObservers to be notified before starting another | 562 // CompositorObservers to be notified before starting another |
| 556 // draw cycle. | 563 // draw cycle. |
| 557 ScheduleDraw(); | 564 ScheduleDraw(); |
| 558 } | 565 } |
| 559 FOR_EACH_OBSERVER(CompositorObserver, | 566 FOR_EACH_OBSERVER(CompositorObserver, |
| 560 observer_list_, | 567 observer_list_, |
| 561 OnCompositingEnded(this)); | 568 OnCompositingEnded(this)); |
| 562 } | 569 } |
| 563 | 570 |
| 564 } // namespace ui | 571 } // namespace ui |
| OLD | NEW |