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

Side by Side Diff: gpu/ipc/service/pass_through_image_transport_surface.cc

Issue 2805053004: Plumbing input event latency reporting through Mus GPU.
Patch Set: NON_EXPORTED_BASE Created 3 years, 8 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 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"
11 #include "ui/gfx/vsync_provider.h" 11 #include "ui/gfx/vsync_provider.h"
12 #include "ui/gl/gl_context.h" 12 #include "ui/gl/gl_context.h"
13 #include "ui/gl/gl_switches.h" 13 #include "ui/gl/gl_switches.h"
14 14
15 namespace gpu { 15 namespace gpu {
16 16
17 PassThroughImageTransportSurface::PassThroughImageTransportSurface( 17 PassThroughImageTransportSurface::PassThroughImageTransportSurface(
18 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, 18 base::WeakPtr<ImageTransportSurfaceDelegate> delegate,
19 gl::GLSurface* surface) 19 gl::GLSurface* surface)
20 : GLSurfaceAdapter(surface), 20 : GLSurfaceAdapter(surface),
21 delegate_(delegate), 21 delegate_(delegate),
22 did_set_swap_interval_(false), 22 did_set_swap_interval_(false),
23 weak_ptr_factory_(this) {} 23 weak_ptr_factory_(this) {}
24 24
25 bool PassThroughImageTransportSurface::Initialize( 25 bool PassThroughImageTransportSurface::Initialize(
26 gl::GLSurfaceFormat format) { 26 gl::GLSurfaceFormat format) {
27 // The surface is assumed to have already been initialized. 27 // The surface is assumed to have already been initialized.
28 delegate_->SetLatencyInfoCallback( 28 delegate_->SetLatencyInfoCallback(
29 base::Bind(&PassThroughImageTransportSurface::SetLatencyInfo, 29 base::Bind(&PassThroughImageTransportSurface::AddLatencyInfo,
30 base::Unretained(this))); 30 base::Unretained(this)));
31 return true; 31 return true;
32 } 32 }
33 33
34 void PassThroughImageTransportSurface::Destroy() { 34 void PassThroughImageTransportSurface::Destroy() {
35 GLSurfaceAdapter::Destroy(); 35 GLSurfaceAdapter::Destroy();
36 } 36 }
37 37
38 gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() { 38 gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() {
39 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info = 39 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info =
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return true; 122 return true;
123 } 123 }
124 124
125 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() { 125 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {
126 if (delegate_) { 126 if (delegate_) {
127 delegate_->SetLatencyInfoCallback( 127 delegate_->SetLatencyInfoCallback(
128 base::Callback<void(const std::vector<ui::LatencyInfo>&)>()); 128 base::Callback<void(const std::vector<ui::LatencyInfo>&)>());
129 } 129 }
130 } 130 }
131 131
132 void PassThroughImageTransportSurface::SetLatencyInfo( 132 void PassThroughImageTransportSurface::AddLatencyInfo(
133 const std::vector<ui::LatencyInfo>& latency_info) { 133 const std::vector<ui::LatencyInfo>& latency_info) {
134 latency_info_.insert(latency_info_.end(), latency_info.begin(), 134 latency_info_.insert(latency_info_.end(), latency_info.begin(),
135 latency_info.end()); 135 latency_info.end());
136 } 136 }
137 137
138 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 138 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
139 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 139 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
140 if (vsync_provider) { 140 if (vsync_provider) {
141 vsync_provider->GetVSyncParameters(base::Bind( 141 vsync_provider->GetVSyncParameters(base::Bind(
142 &ImageTransportSurfaceDelegate::UpdateVSyncParameters, delegate_)); 142 &ImageTransportSurfaceDelegate::UpdateVSyncParameters, delegate_));
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 void PassThroughImageTransportSurface::FinishSwapBuffersAsync( 183 void PassThroughImageTransportSurface::FinishSwapBuffersAsync(
184 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, 184 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info,
185 GLSurface::SwapCompletionCallback callback, 185 GLSurface::SwapCompletionCallback callback,
186 gfx::SwapResult result) { 186 gfx::SwapResult result) {
187 FinishSwapBuffers(std::move(latency_info), result); 187 FinishSwapBuffers(std::move(latency_info), result);
188 callback.Run(result); 188 callback.Run(result);
189 } 189 }
190 190
191 } // namespace gpu 191 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/pass_through_image_transport_surface.h ('k') | ppapi/proxy/ppapi_command_buffer_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698