| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 FastSetActiveURL(active_url_, active_url_hash_); | 222 FastSetActiveURL(active_url_, active_url_hash_); |
| 223 | 223 |
| 224 bool have_context = false; | 224 bool have_context = false; |
| 225 // Ensure the appropriate GL context is current before handling any IPC | 225 // Ensure the appropriate GL context is current before handling any IPC |
| 226 // messages directed at the command buffer. This ensures that the message | 226 // messages directed at the command buffer. This ensures that the message |
| 227 // handler can assume that the context is current (not necessary for | 227 // handler can assume that the context is current (not necessary for |
| 228 // Echo, RetireSyncPoint, or WaitSyncPoint). | 228 // Echo, RetireSyncPoint, or WaitSyncPoint). |
| 229 if (decoder_.get() && message.type() != GpuCommandBufferMsg_Echo::ID && | 229 if (decoder_.get() && message.type() != GpuCommandBufferMsg_Echo::ID && |
| 230 message.type() != GpuCommandBufferMsg_WaitForTokenInRange::ID && | 230 message.type() != GpuCommandBufferMsg_WaitForTokenInRange::ID && |
| 231 message.type() != GpuCommandBufferMsg_WaitForGetOffsetInRange::ID && | 231 message.type() != GpuCommandBufferMsg_WaitForGetOffsetInRange::ID && |
| 232 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID) { | 232 message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID && |
| 233 message.type() != GpuCommandBufferMsg_SignalSyncPoint::ID) { |
| 233 if (!MakeCurrent()) | 234 if (!MakeCurrent()) |
| 234 return false; | 235 return false; |
| 235 have_context = true; | 236 have_context = true; |
| 236 } | 237 } |
| 237 | 238 |
| 238 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers | 239 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers |
| 239 // here. This is so the reply can be delayed if the scheduler is unscheduled. | 240 // here. This is so the reply can be delayed if the scheduler is unscheduled. |
| 240 bool handled = true; | 241 bool handled = true; |
| 241 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) | 242 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) |
| 242 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, | 243 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 if (decoder_) | 1096 if (decoder_) |
| 1096 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 1097 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 1097 command_buffer_->SetParseError(gpu::error::kLostContext); | 1098 command_buffer_->SetParseError(gpu::error::kLostContext); |
| 1098 } | 1099 } |
| 1099 | 1100 |
| 1100 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1101 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
| 1101 return GetMemoryManager()->GetClientMemoryUsage(this); | 1102 return GetMemoryManager()->GetClientMemoryUsage(this); |
| 1102 } | 1103 } |
| 1103 | 1104 |
| 1104 } // namespace content | 1105 } // namespace content |
| OLD | NEW |