Update broken references to image assets
[chromium-blink-merge.git] / content / common / gpu / stream_texture_android.h
blobcce4502c2723f9466955477133316f41238649c6
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_
6 #define CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_
8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h"
10 #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"
15 namespace gfx {
16 class Size;
19 namespace content {
21 class StreamTexture : public gfx::GLImage,
22 public IPC::Listener,
23 public GpuCommandBufferStub::DestructionObserver {
24 public:
25 static bool Create(GpuCommandBufferStub* owner_stub,
26 uint32 client_texture_id,
27 int stream_id);
29 private:
30 StreamTexture(GpuCommandBufferStub* owner_stub,
31 int32 route_id,
32 uint32 texture_id);
33 ~StreamTexture() override;
35 // gfx::GLImage implementation:
36 void Destroy(bool have_context) override;
37 gfx::Size GetSize() override;
38 unsigned GetInternalFormat() override;
39 bool BindTexImage(unsigned target) override;
40 void ReleaseTexImage(unsigned target) override;
41 bool CopyTexSubImage(unsigned target,
42 const gfx::Point& offset,
43 const gfx::Rect& rect) override;
44 void WillUseTexImage() override;
45 void DidUseTexImage() override {}
46 void WillModifyTexImage() override {}
47 void DidModifyTexImage() override {}
48 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
49 int z_order,
50 gfx::OverlayTransform transform,
51 const gfx::Rect& bounds_rect,
52 const gfx::RectF& crop_rect) override;
53 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
54 uint64_t process_tracing_id,
55 const std::string& dump_name) override;
57 // GpuCommandBufferStub::DestructionObserver implementation.
58 void OnWillDestroyStub() override;
60 // Called when a new frame is available for the SurfaceTexture.
61 void OnFrameAvailable();
63 // IPC::Listener implementation:
64 bool OnMessageReceived(const IPC::Message& message) override;
66 // IPC message handlers:
67 void OnStartListening();
68 void OnEstablishPeer(int32 primary_id, int32 secondary_id);
69 void OnSetSize(const gfx::Size& size) { size_ = size; }
71 scoped_refptr<gfx::SurfaceTexture> surface_texture_;
73 // Current transform matrix of the surface texture.
74 float current_matrix_[16];
76 // Current size of the surface texture.
77 gfx::Size size_;
79 // Whether we ever bound a valid frame.
80 bool has_valid_frame_;
82 // Whether a new frame is available that we should update to.
83 bool has_pending_frame_;
85 GpuCommandBufferStub* owner_stub_;
86 int32 route_id_;
87 bool has_listener_;
89 base::WeakPtrFactory<StreamTexture> weak_factory_;
90 DISALLOW_COPY_AND_ASSIGN(StreamTexture);
93 } // namespace content
95 #endif // CONTENT_COMMON_GPU_STREAM_TEXTURE_ANDROID_H_