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

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 1688033005: Monitor VideoResourceUpdater reusing destructed resource in Debug mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 frame_ptr(nullptr), 127 frame_ptr(nullptr),
128 plane_index(0u) { 128 plane_index(0u) {
129 } 129 }
130 130
131 bool VideoResourceUpdater::PlaneResourceMatchesUniqueID( 131 bool VideoResourceUpdater::PlaneResourceMatchesUniqueID(
132 const PlaneResource& plane_resource, 132 const PlaneResource& plane_resource,
133 const media::VideoFrame* video_frame, 133 const media::VideoFrame* video_frame,
134 size_t plane_index) { 134 size_t plane_index) {
135 return plane_resource.frame_ptr == video_frame && 135 return plane_resource.frame_ptr == video_frame &&
136 plane_resource.plane_index == plane_index && 136 plane_resource.plane_index == plane_index &&
137 plane_resource.timestamp == video_frame->timestamp(); 137 plane_resource.timestamp == video_frame->timestamp() &&
138 video_frame->metadata()->IsTrue(
139 media::VideoFrameMetadata::RESOURCE_UPDATER_FLAG);
138 } 140 }
139 141
140 void VideoResourceUpdater::SetPlaneResourceUniqueId( 142 void VideoResourceUpdater::SetPlaneResourceUniqueId(
141 const media::VideoFrame* video_frame, 143 media::VideoFrame* video_frame,
142 size_t plane_index, 144 size_t plane_index,
143 PlaneResource* plane_resource) { 145 PlaneResource* plane_resource) {
144 plane_resource->frame_ptr = video_frame; 146 plane_resource->frame_ptr = video_frame;
145 plane_resource->plane_index = plane_index; 147 plane_resource->plane_index = plane_index;
146 plane_resource->timestamp = video_frame->timestamp(); 148 plane_resource->timestamp = video_frame->timestamp();
149 video_frame->metadata()->SetBoolean(
150 media::VideoFrameMetadata::RESOURCE_UPDATER_FLAG, true);
147 } 151 }
148 152
149 VideoFrameExternalResources::VideoFrameExternalResources() 153 VideoFrameExternalResources::VideoFrameExternalResources()
150 : type(NONE), 154 : type(NONE),
151 read_lock_fences_enabled(false), 155 read_lock_fences_enabled(false),
152 offset(0.0f), 156 offset(0.0f),
153 multiplier(1.0f) {} 157 multiplier(1.0f) {}
154 158
155 VideoFrameExternalResources::~VideoFrameExternalResources() {} 159 VideoFrameExternalResources::~VideoFrameExternalResources() {}
156 160
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 resource_it->ref_count = 0; 685 resource_it->ref_count = 0;
682 updater->DeleteResource(resource_it); 686 updater->DeleteResource(resource_it);
683 return; 687 return;
684 } 688 }
685 689
686 --resource_it->ref_count; 690 --resource_it->ref_count;
687 DCHECK_GE(resource_it->ref_count, 0); 691 DCHECK_GE(resource_it->ref_count, 0);
688 } 692 }
689 693
690 } // namespace cc 694 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698