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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 1287043002: cc: Setup API to release OutputSurface from LTHClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test. Created 5 years, 3 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 main_frame_events.Pass()); 2148 main_frame_events.Pass());
2149 } 2149 }
2150 2150
2151 void LayerTreeHostImpl::CleanUpTileManager() { 2151 void LayerTreeHostImpl::CleanUpTileManager() {
2152 tile_manager_->FinishTasksAndCleanUp(); 2152 tile_manager_->FinishTasksAndCleanUp();
2153 resource_pool_ = nullptr; 2153 resource_pool_ = nullptr;
2154 tile_task_worker_pool_ = nullptr; 2154 tile_task_worker_pool_ = nullptr;
2155 single_thread_synchronous_task_graph_runner_ = nullptr; 2155 single_thread_synchronous_task_graph_runner_ = nullptr;
2156 } 2156 }
2157 2157
2158 bool LayerTreeHostImpl::InitializeRenderer( 2158 scoped_ptr<OutputSurface> LayerTreeHostImpl::ReleaseOutputSurface() {
2159 scoped_ptr<OutputSurface> output_surface) {
2160 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer");
2161
2162 // Since we will create a new resource provider, we cannot continue to use 2159 // Since we will create a new resource provider, we cannot continue to use
danakj 2015/09/17 18:43:55 A trace event in here might be helpful
2163 // the old resources (i.e. render_surfaces and texture IDs). Clear them 2160 // the old resources (i.e. render_surfaces and texture IDs). Clear them
2164 // before we destroy the old resource provider. 2161 // before we destroy the old resource provider.
2165 ReleaseTreeResources(); 2162 ReleaseTreeResources();
2166 2163
2167 // Note: order is important here. 2164 // Note: order is important here.
2168 renderer_ = nullptr; 2165 renderer_ = nullptr;
2169 CleanUpTileManager(); 2166 CleanUpTileManager();
2170 resource_provider_ = nullptr; 2167 resource_provider_ = nullptr;
2171 output_surface_ = nullptr;
2172 2168
2169 return output_surface_.Pass();
2170 }
2171
2172 bool LayerTreeHostImpl::InitializeRenderer(
2173 scoped_ptr<OutputSurface> output_surface) {
2174 TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer");
2175
2176 ReleaseOutputSurface();
2173 if (!output_surface->BindToClient(this)) { 2177 if (!output_surface->BindToClient(this)) {
2174 // Avoid recreating tree resources because we might not have enough 2178 // Avoid recreating tree resources because we might not have enough
2175 // information to do this yet (eg. we don't have a TileManager at this 2179 // information to do this yet (eg. we don't have a TileManager at this
2176 // point). 2180 // point).
2177 return false; 2181 return false;
2178 } 2182 }
2179 2183
2180 output_surface_ = output_surface.Pass(); 2184 output_surface_ = output_surface.Pass();
2181 resource_provider_ = ResourceProvider::Create( 2185 resource_provider_ = ResourceProvider::Create(
2182 output_surface_.get(), shared_bitmap_manager_, gpu_memory_buffer_manager_, 2186 output_surface_.get(), shared_bitmap_manager_, gpu_memory_buffer_manager_,
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
3612 if (active_tree()) { 3616 if (active_tree()) {
3613 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); 3617 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id);
3614 if (layer) 3618 if (layer)
3615 return layer->ScrollOffsetForAnimation(); 3619 return layer->ScrollOffsetForAnimation();
3616 } 3620 }
3617 3621
3618 return gfx::ScrollOffset(); 3622 return gfx::ScrollOffset();
3619 } 3623 }
3620 3624
3621 } // namespace cc 3625 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698