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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 waiting_on_compositing_end_(false), | 107 waiting_on_compositing_end_(false), |
108 draw_on_compositing_end_(false), | 108 draw_on_compositing_end_(false), |
109 swap_state_(SWAP_NONE), | 109 swap_state_(SWAP_NONE), |
110 layer_animator_collection_(this), | 110 layer_animator_collection_(this), |
111 schedule_draw_factory_(this) { | 111 schedule_draw_factory_(this) { |
112 root_web_layer_ = cc::Layer::Create(); | 112 root_web_layer_ = cc::Layer::Create(); |
113 | 113 |
114 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 114 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
115 | 115 |
116 cc::LayerTreeSettings settings; | 116 cc::LayerTreeSettings settings; |
117 settings.refresh_rate = | 117 settings.renderer_settings.refresh_rate = |
118 context_factory_->DoesCreateTestContexts() | 118 context_factory_->DoesCreateTestContexts() |
119 ? kTestRefreshRate | 119 ? kTestRefreshRate |
120 : kDefaultRefreshRate; | 120 : kDefaultRefreshRate; |
121 settings.main_frame_before_activation_enabled = false; | 121 settings.main_frame_before_activation_enabled = false; |
122 settings.throttle_frame_production = | 122 settings.throttle_frame_production = |
123 !command_line->HasSwitch(switches::kDisableGpuVsync); | 123 !command_line->HasSwitch(switches::kDisableGpuVsync); |
124 #if !defined(OS_MACOSX) | 124 #if !defined(OS_MACOSX) |
125 settings.partial_swap_enabled = | 125 settings.renderer_settings.partial_swap_enabled = |
126 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); | 126 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); |
127 #endif | 127 #endif |
128 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
129 settings.per_tile_painting_enabled = true; | 129 settings.per_tile_painting_enabled = true; |
130 #endif | 130 #endif |
131 #if defined(OS_WIN) | 131 #if defined(OS_WIN) |
132 settings.disable_hi_res_timer_tasks_on_battery = true; | 132 settings.disable_hi_res_timer_tasks_on_battery = true; |
133 #endif | 133 #endif |
134 | 134 |
135 // These flags should be mirrored by renderer versions in content/renderer/. | 135 // These flags should be mirrored by renderer versions in content/renderer/. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1); | 246 TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1); |
247 | 247 |
248 DCHECK_NE(swap_state_, SWAP_POSTED); | 248 DCHECK_NE(swap_state_, SWAP_POSTED); |
249 swap_state_ = SWAP_NONE; | 249 swap_state_ = SWAP_NONE; |
250 | 250 |
251 waiting_on_compositing_end_ = true; | 251 waiting_on_compositing_end_ = true; |
252 last_started_frame_++; | 252 last_started_frame_++; |
253 if (!IsLocked()) { | 253 if (!IsLocked()) { |
254 // TODO(nduca): Temporary while compositor calls | 254 // TODO(nduca): Temporary while compositor calls |
255 // compositeImmediately() directly. | 255 // compositeImmediately() directly. |
256 cc::BeginFrameArgs args = | 256 cc::BeginFrameArgs args = cc::BeginFrameArgs::Create( |
257 cc::BeginFrameArgs::Create(gfx::FrameTime::Now(), | 257 gfx::FrameTime::Now(), base::TimeTicks(), |
258 base::TimeTicks(), | 258 cc::BeginFrameArgs::DefaultInterval(), cc::BeginFrameArgs::SYNCHRONOUS); |
259 cc::BeginFrameArgs::DefaultInterval()); | |
260 BeginMainFrame(args); | 259 BeginMainFrame(args); |
261 host_->Composite(args.frame_time); | 260 host_->Composite(args.frame_time); |
262 } | 261 } |
263 if (swap_state_ == SWAP_NONE) | 262 if (swap_state_ == SWAP_NONE) |
264 NotifyEnd(); | 263 NotifyEnd(); |
265 } | 264 } |
266 | 265 |
267 void Compositor::ScheduleFullRedraw() { | 266 void Compositor::ScheduleFullRedraw() { |
268 host_->SetNeedsRedraw(); | 267 host_->SetNeedsRedraw(); |
269 } | 268 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 // Call ScheduleDraw() instead of Draw() in order to allow other | 480 // Call ScheduleDraw() instead of Draw() in order to allow other |
482 // CompositorObservers to be notified before starting another | 481 // CompositorObservers to be notified before starting another |
483 // draw cycle. | 482 // draw cycle. |
484 ScheduleDraw(); | 483 ScheduleDraw(); |
485 } | 484 } |
486 FOR_EACH_OBSERVER( | 485 FOR_EACH_OBSERVER( |
487 CompositorObserver, observer_list_, OnCompositingEnded(this)); | 486 CompositorObserver, observer_list_, OnCompositingEnded(this)); |
488 } | 487 } |
489 | 488 |
490 } // namespace ui | 489 } // namespace ui |
OLD | NEW |