Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1084)

Side by Side Diff: ui/compositor/compositor.cc

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Fix code review issues. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 CancelCompositorLock(); 156 CancelCompositorLock();
157 DCHECK(!compositor_lock_); 157 DCHECK(!compositor_lock_);
158 158
159 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 159 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
160 OnCompositingShuttingDown(this)); 160 OnCompositingShuttingDown(this));
161 161
162 DCHECK(begin_frame_observer_list_.empty()); 162 DCHECK(begin_frame_observer_list_.empty());
163 163
164 if (root_layer_) 164 if (root_layer_)
165 root_layer_->SetCompositor(NULL); 165 root_layer_->ResetCompositor();
166 166
167 // Stop all outstanding draws before telling the ContextFactory to tear 167 // Stop all outstanding draws before telling the ContextFactory to tear
168 // down any contexts that the |host_| may rely upon. 168 // down any contexts that the |host_| may rely upon.
169 host_.reset(); 169 host_.reset();
170 170
171 context_factory_->RemoveCompositor(this); 171 context_factory_->RemoveCompositor(this);
172 } 172 }
173 173
174 void Compositor::SetOutputSurface( 174 void Compositor::SetOutputSurface(
175 scoped_ptr<cc::OutputSurface> output_surface) { 175 scoped_ptr<cc::OutputSurface> output_surface) {
176 host_->SetOutputSurface(output_surface.Pass()); 176 host_->SetOutputSurface(output_surface.Pass());
177 } 177 }
178 178
179 void Compositor::ScheduleDraw() { 179 void Compositor::ScheduleDraw() {
180 host_->SetNeedsCommit(); 180 host_->SetNeedsCommit();
181 } 181 }
182 182
183 void Compositor::SetRootLayer(Layer* root_layer) { 183 void Compositor::SetRootLayer(Layer* root_layer) {
184 if (root_layer_ == root_layer) 184 if (root_layer_ == root_layer)
185 return; 185 return;
186 if (root_layer_) 186 if (root_layer_)
187 root_layer_->SetCompositor(NULL); 187 root_layer_->ResetCompositor();
188 root_layer_ = root_layer; 188 root_layer_ = root_layer;
189 if (root_layer_ && !root_layer_->GetCompositor()) 189 if (root_layer_ && !root_layer_->GetCompositor())
190 root_layer_->SetCompositor(this); 190 root_layer_->SetCompositor(this);
191 root_web_layer_->RemoveAllChildren(); 191 root_web_layer_->RemoveAllChildren();
192 if (root_layer_) 192 if (root_layer_)
193 root_web_layer_->AddChild(root_layer_->cc_layer()); 193 root_layer_->SetCompositorRootCCLayer(root_web_layer_);
194 } 194 }
195 195
196 void Compositor::SetHostHasTransparentBackground( 196 void Compositor::SetHostHasTransparentBackground(
197 bool host_has_transparent_background) { 197 bool host_has_transparent_background) {
198 host_->set_has_transparent_background(host_has_transparent_background); 198 host_->set_has_transparent_background(host_has_transparent_background);
199 } 199 }
200 200
201 void Compositor::ScheduleFullRedraw() { 201 void Compositor::ScheduleFullRedraw() {
202 // TODO(enne): Some callers (mac) call this function expecting that it 202 // TODO(enne): Some callers (mac) call this function expecting that it
203 // will also commit. This should probably just redraw the screen 203 // will also commit. This should probably just redraw the screen
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 observer_list_, 424 observer_list_,
425 OnCompositingLockStateChanged(this)); 425 OnCompositingLockStateChanged(this));
426 } 426 }
427 427
428 void Compositor::CancelCompositorLock() { 428 void Compositor::CancelCompositorLock() {
429 if (compositor_lock_) 429 if (compositor_lock_)
430 compositor_lock_->CancelLock(); 430 compositor_lock_->CancelLock();
431 } 431 }
432 432
433 } // namespace ui 433 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698