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

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: Fix typos/add missing includes 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/callback.h"
8 #include "base/lazy_instance.h"
9
10 namespace content {
11
12 namespace {
13 static base::LazyInstance<AVDASurfaceTracker> g_lazy_instance =
14 LAZY_INSTANCE_INITIALIZER;
15 }
16
17 AVDASurfaceTracker::AVDASurfaceTracker() {}
18
19 AVDASurfaceTracker::~AVDASurfaceTracker() {}
20
21 void AVDASurfaceTracker::RegisterOnDestroyingSurfaceCallback(
22 const OnDestroyingSurfaceCallback& cb) {
23 callbacks_.push_back(cb);
24 }
25
26 void AVDASurfaceTracker::UnregisterOnDestroyingSurfaceCallback(
27 const OnDestroyingSurfaceCallback& cb) {
28 for (auto it = callbacks_.begin(); it != callbacks_.end(); ++it) {
29 if (it->Equals(cb)) {
30 callbacks_.erase(it);
31 return;
32 }
33 }
34 }
35
36 void AVDASurfaceTracker::NotifyDestroyingSurface(int surface_id) {
37 for (const auto& cb : callbacks_)
38 cb.Run(surface_id);
39 }
40
41 AVDASurfaceTracker* AVDASurfaceTracker::GetInstance() {
42 return g_lazy_instance.Pointer();
43 }
44
45 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698