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

Side by Side Diff: content/common/gpu/image_transport_surface.cc

Issue 1420503011: GLES2CmdDecoder should resize GLSurface using GLSurface::Resize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/gpu/image_transport_surface.h" 5 #include "content/common/gpu/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 "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } 59 }
60 manager_->RemoveRoute(route_id_); 60 manager_->RemoveRoute(route_id_);
61 } 61 }
62 62
63 bool ImageTransportHelper::Initialize() { 63 bool ImageTransportHelper::Initialize() {
64 gpu::gles2::GLES2Decoder* decoder = Decoder(); 64 gpu::gles2::GLES2Decoder* decoder = Decoder();
65 65
66 if (!decoder) 66 if (!decoder)
67 return false; 67 return false;
68 68
69 decoder->SetResizeCallback(
70 base::Bind(&ImageTransportHelper::Resize, base::Unretained(this)));
71
72 stub_->SetLatencyInfoCallback( 69 stub_->SetLatencyInfoCallback(
73 base::Bind(&ImageTransportHelper::SetLatencyInfo, 70 base::Bind(&ImageTransportHelper::SetLatencyInfo,
74 base::Unretained(this))); 71 base::Unretained(this)));
75 72
76 return true; 73 return true;
77 } 74 }
78 75
79 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) { 76 bool ImageTransportHelper::OnMessageReceived(const IPC::Message& message) {
80 #if defined(OS_MACOSX) 77 #if defined(OS_MACOSX)
81 bool handled = true; 78 bool handled = true;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return stub_->decoder(); 125 return stub_->decoder();
129 } 126 }
130 127
131 #if defined(OS_MACOSX) 128 #if defined(OS_MACOSX)
132 void ImageTransportHelper::OnBufferPresented( 129 void ImageTransportHelper::OnBufferPresented(
133 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { 130 const AcceleratedSurfaceMsg_BufferPresented_Params& params) {
134 surface_->OnBufferPresented(params); 131 surface_->OnBufferPresented(params);
135 } 132 }
136 #endif 133 #endif
137 134
138 void ImageTransportHelper::Resize(gfx::Size size, float scale_factor) {
139 surface_->OnResize(size, scale_factor);
140
141 #if defined(OS_ANDROID)
142 manager_->gpu_memory_manager()->ScheduleManage(
143 GpuMemoryManager::kScheduleManageNow);
144 #endif
145 }
146
147 void ImageTransportHelper::SetLatencyInfo( 135 void ImageTransportHelper::SetLatencyInfo(
148 const std::vector<ui::LatencyInfo>& latency_info) { 136 const std::vector<ui::LatencyInfo>& latency_info) {
149 surface_->SetLatencyInfo(latency_info); 137 surface_->SetLatencyInfo(latency_info);
150 } 138 }
151 139
152 PassThroughImageTransportSurface::PassThroughImageTransportSurface( 140 PassThroughImageTransportSurface::PassThroughImageTransportSurface(
153 GpuChannelManager* manager, 141 GpuChannelManager* manager,
154 GpuCommandBufferStub* stub, 142 GpuCommandBufferStub* stub,
155 gfx::GLSurface* surface) 143 gfx::GLSurface* surface)
156 : GLSurfaceAdapter(surface), 144 : GLSurfaceAdapter(surface),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 return true; 239 return true;
252 } 240 }
253 241
254 #if defined(OS_MACOSX) 242 #if defined(OS_MACOSX)
255 void PassThroughImageTransportSurface::OnBufferPresented( 243 void PassThroughImageTransportSurface::OnBufferPresented(
256 const AcceleratedSurfaceMsg_BufferPresented_Params& /* params */) { 244 const AcceleratedSurfaceMsg_BufferPresented_Params& /* params */) {
257 NOTREACHED(); 245 NOTREACHED();
258 } 246 }
259 #endif 247 #endif
260 248
261 void PassThroughImageTransportSurface::OnResize(gfx::Size size,
262 float scale_factor) {
263 Resize(size);
264 }
265
266 gfx::Size PassThroughImageTransportSurface::GetSize() { 249 gfx::Size PassThroughImageTransportSurface::GetSize() {
267 return GLSurfaceAdapter::GetSize(); 250 return GLSurfaceAdapter::GetSize();
268 } 251 }
269 252
270 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {} 253 PassThroughImageTransportSurface::~PassThroughImageTransportSurface() {}
271 254
272 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() { 255 void PassThroughImageTransportSurface::SendVSyncUpdateIfAvailable() {
273 gfx::VSyncProvider* vsync_provider = GetVSyncProvider(); 256 gfx::VSyncProvider* vsync_provider = GetVSyncProvider();
274 if (vsync_provider) { 257 if (vsync_provider) {
275 vsync_provider->GetVSyncParameters( 258 vsync_provider->GetVSyncParameters(
276 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters, 259 base::Bind(&GpuCommandBufferStub::SendUpdateVSyncParameters,
277 helper_->stub()->AsWeakPtr())); 260 helper_->stub()->AsWeakPtr()));
278 } 261 }
279 } 262 }
280 263
281 } // namespace content 264 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface.h ('k') | content/common/gpu/image_transport_surface_overlay_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698