| OLD | NEW |
| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 : BrowserCompositorOutputSurface(std::move(software_device), | 29 : BrowserCompositorOutputSurface(std::move(software_device), |
| 30 vsync_manager, | 30 vsync_manager, |
| 31 begin_frame_source), | 31 begin_frame_source), |
| 32 task_runner_(std::move(task_runner)), | 32 task_runner_(std::move(task_runner)), |
| 33 weak_factory_(this) {} | 33 weak_factory_(this) {} |
| 34 | 34 |
| 35 SoftwareBrowserCompositorOutputSurface:: | 35 SoftwareBrowserCompositorOutputSurface:: |
| 36 ~SoftwareBrowserCompositorOutputSurface() { | 36 ~SoftwareBrowserCompositorOutputSurface() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 void SoftwareBrowserCompositorOutputSurface::BindToClient( |
| 40 cc::OutputSurfaceClient* client) { |
| 41 DCHECK(client); |
| 42 DCHECK(!client_); |
| 43 client_ = client; |
| 44 } |
| 45 |
| 39 void SoftwareBrowserCompositorOutputSurface::EnsureBackbuffer() { | 46 void SoftwareBrowserCompositorOutputSurface::EnsureBackbuffer() { |
| 40 software_device()->EnsureBackbuffer(); | 47 software_device()->EnsureBackbuffer(); |
| 41 } | 48 } |
| 42 | 49 |
| 43 void SoftwareBrowserCompositorOutputSurface::DiscardBackbuffer() { | 50 void SoftwareBrowserCompositorOutputSurface::DiscardBackbuffer() { |
| 44 software_device()->DiscardBackbuffer(); | 51 software_device()->DiscardBackbuffer(); |
| 45 } | 52 } |
| 46 | 53 |
| 47 void SoftwareBrowserCompositorOutputSurface::BindFramebuffer() { | 54 void SoftwareBrowserCompositorOutputSurface::BindFramebuffer() { |
| 48 // Not used for software surfaces. | 55 // Not used for software surfaces. |
| 49 NOTREACHED(); | 56 NOTREACHED(); |
| 50 } | 57 } |
| 51 | 58 |
| 52 void SoftwareBrowserCompositorOutputSurface::Reshape( | 59 void SoftwareBrowserCompositorOutputSurface::Reshape( |
| 53 const gfx::Size& size, | 60 const gfx::Size& size, |
| 54 float device_scale_factor, | 61 float device_scale_factor, |
| 55 const gfx::ColorSpace& color_space, | 62 const gfx::ColorSpace& color_space, |
| 56 bool has_alpha) { | 63 bool has_alpha) { |
| 57 software_device()->Resize(size, device_scale_factor); | 64 software_device()->Resize(size, device_scale_factor); |
| 58 } | 65 } |
| 59 | 66 |
| 60 void SoftwareBrowserCompositorOutputSurface::SwapBuffers( | 67 void SoftwareBrowserCompositorOutputSurface::SwapBuffers( |
| 61 cc::OutputSurfaceFrame frame) { | 68 cc::OutputSurfaceFrame frame) { |
| 69 DCHECK(client_); |
| 62 base::TimeTicks swap_time = base::TimeTicks::Now(); | 70 base::TimeTicks swap_time = base::TimeTicks::Now(); |
| 63 for (auto& latency : frame.latency_info) { | 71 for (auto& latency : frame.latency_info) { |
| 64 latency.AddLatencyNumberWithTimestamp( | 72 latency.AddLatencyNumberWithTimestamp( |
| 65 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1); | 73 ui::INPUT_EVENT_GPU_SWAP_BUFFER_COMPONENT, 0, 0, swap_time, 1); |
| 66 latency.AddLatencyNumberWithTimestamp( | 74 latency.AddLatencyNumberWithTimestamp( |
| 67 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, | 75 ui::INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT, 0, 0, |
| 68 swap_time, 1); | 76 swap_time, 1); |
| 69 } | 77 } |
| 70 task_runner_->PostTask(FROM_HERE, | 78 task_runner_->PostTask(FROM_HERE, |
| 71 base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn, | 79 base::Bind(&RenderWidgetHostImpl::CompositorFrameDrawn, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return 0; | 116 return 0; |
| 109 } | 117 } |
| 110 | 118 |
| 111 #if defined(OS_MACOSX) | 119 #if defined(OS_MACOSX) |
| 112 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( | 120 void SoftwareBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle( |
| 113 bool suspended) { | 121 bool suspended) { |
| 114 } | 122 } |
| 115 #endif | 123 #endif |
| 116 | 124 |
| 117 } // namespace content | 125 } // namespace content |
| OLD | NEW |