| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 CancelCompositorLock(); | 158 CancelCompositorLock(); |
| 159 DCHECK(!compositor_lock_); | 159 DCHECK(!compositor_lock_); |
| 160 | 160 |
| 161 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, | 161 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, |
| 162 OnCompositingShuttingDown(this)); | 162 OnCompositingShuttingDown(this)); |
| 163 | 163 |
| 164 DCHECK(begin_frame_observer_list_.empty()); | 164 DCHECK(begin_frame_observer_list_.empty()); |
| 165 | 165 |
| 166 if (root_layer_) | 166 if (root_layer_) |
| 167 root_layer_->SetCompositor(NULL); | 167 root_layer_->ResetCompositor(); |
| 168 | 168 |
| 169 // Stop all outstanding draws before telling the ContextFactory to tear | 169 // Stop all outstanding draws before telling the ContextFactory to tear |
| 170 // down any contexts that the |host_| may rely upon. | 170 // down any contexts that the |host_| may rely upon. |
| 171 host_.reset(); | 171 host_.reset(); |
| 172 | 172 |
| 173 context_factory_->RemoveCompositor(this); | 173 context_factory_->RemoveCompositor(this); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void Compositor::SetOutputSurface( | 176 void Compositor::SetOutputSurface( |
| 177 scoped_ptr<cc::OutputSurface> output_surface) { | 177 scoped_ptr<cc::OutputSurface> output_surface) { |
| 178 host_->SetOutputSurface(output_surface.Pass()); | 178 host_->SetOutputSurface(output_surface.Pass()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void Compositor::ScheduleDraw() { | 181 void Compositor::ScheduleDraw() { |
| 182 host_->SetNeedsCommit(); | 182 host_->SetNeedsCommit(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void Compositor::SetRootLayer(Layer* root_layer) { | 185 void Compositor::SetRootLayer(Layer* root_layer) { |
| 186 if (root_layer_ == root_layer) | 186 if (root_layer_ == root_layer) |
| 187 return; | 187 return; |
| 188 if (root_layer_) | 188 if (root_layer_) |
| 189 root_layer_->SetCompositor(NULL); | 189 root_layer_->ResetCompositor(); |
| 190 root_layer_ = root_layer; | 190 root_layer_ = root_layer; |
| 191 if (root_layer_ && !root_layer_->GetCompositor()) | 191 if (root_layer_ && !root_layer_->GetCompositor()) |
| 192 root_layer_->SetCompositor(this); | 192 root_layer_->SetCompositor(this); |
| 193 root_web_layer_->RemoveAllChildren(); | 193 root_web_layer_->RemoveAllChildren(); |
| 194 if (root_layer_) | 194 if (root_layer_) |
| 195 root_web_layer_->AddChild(root_layer_->cc_layer()); | 195 root_layer_->SetCompositorRootLayer(root_web_layer_); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void Compositor::SetHostHasTransparentBackground( | 198 void Compositor::SetHostHasTransparentBackground( |
| 199 bool host_has_transparent_background) { | 199 bool host_has_transparent_background) { |
| 200 host_->set_has_transparent_background(host_has_transparent_background); | 200 host_->set_has_transparent_background(host_has_transparent_background); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void Compositor::ScheduleFullRedraw() { | 203 void Compositor::ScheduleFullRedraw() { |
| 204 // TODO(enne): Some callers (mac) call this function expecting that it | 204 // TODO(enne): Some callers (mac) call this function expecting that it |
| 205 // will also commit. This should probably just redraw the screen | 205 // will also commit. This should probably just redraw the screen |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 observer_list_, | 419 observer_list_, |
| 420 OnCompositingLockStateChanged(this)); | 420 OnCompositingLockStateChanged(this)); |
| 421 } | 421 } |
| 422 | 422 |
| 423 void Compositor::CancelCompositorLock() { | 423 void Compositor::CancelCompositorLock() { |
| 424 if (compositor_lock_) | 424 if (compositor_lock_) |
| 425 compositor_lock_->CancelLock(); | 425 compositor_lock_->CancelLock(); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace ui | 428 } // namespace ui |
| OLD | NEW |