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

Side by Side Diff: content/common/gpu/stream_texture_android.h

Issue 1417853006: gpu: introduce glSetStreamTextureSizeCHROMIUM(GLuint texture, GLint stream_id, GLsizei width, GLsiz… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android_webview.test failure Created 5 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ 5 #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_
6 #define CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ 6 #define CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/non_thread_safe.h"
10 #include "content/common/gpu/gpu_command_buffer_stub.h" 11 #include "content/common/gpu/gpu_command_buffer_stub.h"
11 #include "ipc/ipc_listener.h"
12 #include "ui/gl/android/surface_texture.h"
13 #include "ui/gl/gl_image.h"
14
15 namespace gfx {
16 class Size;
17 }
18 12
19 namespace content { 13 namespace content {
20 14
21 class StreamTexture : public gl::GLImage, 15 class StreamTexture;
22 public IPC::Listener, 16
23 public GpuCommandBufferStub::DestructionObserver { 17 class StreamTextureManager : public base::NonThreadSafe {
24 public: 18 public:
25 static bool Create(GpuCommandBufferStub* owner_stub, 19 StreamTextureManager();
26 uint32 client_texture_id, 20 ~StreamTextureManager();
27 int stream_id); 21
22 bool CreateStreamTexture(GpuCommandBufferStub* owner_stub,
23 uint32 client_texture_id,
24 int32 stream_id);
25 void SetStreamTextureSize(GpuCommandBufferStub* owner_stub,
26 uint32 client_texture_id,
27 int32 stream_id,
28 size_t width,
29 size_t height);
28 30
29 private: 31 private:
30 StreamTexture(GpuCommandBufferStub* owner_stub, 32 void OnReleaseStreamTexture(int32 stream_id);
31 int32 route_id,
32 uint32 texture_id);
33 ~StreamTexture() override;
34 33
35 // gl::GLImage implementation: 34 typedef std::map<int32, StreamTexture*> StreamTextureMap;
36 void Destroy(bool have_context) override; 35 StreamTextureMap stream_textures_;
37 gfx::Size GetSize() override;
38 unsigned GetInternalFormat() override;
39 bool BindTexImage(unsigned target) override;
40 void ReleaseTexImage(unsigned target) override;
41 bool CopyTexImage(unsigned target) override;
42 bool CopyTexSubImage(unsigned target,
43 const gfx::Point& offset,
44 const gfx::Rect& rect) override;
45 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
46 int z_order,
47 gfx::OverlayTransform transform,
48 const gfx::Rect& bounds_rect,
49 const gfx::RectF& crop_rect) override;
50 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
51 uint64_t process_tracing_id,
52 const std::string& dump_name) override;
53 36
54 // GpuCommandBufferStub::DestructionObserver implementation. 37 base::WeakPtrFactory<StreamTextureManager> weak_factory_;
55 void OnWillDestroyStub() override; 38 DISALLOW_COPY_AND_ASSIGN(StreamTextureManager);
56
57 // Called when a new frame is available for the SurfaceTexture.
58 void OnFrameAvailable();
59
60 // IPC::Listener implementation:
61 bool OnMessageReceived(const IPC::Message& message) override;
62
63 // IPC message handlers:
64 void OnStartListening();
65 void OnEstablishPeer(int32 primary_id, int32 secondary_id);
66 void OnSetSize(const gfx::Size& size) { size_ = size; }
dshwang 2015/11/07 15:53:03 Current SetSize hack doesn't update the size of te
67
68 scoped_refptr<gfx::SurfaceTexture> surface_texture_;
69
70 // Current transform matrix of the surface texture.
71 float current_matrix_[16];
72
73 // Current size of the surface texture.
74 gfx::Size size_;
75
76 // Whether we ever bound a valid frame.
77 bool has_valid_frame_;
78
79 // Whether a new frame is available that we should update to.
80 bool has_pending_frame_;
81
82 GpuCommandBufferStub* owner_stub_;
83 int32 route_id_;
84 bool has_listener_;
85 uint32 texture_id_;
86
87 base::WeakPtrFactory<StreamTexture> weak_factory_;
88 DISALLOW_COPY_AND_ASSIGN(StreamTexture);
89 }; 39 };
90 40
91 } // namespace content 41 } // namespace content
92 42
93 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_ 43 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698