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

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

Issue 2880023002: cc::SurfaceDependencyTracker should not crash when a Display goes away (Closed)
Patch Set: Fix LayerTreeHostImpl unit tests Created 3 years, 6 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 | « cc/surfaces/primary_begin_frame_source.cc ('k') | cc/surfaces/surface_dependency_tracker.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 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.h" 5 #include "cc/surfaces/surface.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 frame_sink_ids_for_dependencies.insert(surface_id.frame_sink_id()); 101 frame_sink_ids_for_dependencies.insert(surface_id.frame_sink_id());
102 for (const SurfaceId& surface_id : frame.metadata.referenced_surfaces) { 102 for (const SurfaceId& surface_id : frame.metadata.referenced_surfaces) {
103 // A surface ID in |referenced_surfaces| that has a corresponding surface 103 // A surface ID in |referenced_surfaces| that has a corresponding surface
104 // ID in |activation_dependencies| with the same frame sink ID is said to 104 // ID in |activation_dependencies| with the same frame sink ID is said to
105 // be a fallback surface that can be used in place of the primary surface 105 // be a fallback surface that can be used in place of the primary surface
106 // if the deadline passes before the dependency becomes available. 106 // if the deadline passes before the dependency becomes available.
107 bool is_fallback_surface = 107 bool is_fallback_surface =
108 frame_sink_ids_for_dependencies.count(surface_id.frame_sink_id()) > 0; 108 frame_sink_ids_for_dependencies.count(surface_id.frame_sink_id()) > 0;
109 if (is_fallback_surface) { 109 if (is_fallback_surface) {
110 Surface* surface = surface_manager_->GetSurfaceForId(surface_id); 110 Surface* surface = surface_manager_->GetSurfaceForId(surface_id);
111 DCHECK(surface); 111 // A misbehaving client may report a non-existent surface ID as a
112 surface->Close(); 112 // |referenced_surface|. In that case, |surface| would be nullptr, and
113 // there is nothing to do here.
114 if (surface)
115 surface->Close();
113 } 116 }
114 } 117 }
115 pending_frame_data_ = 118 pending_frame_data_ =
116 FrameData(std::move(frame), callback, will_draw_callback); 119 FrameData(std::move(frame), callback, will_draw_callback);
117 // Ask the surface manager to inform |this| when its dependencies are 120 // Ask the surface manager to inform |this| when its dependencies are
118 // resolved. 121 // resolved.
119 surface_manager_->RequestSurfaceResolution(this); 122 surface_manager_->RequestSurfaceResolution(this);
120 } else { 123 } else {
121 // If there are no blockers, then immediately activate the frame. 124 // If there are no blockers, then immediately activate the frame.
122 ActivateFrame(FrameData(std::move(frame), callback, will_draw_callback)); 125 ActivateFrame(FrameData(std::move(frame), callback, will_draw_callback));
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 frame->metadata.latency_info.swap(*latency_info); 381 frame->metadata.latency_info.swap(*latency_info);
379 return; 382 return;
380 } 383 }
381 std::copy(frame->metadata.latency_info.begin(), 384 std::copy(frame->metadata.latency_info.begin(),
382 frame->metadata.latency_info.end(), 385 frame->metadata.latency_info.end(),
383 std::back_inserter(*latency_info)); 386 std::back_inserter(*latency_info));
384 frame->metadata.latency_info.clear(); 387 frame->metadata.latency_info.clear();
385 } 388 }
386 389
387 } // namespace cc 390 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/primary_begin_frame_source.cc ('k') | cc/surfaces/surface_dependency_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698