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

Unified Diff: chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h

Issue 2729523002: Re-land^2 WebVR compositor bypass via BrowserMain context + mailbox (Closed)
Patch Set: Update MailboxToSurfaceBridge to use new ContextProvider API Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
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..1750149dc4243b3959860a478ba4301ddf743d5b
--- /dev/null
+++ b/chrome/browser/android/vr_shell/mailbox_to_surface_bridge.h
@@ -0,0 +1,54 @@
+// 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"
+
+namespace gl {
+class SurfaceTexture;
+}
+
+namespace gpu {
+struct MailboxHolder;
+namespace gles2 {
+class GLES2Interface;
+}
+}
+
+namespace cc {
+class ContextProvider;
+}
+
+namespace vr_shell {
+
+class MailboxToSurfaceBridge {
+ public:
+ MailboxToSurfaceBridge();
+ ~MailboxToSurfaceBridge();
+
+ void CreateSurface(scoped_refptr<gl::SurfaceTexture>);
+
+ void ResizeSurface(int width, int height);
+
+ bool CopyFrameToSurface(int frame_index,
+ const gpu::MailboxHolder& mailbox,
+ bool discard);
+
+ private:
+ void OnContextAvailable(scoped_refptr<cc::ContextProvider>);
+
+ void InitializeRenderer();
+ void DrawQuad(unsigned int textureHandle);
+
+ scoped_refptr<cc::ContextProvider> context_provider_;
+ gpu::gles2::GLES2Interface* gl_ = nullptr;
+ int surface_handle_ = 0;
+ base::WeakPtrFactory<MailboxToSurfaceBridge> weak_ptr_factory_;
+};
+
+} // namespace vr_shell
+
+#endif // CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_

Powered by Google App Engine
This is Rietveld 408576698