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

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

Issue 2365583004: Mac: Clean up plumbing of accelerated widgets (Closed)
Patch Set: make_scoped_refptr Created 4 years, 2 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
« no previous file with comments | « no previous file | content/browser/compositor/gpu_output_surface_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_OUTPUT_SURFACE_MAC_H_ 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_ 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_
7 7
8 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" 8 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
9 9
10 #include "ui/gfx/native_widget_types.h"
11
10 namespace content { 12 namespace content {
11 13
12 class GpuOutputSurfaceMac 14 class GpuOutputSurfaceMac
13 : public GpuSurfacelessBrowserCompositorOutputSurface { 15 : public GpuSurfacelessBrowserCompositorOutputSurface {
14 public: 16 public:
15 GpuOutputSurfaceMac( 17 GpuOutputSurfaceMac(
18 gfx::AcceleratedWidget widget,
16 scoped_refptr<ContextProviderCommandBuffer> context, 19 scoped_refptr<ContextProviderCommandBuffer> context,
17 gpu::SurfaceHandle surface_handle, 20 gpu::SurfaceHandle surface_handle,
18 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, 21 scoped_refptr<ui::CompositorVSyncManager> vsync_manager,
19 cc::SyntheticBeginFrameSource* begin_frame_source, 22 cc::SyntheticBeginFrameSource* begin_frame_source,
20 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> 23 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator>
21 overlay_candidate_validator, 24 overlay_candidate_validator,
22 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); 25 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager);
23 ~GpuOutputSurfaceMac() override; 26 ~GpuOutputSurfaceMac() override;
24 27
25 // cc::OutputSurface implementation. 28 // cc::OutputSurface implementation.
26 void SwapBuffers(cc::CompositorFrame frame) override; 29 void SwapBuffers(cc::CompositorFrame frame) override;
27 bool SurfaceIsSuspendForRecycle() const override; 30 bool SurfaceIsSuspendForRecycle() const override;
28 31
29 // BrowserCompositorOutputSurface implementation. 32 // BrowserCompositorOutputSurface implementation.
30 void OnGpuSwapBuffersCompleted( 33 void OnGpuSwapBuffersCompleted(
31 const std::vector<ui::LatencyInfo>& latency_info, 34 const std::vector<ui::LatencyInfo>& latency_info,
32 gfx::SwapResult result, 35 gfx::SwapResult result,
33 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) override; 36 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) override;
34 void SetSurfaceSuspendedForRecycle(bool suspended) override; 37 void SetSurfaceSuspendedForRecycle(bool suspended) override;
35 38
36 private: 39 private:
40 gfx::AcceleratedWidget widget_;
41
37 // Store remote layers in a separate structure, so that non-Objective-C files 42 // Store remote layers in a separate structure, so that non-Objective-C files
38 // may include this header. 43 // may include this header.
39 struct RemoteLayers; 44 struct RemoteLayers;
40 std::unique_ptr<RemoteLayers> remote_layers_; 45 std::unique_ptr<RemoteLayers> remote_layers_;
41 46
42 enum ShouldShowFramesState { 47 enum ShouldShowFramesState {
43 // Frames that come from the GPU process should appear on-screen. 48 // Frames that come from the GPU process should appear on-screen.
44 SHOULD_SHOW_FRAMES, 49 SHOULD_SHOW_FRAMES,
45 // The compositor has been suspended. Any frames that come from the GPU 50 // 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. 51 // process are for the pre-suspend content and should not be displayed.
47 SHOULD_NOT_SHOW_FRAMES_SUSPENDED, 52 SHOULD_NOT_SHOW_FRAMES_SUSPENDED,
48 // The compositor has been un-suspended, but has not yet issued a swap 53 // 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 54 // since being un-suspended, so any frames that come from the GPU process
50 // are for pre-suspend content and should not be displayed. 55 // are for pre-suspend content and should not be displayed.
51 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED, 56 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED,
52 }; 57 };
53 ShouldShowFramesState should_show_frames_state_ = SHOULD_SHOW_FRAMES; 58 ShouldShowFramesState should_show_frames_state_ = SHOULD_SHOW_FRAMES;
54 59
55 DISALLOW_COPY_AND_ASSIGN(GpuOutputSurfaceMac); 60 DISALLOW_COPY_AND_ASSIGN(GpuOutputSurfaceMac);
56 }; 61 };
57 62
58 } // namespace content 63 } // namespace content
59 64
60 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_ 65 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/compositor/gpu_output_surface_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698