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

Side by Side Diff: content/browser/compositor/software_browser_compositor_output_surface.cc

Issue 2352963002: cc: Make most of cc::OutputSurface abstract. (Closed)
Patch Set: outputsurface-cleanup: rebase 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
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 #include "content/browser/compositor/software_browser_compositor_output_surface. h" 5 #include "content/browser/compositor/software_browser_compositor_output_surface. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 15 matching lines...) Expand all
26 cc::SyntheticBeginFrameSource* begin_frame_source) 26 cc::SyntheticBeginFrameSource* begin_frame_source)
27 : BrowserCompositorOutputSurface(std::move(software_device), 27 : BrowserCompositorOutputSurface(std::move(software_device),
28 vsync_manager, 28 vsync_manager,
29 begin_frame_source), 29 begin_frame_source),
30 weak_factory_(this) {} 30 weak_factory_(this) {}
31 31
32 SoftwareBrowserCompositorOutputSurface:: 32 SoftwareBrowserCompositorOutputSurface::
33 ~SoftwareBrowserCompositorOutputSurface() { 33 ~SoftwareBrowserCompositorOutputSurface() {
34 } 34 }
35 35
36 void SoftwareBrowserCompositorOutputSurface::EnsureBackbuffer() {
37 software_device()->EnsureBackbuffer();
38 }
39
40 void SoftwareBrowserCompositorOutputSurface::DiscardBackbuffer() {
41 software_device()->DiscardBackbuffer();
42 }
43
44 void SoftwareBrowserCompositorOutputSurface::BindFramebuffer() {
45 // Not used for software surfaces.
46 NOTREACHED();
47 }
48
36 void SoftwareBrowserCompositorOutputSurface::SwapBuffers( 49 void SoftwareBrowserCompositorOutputSurface::SwapBuffers(
37 cc::CompositorFrame frame) { 50 cc::CompositorFrame frame) {
38 base::TimeTicks swap_time = base::TimeTicks::Now(); 51 base::TimeTicks swap_time = base::TimeTicks::Now();
39 for (auto& latency : frame.metadata.latency_info) { 52 for (auto& latency : frame.metadata.latency_info) {
40 latency.AddLatencyNumberWithTimestamp( 53 latency.AddLatencyNumberWithTimestamp(
41 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1); 54 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1);
42 latency.AddLatencyNumberWithTimestamp( 55 latency.AddLatencyNumberWithTimestamp(
43 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, 56 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0,
44 swap_time, 1); 57 swap_time, 1);
45 } 58 }
46 base::ThreadTaskRunnerHandle::Get()->PostTask( 59 base::ThreadTaskRunnerHandle::Get()->PostTask(
47 FROM_HERE, base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn, 60 FROM_HERE, base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn,
48 frame.metadata.latency_info)); 61 frame.metadata.latency_info));
49 62
50 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider(); 63 gfx::VSyncProvider* vsync_provider = software_device()->GetVSyncProvider();
51 if (vsync_provider) { 64 if (vsync_provider) {
52 vsync_provider->GetVSyncParameters(base::Bind( 65 vsync_provider->GetVSyncParameters(base::Bind(
53 &BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu, 66 &BrowserCompositorOutputSurface::OnUpdateVSyncParametersFromGpu,
54 weak_factory_.GetWeakPtr())); 67 weak_factory_.GetWeakPtr()));
55 } 68 }
56 PostSwapBuffersComplete(); 69 PostSwapBuffersComplete();
57 } 70 }
58 71
59 void SoftwareBrowserCompositorOutputSurface::BindFramebuffer() { 72 bool SoftwareBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() const {
60 // Not used for software surfaces. 73 return false;
61 NOTREACHED(); 74 }
75
76 unsigned SoftwareBrowserCompositorOutputSurface::GetOverlayTextureId() const {
77 return 0;
78 }
79
80 bool SoftwareBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle()
81 const {
82 return false;
62 } 83 }
63 84
64 GLenum 85 GLenum
65 SoftwareBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() { 86 SoftwareBrowserCompositorOutputSurface::GetFramebufferCopyTextureFormat() {
66 // Not used for software surfaces. 87 // Not used for software surfaces.
67 NOTREACHED(); 88 NOTREACHED();
68 return 0; 89 return 0;
69 } 90 }
70 91
71 void SoftwareBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( 92 void SoftwareBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(
72 const std::vector<ui::LatencyInfo>& latency_info, 93 const std::vector<ui::LatencyInfo>& latency_info,
73 gfx::SwapResult result, 94 gfx::SwapResult result,
74 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { 95 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
75 NOTREACHED(); 96 NOTREACHED();
76 } 97 }
77 98
78 #if defined(OS_MACOSX) 99 #if defined(OS_MACOSX)
79 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( 100 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle(
80 bool suspended) { 101 bool suspended) {
81 } 102 }
82 #endif 103 #endif
83 104
84 } // namespace content 105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698