Chromium Code Reviews| Index: chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h |
| diff --git a/chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h b/chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4d4b316c70b7d611f296d1cd61b06b4fedd24b40 |
| --- /dev/null |
| +++ b/chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2017 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 CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_ |
| +#define CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
|
mthiesse
2017/03/08 01:00:01
nit: forward declare this
|
| + |
| +namespace gl { |
| +class SurfaceTexture; |
| +class ScopedJavaSurface; |
| +} |
| + |
| +namespace gpu { |
| +class GpuChannelHost; |
| +struct MailboxHolder; |
| +namespace gles2 { |
| +class GLES2Interface; |
| +} |
| +} |
| + |
| +namespace ui { |
| +class ContextProviderCommandBuffer; |
| +} |
| + |
| +namespace vr_shell { |
| + |
| +class MailboxToSurfaceBridge { |
| + public: |
| + MailboxToSurfaceBridge(); |
| + ~MailboxToSurfaceBridge(); |
| + |
| + std::unique_ptr<gl::ScopedJavaSurface> CreateSurface( |
| + scoped_refptr<gl::SurfaceTexture>); |
| + |
| + void ResizeSurface(int width, int height); |
| + |
| + bool CopyFrameToSurface(int frame_index, |
| + const gpu::MailboxHolder& mailbox, |
| + bool discard); |
| + |
| + private: |
| + void OnGpuChannelEstablished( |
| + scoped_refptr<gpu::GpuChannelHost> gpu_channel_host); |
| + |
| + void InitializeRenderer(); |
| + void DrawQuad(unsigned int textureHandle); |
| + |
| + scoped_refptr<ui::ContextProviderCommandBuffer> |
| + context_provider_command_buffer_; |
| + gpu::gles2::GLES2Interface* gl_ = nullptr; |
| + int surface_handle_; |
| + base::WeakPtrFactory<MailboxToSurfaceBridge> weak_ptr_factory_; |
| +}; |
| + |
| +} // namespace vr_shell |
| + |
| +#endif // CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_ |