Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_ | |
| 7 | |
| 8 #include "base/memory/weak_ptr.h" | |
| 9 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | |
|
mthiesse
2017/03/08 01:00:01
nit: forward declare this
| |
| 10 | |
| 11 namespace gl { | |
| 12 class SurfaceTexture; | |
| 13 class ScopedJavaSurface; | |
| 14 } | |
| 15 | |
| 16 namespace gpu { | |
| 17 class GpuChannelHost; | |
| 18 struct MailboxHolder; | |
| 19 namespace gles2 { | |
| 20 class GLES2Interface; | |
| 21 } | |
| 22 } | |
| 23 | |
| 24 namespace ui { | |
| 25 class ContextProviderCommandBuffer; | |
| 26 } | |
| 27 | |
| 28 namespace vr_shell { | |
| 29 | |
| 30 class MailboxToSurfaceBridge { | |
| 31 public: | |
| 32 MailboxToSurfaceBridge(); | |
| 33 ~MailboxToSurfaceBridge(); | |
| 34 | |
| 35 std::unique_ptr<gl::ScopedJavaSurface> CreateSurface( | |
| 36 scoped_refptr<gl::SurfaceTexture>); | |
| 37 | |
| 38 void ResizeSurface(int width, int height); | |
| 39 | |
| 40 bool CopyFrameToSurface(int frame_index, | |
| 41 const gpu::MailboxHolder& mailbox, | |
| 42 bool discard); | |
| 43 | |
| 44 private: | |
| 45 void OnGpuChannelEstablished( | |
| 46 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); | |
| 47 | |
| 48 void InitializeRenderer(); | |
| 49 void DrawQuad(unsigned int textureHandle); | |
| 50 | |
| 51 scoped_refptr<ui::ContextProviderCommandBuffer> | |
| 52 context_provider_command_buffer_; | |
| 53 gpu::gles2::GLES2Interface* gl_ = nullptr; | |
| 54 int surface_handle_; | |
| 55 base::WeakPtrFactory<MailboxToSurfaceBridge> weak_ptr_factory_; | |
| 56 }; | |
| 57 | |
| 58 } // namespace vr_shell | |
| 59 | |
| 60 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_ | |
| OLD | NEW |