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

Unified Diff: cc/resources/video_resource_updater.h

Issue 1688033005: Monitor VideoResourceUpdater reusing destructed resource in Debug mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address danakj's comments. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/video_resource_updater.h
diff --git a/cc/resources/video_resource_updater.h b/cc/resources/video_resource_updater.h
index d4eaae32a6734355f8ab1643f5a81622a49dd634..24dd24d40858ceb65466f3b183b4957a1eb7e218 100644
--- a/cc/resources/video_resource_updater.h
+++ b/cc/resources/video_resource_updater.h
@@ -99,6 +99,14 @@ class CC_EXPORT VideoResourceUpdater
// frame pointer will only be used for pointer comparison, i.e. the
// underlying data will not be accessed.
const void* frame_ptr;
+#if DCHECK_IS_ON()
+ // This is marked true when the orginal VideoFrame is destructed. It is
+ // used to detect clients that are not setting the VideoFrame's timestamp
+ // field correctly, as required. The memory allocator can and will re-use
+ // the same pointer for new VideoFrame instances, so a destruction observer
+ // is used to detect that.
+ bool destructed;
+#endif
size_t plane_index;
base::TimeDelta timestamp;
@@ -143,6 +151,12 @@ class CC_EXPORT VideoResourceUpdater
const gpu::SyncToken& sync_token,
bool lost_resource,
BlockingTaskRunner* main_thread_task_runner);
+#if DCHECK_IS_ON()
+ // Mark the |destructed| as true when the orginal VideoFrame is destructed.
+ static void MarkOldResource(base::WeakPtr<VideoResourceUpdater> updater,
+ const media::VideoFrame* video_frame_ptr,
+ base::TimeDelta timestamp);
+#endif
ContextProvider* context_provider_;
ResourceProvider* resource_provider_;
« no previous file with comments | « no previous file | cc/resources/video_resource_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698