| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
| 7 #include "chrome/common/gpu_messages.h" | 7 #include "chrome/common/gpu_messages.h" |
| 8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
| 9 #include "chrome/renderer/command_buffer_proxy.h" | 9 #include "chrome/renderer/command_buffer_proxy.h" |
| 10 #include "chrome/renderer/plugin_channel_host.h" | 10 #include "chrome/renderer/plugin_channel_host.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 FROM_HERE, notify_repaint_task_.release()); | 177 FROM_HERE, notify_repaint_task_.release()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void CommandBufferProxy::SetParseError( | 180 void CommandBufferProxy::SetParseError( |
| 181 gpu::error::Error error) { | 181 gpu::error::Error error) { |
| 182 // Not implemented in proxy. | 182 // Not implemented in proxy. |
| 183 NOTREACHED(); | 183 NOTREACHED(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void CommandBufferProxy::ResizeOffscreenFrameBuffer(const gfx::Size& size) { | 186 void CommandBufferProxy::ResizeOffscreenFrameBuffer(const gfx::Size& size) { |
| 187 Send(new GpuCommandBufferMsg_ResizeOffscreenFrameBuffer(route_id_, size)); | 187 IPC::Message* message = |
| 188 new GpuCommandBufferMsg_ResizeOffscreenFrameBuffer(route_id_, size); |
| 189 // We need to set the unblock flag on this message to guarantee the |
| 190 // order in which it is processed in the GPU process. Ordinarily in |
| 191 // certain situations, namely if a synchronous message is being |
| 192 // processed, other synchronous messages may be processed before |
| 193 // asynchronous messages. During some page reloads WebGL seems to |
| 194 // send three messages (sync, async, sync) in rapid succession in |
| 195 // that order, and the sync message (GpuCommandBufferMsg_Flush, on |
| 196 // behalf of SwapBuffers) is sometimes processed before the async |
| 197 // message (GpuCommandBufferMsg_ResizeOffscreenFrameBuffer). This |
| 198 // causes the WebGL content to disappear because the back buffer is |
| 199 // not correctly resized. |
| 200 message->set_unblock(true); |
| 201 Send(message); |
| 188 } | 202 } |
| 189 | 203 |
| 190 #if defined(OS_MACOSX) | 204 #if defined(OS_MACOSX) |
| 191 void CommandBufferProxy::SetWindowSize(const gfx::Size& size) { | 205 void CommandBufferProxy::SetWindowSize(const gfx::Size& size) { |
| 192 Send(new GpuCommandBufferMsg_SetWindowSize(route_id_, size)); | 206 Send(new GpuCommandBufferMsg_SetWindowSize(route_id_, size)); |
| 193 } | 207 } |
| 194 #endif | 208 #endif |
| 195 | 209 |
| 196 void CommandBufferProxy::AsyncGetState(Task* completion_task) { | 210 void CommandBufferProxy::AsyncGetState(Task* completion_task) { |
| 197 IPC::Message* message = new GpuCommandBufferMsg_AsyncGetState(route_id_); | 211 IPC::Message* message = new GpuCommandBufferMsg_AsyncGetState(route_id_); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 225 pending_async_flush_tasks_.pop(); | 239 pending_async_flush_tasks_.pop(); |
| 226 | 240 |
| 227 if (task.get()) { | 241 if (task.get()) { |
| 228 // Although we need need to update last_state_ while potentially waiting | 242 // Although we need need to update last_state_ while potentially waiting |
| 229 // for a synchronous flush to complete, we do not need to invoke the | 243 // for a synchronous flush to complete, we do not need to invoke the |
| 230 // callback synchonously. Also, post it as a non nestable task so it is | 244 // callback synchonously. Also, post it as a non nestable task so it is |
| 231 // always invoked by the outermost message loop. | 245 // always invoked by the outermost message loop. |
| 232 MessageLoop::current()->PostNonNestableTask(FROM_HERE, task.release()); | 246 MessageLoop::current()->PostNonNestableTask(FROM_HERE, task.release()); |
| 233 } | 247 } |
| 234 } | 248 } |
| OLD | NEW |