| 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/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "content/common/gpu/gpu_messages.h" | 8 #include "content/common/gpu/gpu_messages.h" |
| 9 #include "content/common/gpu/image_transport_surface_calayer_mac.h" | 9 #include "content/common/gpu/image_transport_surface_calayer_mac.h" |
| 10 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" | 10 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::SwapBuffers"); | 173 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::SwapBuffers"); |
| 174 pending_swap_pixel_damage_rect_ = gfx::Rect(pixel_size_); | 174 pending_swap_pixel_damage_rect_ = gfx::Rect(pixel_size_); |
| 175 return SwapBuffersInternal() ? gfx::SwapResult::SWAP_ACK | 175 return SwapBuffersInternal() ? gfx::SwapResult::SWAP_ACK |
| 176 : gfx::SwapResult::SWAP_FAILED; | 176 : gfx::SwapResult::SWAP_FAILED; |
| 177 } | 177 } |
| 178 | 178 |
| 179 bool ImageTransportSurfaceFBO::SwapBuffersInternal() { | 179 bool ImageTransportSurfaceFBO::SwapBuffersInternal() { |
| 180 DCHECK(backbuffer_suggested_allocation_); | 180 DCHECK(backbuffer_suggested_allocation_); |
| 181 if (!frontbuffer_suggested_allocation_) | 181 if (!frontbuffer_suggested_allocation_) |
| 182 return true; | 182 return true; |
| 183 glFlush(); | 183 |
| 184 { |
| 185 TRACE_EVENT0("gpu", "ImageTransportSurfaceFBO::glFlush"); |
| 186 glFlush(); |
| 187 } |
| 184 | 188 |
| 185 // It is the responsibility of the storage provider to send the swap IPC. | 189 // It is the responsibility of the storage provider to send the swap IPC. |
| 186 is_swap_buffers_send_pending_ = true; | 190 is_swap_buffers_send_pending_ = true; |
| 187 storage_provider_->SwapBuffers(); | 191 storage_provider_->SwapBuffers(); |
| 188 | 192 |
| 189 // The call to swapBuffers could potentially result in an immediate draw. | 193 // The call to swapBuffers could potentially result in an immediate draw. |
| 190 // Ensure that any changes made to the context's state are restored. | 194 // Ensure that any changes made to the context's state are restored. |
| 191 context_->RestoreStateIfDirtiedExternally(); | 195 context_->RestoreStateIfDirtiedExternally(); |
| 192 return true; | 196 return true; |
| 193 } | 197 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 419 } |
| 416 | 420 |
| 417 has_complete_framebuffer_ = true; | 421 has_complete_framebuffer_ = true; |
| 418 storage_provider_->FrameSizeChanged(pixel_size_, scale_factor_); | 422 storage_provider_->FrameSizeChanged(pixel_size_, scale_factor_); |
| 419 | 423 |
| 420 glBindTexture(texture_target, previous_texture_id); | 424 glBindTexture(texture_target, previous_texture_id); |
| 421 // The FBO remains bound for this GL context. | 425 // The FBO remains bound for this GL context. |
| 422 } | 426 } |
| 423 | 427 |
| 424 } // namespace content | 428 } // namespace content |
| OLD | NEW |