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

Side by Side Diff: content/browser/compositor/gpu_browser_compositor_output_surface.h

Issue 1123763003: Draw the offscreen texture to reflector's surface without extra copy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "content/browser/compositor/browser_compositor_output_surface.h" 9 #include "content/browser/compositor/browser_compositor_output_surface.h"
10 10
11 namespace ui { 11 namespace ui {
12 class CompositorVSyncManager; 12 class CompositorVSyncManager;
13 } 13 }
14 14
15 namespace content { 15 namespace content {
16 class CommandBufferProxyImpl; 16 class CommandBufferProxyImpl;
17 class BrowserCompositorOverlayCandidateValidator; 17 class BrowserCompositorOverlayCandidateValidator;
18 class GLHelper;
19 class OwnedMailbox;
18 20
19 // Adapts a WebGraphicsContext3DCommandBufferImpl into a 21 // Adapts a WebGraphicsContext3DCommandBufferImpl into a
20 // cc::OutputSurface that also handles vsync parameter updates 22 // cc::OutputSurface that also handles vsync parameter updates
21 // arriving from the GPU process. 23 // arriving from the GPU process.
22 class GpuBrowserCompositorOutputSurface 24 class GpuBrowserCompositorOutputSurface
23 : public BrowserCompositorOutputSurface { 25 : public BrowserCompositorOutputSurface {
24 public: 26 public:
25 GpuBrowserCompositorOutputSurface( 27 GpuBrowserCompositorOutputSurface(
26 const scoped_refptr<ContextProviderCommandBuffer>& context, 28 const scoped_refptr<ContextProviderCommandBuffer>& context,
27 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, 29 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
28 scoped_ptr<BrowserCompositorOverlayCandidateValidator> 30 scoped_ptr<BrowserCompositorOverlayCandidateValidator>
29 overlay_candidate_validator); 31 overlay_candidate_validator);
30 32
31 ~GpuBrowserCompositorOutputSurface() override; 33 ~GpuBrowserCompositorOutputSurface() override;
32 34
33 protected: 35 protected:
36 // BrowserCompositorOutputSurface:
37 void OnReflectorChanged() override;
38
34 // cc::OutputSurface implementation. 39 // cc::OutputSurface implementation.
35 void SwapBuffers(cc::CompositorFrame* frame) override; 40 void SwapBuffers(cc::CompositorFrame* frame) override;
36 bool BindToClient(cc::OutputSurfaceClient* client) override; 41 bool BindToClient(cc::OutputSurfaceClient* client) override;
37 42
43 void DeleteTexture();
44
38 #if defined(OS_MACOSX) 45 #if defined(OS_MACOSX)
39 void OnSurfaceDisplayed() override; 46 void OnSurfaceDisplayed() override;
40 void SetSurfaceSuspendedForRecycle(bool suspended) override; 47 void SetSurfaceSuspendedForRecycle(bool suspended) override;
41 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const override; 48 bool SurfaceShouldNotShowFramesAfterSuspendForRecycle() const override;
42 enum ShouldShowFramesState { 49 enum ShouldShowFramesState {
43 // Frames that come from the GPU process should appear on-screen. 50 // Frames that come from the GPU process should appear on-screen.
44 SHOULD_SHOW_FRAMES, 51 SHOULD_SHOW_FRAMES,
45 // The compositor has been suspended. Any frames that come from the GPU 52 // The compositor has been suspended. Any frames that come from the GPU
46 // process are for the pre-suspend content and should not be displayed. 53 // process are for the pre-suspend content and should not be displayed.
47 SHOULD_NOT_SHOW_FRAMES_SUSPENDED, 54 SHOULD_NOT_SHOW_FRAMES_SUSPENDED,
48 // The compositor has been un-suspended, but has not yet issued a swap 55 // The compositor has been un-suspended, but has not yet issued a swap
49 // since being un-suspended, so any frames that come from the GPU process 56 // since being un-suspended, so any frames that come from the GPU process
50 // are for pre-suspend content and should not be displayed. 57 // are for pre-suspend content and should not be displayed.
51 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED, 58 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED,
52 }; 59 };
53 ShouldShowFramesState should_show_frames_state_; 60 ShouldShowFramesState should_show_frames_state_;
54 #endif 61 #endif
55 62
56 CommandBufferProxyImpl* GetCommandBufferProxy(); 63 CommandBufferProxyImpl* GetCommandBufferProxy();
57 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info); 64 void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info);
58 65
59 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)> 66 base::CancelableCallback<void(const std::vector<ui::LatencyInfo>&)>
60 swap_buffers_completion_callback_; 67 swap_buffers_completion_callback_;
61 base::CancelableCallback<void(base::TimeTicks timebase, 68 base::CancelableCallback<void(base::TimeTicks timebase,
62 base::TimeDelta interval)> 69 base::TimeDelta interval)>
63 update_vsync_parameters_callback_; 70 update_vsync_parameters_callback_;
64 71
72 // Texture for mirroring.
73 scoped_refptr<OwnedMailbox> mailbox_;
74 scoped_ptr<GLHelper> mirrored_compositor_gl_helper_;
75 int mirrored_compositor_gl_helper_texture_id_;
76
65 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); 77 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface);
66 }; 78 };
67 79
68 } // namespace content 80 } // namespace content
69 81
70 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ 82 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698