| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/gfx/gl/gl_context.h" | 5 #include "app/gfx/gl/gl_context.h" |
| 6 #include "gpu/command_buffer/service/gpu_processor.h" | 6 #include "gpu/command_buffer/service/gpu_processor.h" |
| 7 | 7 |
| 8 using ::base::SharedMemory; | 8 using ::base::SharedMemory; |
| 9 | 9 |
| 10 namespace gpu { | 10 namespace gpu { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 uint64 GPUProcessor::swap_buffers_count() const { | 102 uint64 GPUProcessor::swap_buffers_count() const { |
| 103 return swap_buffers_count_; | 103 return swap_buffers_count_; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GPUProcessor::set_acknowledged_swap_buffers_count( | 106 void GPUProcessor::set_acknowledged_swap_buffers_count( |
| 107 uint64 acknowledged_swap_buffers_count) { | 107 uint64 acknowledged_swap_buffers_count) { |
| 108 acknowledged_swap_buffers_count_ = acknowledged_swap_buffers_count; | 108 acknowledged_swap_buffers_count_ = acknowledged_swap_buffers_count; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void GPUProcessor::DidDestroySurface() { |
| 112 // When a browser window with a GPUProcessor is closed, the render process |
| 113 // will attempt to finish all GL commands, it will busy-wait on the GPU |
| 114 // process until the command queue is empty. If a paint is pending, the GPU |
| 115 // process won't process any GL commands until the browser sends a paint ack, |
| 116 // but since the browser window is already closed, it will never arrive. |
| 117 // To break this infinite loop, the browser tells the GPU process that the |
| 118 // surface became invalid, which causes the GPU process to not wait for paint |
| 119 // acks. |
| 120 surface_.reset(); |
| 121 } |
| 122 |
| 111 void GPUProcessor::WillSwapBuffers() { | 123 void GPUProcessor::WillSwapBuffers() { |
| 112 DCHECK(decoder_.get()); | 124 DCHECK(decoder_.get()); |
| 113 DCHECK(decoder_->GetGLContext()); | 125 DCHECK(decoder_->GetGLContext()); |
| 114 DCHECK(decoder_->GetGLContext()->IsCurrent()); | 126 DCHECK(decoder_->GetGLContext()->IsCurrent()); |
| 115 | 127 |
| 116 ++swap_buffers_count_; | 128 ++swap_buffers_count_; |
| 117 | 129 |
| 118 if (surface_.get()) { | 130 if (surface_.get()) { |
| 119 surface_->SwapBuffers(); | 131 surface_->SwapBuffers(); |
| 120 } | 132 } |
| 121 | 133 |
| 122 if (wrapped_swap_buffers_callback_.get()) { | 134 if (wrapped_swap_buffers_callback_.get()) { |
| 123 wrapped_swap_buffers_callback_->Run(); | 135 wrapped_swap_buffers_callback_->Run(); |
| 124 } | 136 } |
| 125 } | 137 } |
| 126 | 138 |
| 127 } // namespace gpu | 139 } // namespace gpu |
| OLD | NEW |