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

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

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
« no previous file with comments | « content/common/BUILD.gn ('k') | content/common/gpu/media/avda_surface_tracker.cc » ('j') | 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 #ifndef CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_
6 #define CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "content/common/content_export.h"
12
13 namespace content {
14
15 using OnDestroyingSurfaceCallback = base::Callback<void(int)>;
16
17 // AVDASurfaceTracker provides AndroidVideoDecodeAccelerators a way to register
18 // callbacks that will be called when surfaces are destroyed. This is important
19 // because Android SurfaceView Surfaces can be destroyed by the framework at any
20 // time and we must stop rendering to them before returning from
21 // onSurfaceDestroyed().
22 // This is not thread safe. All access should be on the gpu main thread.
Will Harris 2016/04/22 23:31:09 nit: if this is not thread safe it would be nice t
watk 2016/04/23 00:48:58 Sounds good. Done with a ThreadChecker.
23 // Callbacks will be run on the same thread.
24 class AVDASurfaceTracker {
25 public:
26 AVDASurfaceTracker();
27 ~AVDASurfaceTracker();
28
29 static AVDASurfaceTracker* GetInstance();
30
31 void RegisterOnDestroyingSurfaceCallback(
32 const OnDestroyingSurfaceCallback& cb);
33
34 // Unregister a callback that was previously registered.
35 void UnregisterOnDestroyingSurfaceCallback(
36 const OnDestroyingSurfaceCallback& cb);
37
38 // Called in response to a message from the Browser indicating that the given
39 // surface is in the process of being destroyed.
40 void NotifyDestroyingSurface(int surface_id);
41
42 private:
43 std::vector<OnDestroyingSurfaceCallback> callbacks_;
44 DISALLOW_COPY_AND_ASSIGN(AVDASurfaceTracker);
45 };
46
47 } // namespace content
48
49 #endif // CONTENT_COMMON_GPU_MEDIA_AVDA_SURFACE_TRACKER_H_
OLDNEW
« no previous file with comments | « content/common/BUILD.gn ('k') | content/common/gpu/media/avda_surface_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698