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

Side by Side Diff: cc/surfaces/surface_aggregator.cc

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surfaces/surface_aggregator.h" 5 #include "cc/surfaces/surface_aggregator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 base::hash_map<RenderPassId, int> id_to_index_map_; 51 base::hash_map<RenderPassId, int> id_to_index_map_;
52 SurfaceId surface_id_; 52 SurfaceId surface_id_;
53 int next_index_; 53 int next_index_;
54 54
55 DISALLOW_COPY_AND_ASSIGN(RenderPassIdAllocator); 55 DISALLOW_COPY_AND_ASSIGN(RenderPassIdAllocator);
56 }; 56 };
57 57
58 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory, 58 static void UnrefHelper(base::WeakPtr<SurfaceFactory> surface_factory,
59 const ReturnedResourceArray& resources, 59 const ReturnedResourceArray& resources,
60 BlockingTaskRunner* main_thread_task_runner) { 60 BlockingTaskRunner* main_thread_task_runner) {
61 surface_factory->UnrefResources(resources); 61 if (surface_factory)
jamesr 2014/09/12 01:08:55 whoops
62 surface_factory->UnrefResources(resources);
62 } 63 }
63 64
64 RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id, 65 RenderPassId SurfaceAggregator::RemapPassId(RenderPassId surface_local_pass_id,
65 SurfaceId surface_id) { 66 SurfaceId surface_id) {
66 RenderPassIdAllocator* allocator = render_pass_allocator_map_.get(surface_id); 67 RenderPassIdAllocator* allocator = render_pass_allocator_map_.get(surface_id);
67 if (!allocator) { 68 if (!allocator) {
68 allocator = new RenderPassIdAllocator(surface_id); 69 allocator = new RenderPassIdAllocator(surface_id);
69 render_pass_allocator_map_.set(surface_id, make_scoped_ptr(allocator)); 70 render_pass_allocator_map_.set(surface_id, make_scoped_ptr(allocator));
70 } 71 }
71 allocator->AddKnownPass(surface_local_pass_id); 72 allocator->AddKnownPass(surface_local_pass_id);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 surface->TakeLatencyInfo(&frame->metadata.latency_info); 362 surface->TakeLatencyInfo(&frame->metadata.latency_info);
362 } 363 }
363 364
364 // TODO(jamesr): Aggregate all resource references into the returned frame's 365 // TODO(jamesr): Aggregate all resource references into the returned frame's
365 // resource list. 366 // resource list.
366 367
367 return frame.Pass(); 368 return frame.Pass();
368 } 369 }
369 370
370 } // namespace cc 371 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698