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

Side by Side Diff: media/gpu/avda_surface_tracker.cc

Issue 2508053002: media: Do a TimedWait() for video surface teardown in AVDA (Closed)
Patch Set: change timeout to 2 Created 4 years, 1 month 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 | « media/gpu/avda_surface_tracker.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/gpu/avda_surface_tracker.h"
6
7 #include "base/callback.h"
8 #include "base/lazy_instance.h"
9 #include "base/threading/thread_checker.h"
10
11 namespace media {
12
13 namespace {
14 static base::LazyInstance<AVDASurfaceTracker> g_lazy_instance =
15 LAZY_INSTANCE_INITIALIZER;
16 }
17
18 AVDASurfaceTracker::AVDASurfaceTracker() {}
19
20 AVDASurfaceTracker::~AVDASurfaceTracker() {}
21
22 void AVDASurfaceTracker::RegisterOnDestroyingSurfaceCallback(
23 const OnDestroyingSurfaceCallback& cb) {
24 DCHECK(thread_checker_.CalledOnValidThread());
25 callbacks_.push_back(cb);
26 }
27
28 void AVDASurfaceTracker::UnregisterOnDestroyingSurfaceCallback(
29 const OnDestroyingSurfaceCallback& cb) {
30 DCHECK(thread_checker_.CalledOnValidThread());
31 for (auto it = callbacks_.begin(); it != callbacks_.end(); ++it) {
32 if (it->Equals(cb)) {
33 callbacks_.erase(it);
34 return;
35 }
36 }
37 }
38
39 void AVDASurfaceTracker::NotifyDestroyingSurface(int surface_id) {
40 DCHECK(thread_checker_.CalledOnValidThread());
41 for (const auto& cb : callbacks_)
42 cb.Run(surface_id);
43 }
44
45 AVDASurfaceTracker* AVDASurfaceTracker::GetInstance() {
46 return g_lazy_instance.Pointer();
47 }
48
49 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/avda_surface_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698