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

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

Issue 1878103002: Plumb a Browser->GPU surface destruction message for Android VDAs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed sievers comments. Created 4 years, 8 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
(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 "content/common/gpu/media/avda_surface_tracker.h"
6
7 #include "base/lazy_instance.h"
8
9 namespace content {
10
11 namespace {
12 static base::LazyInstance<AVDASurfaceTracker> g_lazy_instance =
13 LAZY_INSTANCE_INITIALIZER;
14 }
15
16 AVDASurfaceTracker::AVDASurfaceTracker() {}
17
18 AVDASurfaceTracker::~AVDASurfaceTracker() {}
19
20 void AVDASurfaceTracker::RegisterOnDestroyingSurfaceCallback(
21 const OnDestroyingSurfaceCallback& cb) {
22 callbacks_.push_back(cb);
23 }
24
25 void AVDASurfaceTracker::UnregisterOnDestroyingSurfaceCallback(
26 const OnDestroyingSurfaceCallback& cb) {
27 for (auto it = callbacks_.begin(); it != callbacks_.end(); ++it) {
28 if (it->Equals(cb)) {
29 callbacks_.erase(it);
30 return;
31 }
32 }
33 }
34
35 void AVDASurfaceTracker::NotifyDestroyingSurface(int surface_id) {
36 for (const auto& cb : callbacks_)
37 cb.Run(surface_id);
38 }
39
40 AVDASurfaceTracker* AVDASurfaceTracker::GetInstance() {
41 return g_lazy_instance.Pointer();
42 }
43
44 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698