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

Side by Side 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: Rebase to 11e28fd6b9380b77273db51ef0b6ccc7ea341944 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 unified diff | Download patch
OLDNEW
(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
10 namespace gl {
11 class SurfaceTexture;
12 }
13
14 namespace gpu {
15 struct MailboxHolder;
16 namespace gles2 {
17 class GLES2Interface;
18 }
19 }
20
21 namespace cc {
22 class ContextProvider;
23 }
24
25 namespace vr_shell {
26
27 class MailboxToSurfaceBridge {
28 public:
29 MailboxToSurfaceBridge();
30 ~MailboxToSurfaceBridge();
31
32 void CreateSurface(gl::SurfaceTexture*);
33
34 void ResizeSurface(int width, int height);
35
36 // Returns true if swapped successfully. This can fail if the GL
37 // context isn't ready for use yet, in that case the caller
38 // won't get a new frame on the SurfaceTexture.
39 bool CopyMailboxToSurfaceAndSwap(const gpu::MailboxHolder& mailbox);
40
41 private:
42 void OnContextAvailable(scoped_refptr<cc::ContextProvider>);
43 void InitializeRenderer();
44 void DestroyContext();
45 void DrawQuad(unsigned int textureHandle);
46
47 scoped_refptr<cc::ContextProvider> context_provider_;
48 gpu::gles2::GLES2Interface* gl_ = nullptr;
49 int surface_handle_ = 0;
50
51 // Saved state for a pending resize, the dimensions are only
52 // valid if needs_resize_ is true.
53 bool needs_resize_ = false;
54 int resize_width_;
55 int resize_height_;
56
57 // Must be last.
58 base::WeakPtrFactory<MailboxToSurfaceBridge> weak_ptr_factory_;
59 };
60
61 } // namespace vr_shell
62
63 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_MAILBOX_TO_SURFACE_BRIDGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/BUILD.gn ('k') | chrome/browser/android/vr_shell/mailbox_to_surface_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698