Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 619453002: gpu: Remove Echo and SwapCompletion GL interfacess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tits
Patch Set: remove comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 DevToolsChannelData::CreateForChannel(channel())); 218 DevToolsChannelData::CreateForChannel(channel()));
219 // TODO(yurys): remove devtools_gpu_instrumentation call once DevTools 219 // TODO(yurys): remove devtools_gpu_instrumentation call once DevTools
220 // Timeline migrates to tracing crbug.com/361045. 220 // Timeline migrates to tracing crbug.com/361045.
221 devtools_gpu_instrumentation::ScopedGpuTask task(channel()); 221 devtools_gpu_instrumentation::ScopedGpuTask task(channel());
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 // RetireSyncPoint or WaitSyncPoint).
229 if (decoder_.get() && message.type() != GpuCommandBufferMsg_Echo::ID && 229 if (decoder_.get() &&
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 if (!MakeCurrent()) 233 if (!MakeCurrent())
234 return false; 234 return false;
235 have_context = true; 235 have_context = true;
236 } 236 }
237 237
238 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 238 // 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. 239 // here. This is so the reply can be delayed if the scheduler is unscheduled.
240 bool handled = true; 240 bool handled = true;
241 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) 241 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message)
242 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, 242 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize,
243 OnInitialize); 243 OnInitialize);
244 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, 244 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer,
245 OnSetGetBuffer); 245 OnSetGetBuffer);
246 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ProduceFrontBuffer, 246 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_ProduceFrontBuffer,
247 OnProduceFrontBuffer); 247 OnProduceFrontBuffer);
248 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho);
249 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForTokenInRange, 248 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForTokenInRange,
250 OnWaitForTokenInRange); 249 OnWaitForTokenInRange);
251 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForGetOffsetInRange, 250 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_WaitForGetOffsetInRange,
252 OnWaitForGetOffsetInRange); 251 OnWaitForGetOffsetInRange);
253 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 252 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
254 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); 253 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
255 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, 254 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer,
256 OnRegisterTransferBuffer); 255 OnRegisterTransferBuffer);
257 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, 256 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer,
258 OnDestroyTransferBuffer); 257 OnDestroyTransferBuffer);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 scheduler_->HasMoreIdleWork()) { 376 scheduler_->HasMoreIdleWork()) {
378 delay = 0; 377 delay = 0;
379 } 378 }
380 379
381 base::MessageLoop::current()->PostDelayedTask( 380 base::MessageLoop::current()->PostDelayedTask(
382 FROM_HERE, 381 FROM_HERE,
383 base::Bind(&GpuCommandBufferStub::PollWork, AsWeakPtr()), 382 base::Bind(&GpuCommandBufferStub::PollWork, AsWeakPtr()),
384 base::TimeDelta::FromMilliseconds(delay)); 383 base::TimeDelta::FromMilliseconds(delay));
385 } 384 }
386 385
387 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) {
388 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho");
389 Send(new IPC::Message(message));
390 }
391
392 bool GpuCommandBufferStub::MakeCurrent() { 386 bool GpuCommandBufferStub::MakeCurrent() {
393 if (decoder_->MakeCurrent()) 387 if (decoder_->MakeCurrent())
394 return true; 388 return true;
395 DLOG(ERROR) << "Context lost because MakeCurrent failed."; 389 DLOG(ERROR) << "Context lost because MakeCurrent failed.";
396 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 390 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
397 command_buffer_->SetParseError(gpu::error::kLostContext); 391 command_buffer_->SetParseError(gpu::error::kLostContext);
398 CheckContextLost(); 392 CheckContextLost();
399 return false; 393 return false;
400 } 394 }
401 395
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 if (decoder_) 1089 if (decoder_)
1096 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); 1090 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB);
1097 command_buffer_->SetParseError(gpu::error::kLostContext); 1091 command_buffer_->SetParseError(gpu::error::kLostContext);
1098 } 1092 }
1099 1093
1100 uint64 GpuCommandBufferStub::GetMemoryUsage() const { 1094 uint64 GpuCommandBufferStub::GetMemoryUsage() const {
1101 return GetMemoryManager()->GetClientMemoryUsage(this); 1095 return GetMemoryManager()->GetClientMemoryUsage(this);
1102 } 1096 }
1103 1097
1104 } // namespace content 1098 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698