| 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/common/gpu/image_transport_surface_fbo_mac.h" | 5 #include "content/common/gpu/image_transport_surface_fbo_mac.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
| 10 #include "content/common/gpu/image_transport_surface_calayer_mac.h" | 10 #include "content/common/gpu/image_transport_surface_calayer_mac.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 return NULL; | 259 return NULL; |
| 260 } | 260 } |
| 261 | 261 |
| 262 void ImageTransportSurfaceFBO::OnBufferPresented( | 262 void ImageTransportSurfaceFBO::OnBufferPresented( |
| 263 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { | 263 const AcceleratedSurfaceMsg_BufferPresented_Params& params) { |
| 264 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::OnBufferPresented"); | 264 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::OnBufferPresented"); |
| 265 SetRendererID(params.renderer_id); | 265 SetRendererID(params.renderer_id); |
| 266 storage_provider_->SwapBuffersAckedByBrowser(params.disable_throttling); | 266 storage_provider_->SwapBuffersAckedByBrowser(params.disable_throttling); |
| 267 } | 267 } |
| 268 | 268 |
| 269 void ImageTransportSurfaceFBO::OnResize(gfx::Size pixel_size, | 269 bool ImageTransportSurfaceFBO::Resize(const gfx::Size& pixel_size, |
| 270 float scale_factor) { | 270 float scale_factor) { |
| 271 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::OnResize", | 271 TRACE_EVENT2("gpu", "ImageTransportSurfaceFBO::Resize", "old_size", |
| 272 "old_size", pixel_size_.ToString(), | 272 pixel_size_.ToString(), "new_size", pixel_size.ToString()); |
| 273 "new_size", pixel_size.ToString()); | |
| 274 // Caching |context_| from OnMakeCurrent. It should still be current. | 273 // Caching |context_| from OnMakeCurrent. It should still be current. |
| 275 DCHECK(context_->IsCurrent(this)); | 274 DCHECK(context_->IsCurrent(this)); |
| 276 | 275 |
| 277 AllocateOrResizeFramebuffer(pixel_size, scale_factor); | 276 AllocateOrResizeFramebuffer(pixel_size, scale_factor); |
| 277 return true; |
| 278 } | 278 } |
| 279 | 279 |
| 280 void ImageTransportSurfaceFBO::SetLatencyInfo( | 280 void ImageTransportSurfaceFBO::SetLatencyInfo( |
| 281 const std::vector<ui::LatencyInfo>& latency_info) { | 281 const std::vector<ui::LatencyInfo>& latency_info) { |
| 282 for (size_t i = 0; i < latency_info.size(); i++) | 282 for (size_t i = 0; i < latency_info.size(); i++) |
| 283 latency_info_.push_back(latency_info[i]); | 283 latency_info_.push_back(latency_info[i]); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void ImageTransportSurfaceFBO::OnWillDestroyStub() { | 286 void ImageTransportSurfaceFBO::OnWillDestroyStub() { |
| 287 helper_->stub()->RemoveDestructionObserver(this); | 287 helper_->stub()->RemoveDestructionObserver(this); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 432 } |
| 433 | 433 |
| 434 has_complete_framebuffer_ = true; | 434 has_complete_framebuffer_ = true; |
| 435 storage_provider_->FrameSizeChanged(pixel_size_, scale_factor_); | 435 storage_provider_->FrameSizeChanged(pixel_size_, scale_factor_); |
| 436 | 436 |
| 437 glBindTexture(texture_target, previous_texture_id); | 437 glBindTexture(texture_target, previous_texture_id); |
| 438 // The FBO remains bound for this GL context. | 438 // The FBO remains bound for this GL context. |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace content | 441 } // namespace content |
| OLD | NEW |