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

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

Issue 1159633002: Clean up ui<->cc layers interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | ui/compositor/dip_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
190 root_layer_->SetCompositor(this);
191 root_web_layer_->RemoveAllChildren(); 189 root_web_layer_->RemoveAllChildren();
192 if (root_layer_) 190 if (root_layer_)
193 root_web_layer_->AddChild(root_layer_->cc_layer()); 191 root_layer_->SetCompositor(this, root_web_layer_);
194 } 192 }
195 193
196 void Compositor::SetHostHasTransparentBackground( 194 void Compositor::SetHostHasTransparentBackground(
197 bool host_has_transparent_background) { 195 bool host_has_transparent_background) {
198 host_->set_has_transparent_background(host_has_transparent_background); 196 host_->set_has_transparent_background(host_has_transparent_background);
199 } 197 }
200 198
201 void Compositor::ScheduleFullRedraw() { 199 void Compositor::ScheduleFullRedraw() {
202 // TODO(enne): Some callers (mac) call this function expecting that it 200 // TODO(enne): Some callers (mac) call this function expecting that it
203 // will also commit. This should probably just redraw the screen 201 // 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_, 422 observer_list_,
425 OnCompositingLockStateChanged(this)); 423 OnCompositingLockStateChanged(this));
426 } 424 }
427 425
428 void Compositor::CancelCompositorLock() { 426 void Compositor::CancelCompositorLock() {
429 if (compositor_lock_) 427 if (compositor_lock_)
430 compositor_lock_->CancelLock(); 428 compositor_lock_->CancelLock();
431 } 429 }
432 430
433 } // namespace ui 431 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/dip_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698