| OLD | NEW |
| 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 #include "gpu/ipc/service/pass_through_image_transport_surface.h" | 5 #include "gpu/ipc/service/pass_through_image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // We use WeakPtr here to avoid manual management of life time of an instance | 51 // We use WeakPtr here to avoid manual management of life time of an instance |
| 52 // of this class. Callback will not be called once the instance of this class | 52 // of this class. Callback will not be called once the instance of this class |
| 53 // is destroyed. However, this also means that the callback can be run on | 53 // is destroyed. However, this also means that the callback can be run on |
| 54 // the calling thread only. | 54 // the calling thread only. |
| 55 gl::GLSurfaceAdapter::SwapBuffersAsync(base::Bind( | 55 gl::GLSurfaceAdapter::SwapBuffersAsync(base::Bind( |
| 56 &PassThroughImageTransportSurface::FinishSwapBuffersAsync, | 56 &PassThroughImageTransportSurface::FinishSwapBuffersAsync, |
| 57 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), callback)); | 57 weak_ptr_factory_.GetWeakPtr(), base::Passed(&latency_info), callback)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 gfx::SwapResult PassThroughImageTransportSurface::SwapBuffersWithDamage( | 60 gfx::SwapResult PassThroughImageTransportSurface::SwapBuffersWithBounds( |
| 61 int x, | 61 const std::vector<gfx::Rect>& rects) { |
| 62 int y, | |
| 63 int width, | |
| 64 int height) { | |
| 65 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info = | 62 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info = |
| 66 StartSwapBuffers(); | 63 StartSwapBuffers(); |
| 67 gfx::SwapResult result = | 64 gfx::SwapResult result = gl::GLSurfaceAdapter::SwapBuffersWithBounds(rects); |
| 68 gl::GLSurfaceAdapter::SwapBuffersWithDamage(x, y, width, height); | |
| 69 FinishSwapBuffers(std::move(latency_info), result); | 65 FinishSwapBuffers(std::move(latency_info), result); |
| 70 return result; | 66 return result; |
| 71 } | 67 } |
| 72 | 68 |
| 73 gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x, | 69 gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x, |
| 74 int y, | 70 int y, |
| 75 int width, | 71 int width, |
| 76 int height) { | 72 int height) { |
| 77 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info = | 73 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info = |
| 78 StartSwapBuffers(); | 74 StartSwapBuffers(); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 182 |
| 187 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( | 183 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( |
| 188 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, | 184 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, |
| 189 GLSurface::SwapCompletionCallback callback, | 185 GLSurface::SwapCompletionCallback callback, |
| 190 gfx::SwapResult result) { | 186 gfx::SwapResult result) { |
| 191 FinishSwapBuffers(std::move(latency_info), result); | 187 FinishSwapBuffers(std::move(latency_info), result); |
| 192 callback.Run(result); | 188 callback.Run(result); |
| 193 } | 189 } |
| 194 | 190 |
| 195 } // namespace gpu | 191 } // namespace gpu |
| OLD | NEW |