blob: 26573eb7a624c2b278f73a6e6835d9d79b90b002 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SURFACE_TEXTURE_MANAGER_H_
#define CONTENT_BROWSER_ANDROID_IN_PROCESS_SURFACE_TEXTURE_MANAGER_H_
#include "content/common/android/surface_texture_manager.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/synchronization/lock.h"
#include "content/common/android/surface_texture_peer.h"
#include "content/common/content_export.h"
#include "ui/gl/android/scoped_java_surface.h"
namespace content {
class CONTENT_EXPORT InProcessSurfaceTextureManager
: public SurfaceTextureManager,
public SurfaceTexturePeer {
public:
static InProcessSurfaceTextureManager* GetInstance();
// Overridden from SurfaceTextureManager:
void RegisterSurfaceTexture(int surface_texture_id,
int client_id,
gfx::SurfaceTexture* surface_texture) override;
void UnregisterSurfaceTexture(int surface_texture_id, int client_id) override;
gfx::AcceleratedWidget AcquireNativeWidgetForSurfaceTexture(
int surface_texture_id) override;
// Overridden from SurfaceTexturePeer:
void EstablishSurfaceTexturePeer(
base::ProcessHandle render_process_handle,
scoped_refptr<gfx::SurfaceTexture> surface_texture,
int render_frame_id,
int player_id) override;
private:
friend struct DefaultSingletonTraits<InProcessSurfaceTextureManager>;
InProcessSurfaceTextureManager();
~InProcessSurfaceTextureManager() override;
using SurfaceTextureMap =
base::ScopedPtrHashMap<int, scoped_ptr<gfx::ScopedJavaSurface>>;
SurfaceTextureMap surface_textures_;
base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(InProcessSurfaceTextureManager);
};
} // namespace content
#endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_SURFACE_TEXTURE_MANAGER_H_
|