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

Side by Side Diff: cc/layers/delegated_renderer_layer_impl.cc

Issue 1128043008: cc: Don't try set renderpasses on active tree after losing context. (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 | cc/trees/layer_tree_host_unittest_delegated.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/layers/delegated_renderer_layer_impl.h" 5 #include "cc/layers/delegated_renderer_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // If we have a new child_id to give to the active layer, it should 71 // If we have a new child_id to give to the active layer, it should
72 // have already deleted its old child_id. 72 // have already deleted its old child_id.
73 DCHECK(delegated_layer->child_id_ == 0 || 73 DCHECK(delegated_layer->child_id_ == 0 ||
74 delegated_layer->child_id_ == child_id_); 74 delegated_layer->child_id_ == child_id_);
75 delegated_layer->inverse_device_scale_factor_ = inverse_device_scale_factor_; 75 delegated_layer->inverse_device_scale_factor_ = inverse_device_scale_factor_;
76 delegated_layer->child_id_ = child_id_; 76 delegated_layer->child_id_ = child_id_;
77 delegated_layer->own_child_id_ = true; 77 delegated_layer->own_child_id_ = true;
78 own_child_id_ = false; 78 own_child_id_ = false;
79 79
80 if (have_render_passes_to_push_) { 80 if (have_render_passes_to_push_) {
piman 2015/05/15 23:17:38 Oh, can you add a DCHECK(child_id_) here?
danakj 2015/05/15 23:31:21 Done.
81 // This passes ownership of the render passes to the active tree. 81 // This passes ownership of the render passes to the active tree.
82 delegated_layer->SetRenderPasses(&render_passes_in_draw_order_); 82 delegated_layer->SetRenderPasses(&render_passes_in_draw_order_);
83 // Once resources are on the active tree, give them to the ResourceProvider 83 // Once resources are on the active tree, give them to the ResourceProvider
84 // and release unused resources from the old frame. 84 // and release unused resources from the old frame.
85 delegated_layer->TakeOwnershipOfResourcesIfOnActiveTree(resources_); 85 delegated_layer->TakeOwnershipOfResourcesIfOnActiveTree(resources_);
86 DCHECK(render_passes_in_draw_order_.empty()); 86 DCHECK(render_passes_in_draw_order_.empty());
87 have_render_passes_to_push_ = false; 87 have_render_passes_to_push_ = false;
88 } 88 }
89 89
90 // This is just a copy for testing, since resources are added to the 90 // This is just a copy for testing, since resources are added to the
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 scoped_ptr<LayerImpl> DelegatedRendererLayerImpl::CreateLayerImpl( 211 scoped_ptr<LayerImpl> DelegatedRendererLayerImpl::CreateLayerImpl(
212 LayerTreeImpl* tree_impl) { 212 LayerTreeImpl* tree_impl) {
213 return DelegatedRendererLayerImpl::Create(tree_impl, id()); 213 return DelegatedRendererLayerImpl::Create(tree_impl, id());
214 } 214 }
215 215
216 void DelegatedRendererLayerImpl::ReleaseResources() { 216 void DelegatedRendererLayerImpl::ReleaseResources() {
217 ClearRenderPasses(); 217 ClearRenderPasses();
218 ClearChildId(); 218 ClearChildId();
219 have_render_passes_to_push_ = false;
219 } 220 }
220 221
221 static inline int IndexToId(int index) { return index + 1; } 222 static inline int IndexToId(int index) { return index + 1; }
222 static inline int IdToIndex(int id) { return id - 1; } 223 static inline int IdToIndex(int id) { return id - 1; }
223 224
224 RenderPassId DelegatedRendererLayerImpl::FirstContributingRenderPassId() const { 225 RenderPassId DelegatedRendererLayerImpl::FirstContributingRenderPassId() const {
225 return RenderPassId(id(), IndexToId(0)); 226 return RenderPassId(id(), IndexToId(0));
226 } 227 }
227 228
228 RenderPassId DelegatedRendererLayerImpl::NextContributingRenderPassId( 229 RenderPassId DelegatedRendererLayerImpl::NextContributingRenderPassId(
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 if (own_child_id_) { 525 if (own_child_id_) {
525 ResourceProvider* provider = layer_tree_impl()->resource_provider(); 526 ResourceProvider* provider = layer_tree_impl()->resource_provider();
526 provider->DestroyChild(child_id_); 527 provider->DestroyChild(child_id_);
527 } 528 }
528 529
529 resources_.clear(); 530 resources_.clear();
530 child_id_ = 0; 531 child_id_ = 0;
531 } 532 }
532 533
533 } // namespace cc 534 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_unittest_delegated.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698