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

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

Issue 11316238: gpu: don't try to discard/recreate backbuffer while draws are deferred. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reset currently_processing_message_ in RequeueMessage Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('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 #if defined(OS_WIN) 5 #if defined(OS_WIN)
6 #include <windows.h> 6 #include <windows.h>
7 #endif 7 #endif
8 8
9 #include "content/common/gpu/gpu_channel.h" 9 #include "content/common/gpu/gpu_channel.h"
10 10
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 : gpu_channel_manager_(gpu_channel_manager), 228 : gpu_channel_manager_(gpu_channel_manager),
229 unprocessed_messages_(new gpu::RefCountedCounter), 229 unprocessed_messages_(new gpu::RefCountedCounter),
230 client_id_(client_id), 230 client_id_(client_id),
231 share_group_(share_group ? share_group : new gfx::GLShareGroup), 231 share_group_(share_group ? share_group : new gfx::GLShareGroup),
232 mailbox_manager_(mailbox ? mailbox : new gpu::gles2::MailboxManager), 232 mailbox_manager_(mailbox ? mailbox : new gpu::gles2::MailboxManager),
233 image_manager_(new gpu::gles2::ImageManager), 233 image_manager_(new gpu::gles2::ImageManager),
234 watchdog_(watchdog), 234 watchdog_(watchdog),
235 software_(software), 235 software_(software),
236 handle_messages_scheduled_(false), 236 handle_messages_scheduled_(false),
237 processed_get_state_fast_(false), 237 processed_get_state_fast_(false),
238 currently_processing_message_(NULL),
238 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 239 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
239 DCHECK(gpu_channel_manager); 240 DCHECK(gpu_channel_manager);
240 DCHECK(client_id); 241 DCHECK(client_id);
241 242
242 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu"); 243 channel_id_ = IPC::Channel::GenerateVerifiedChannelID("gpu");
243 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 244 const CommandLine* command_line = CommandLine::ForCurrentProcess();
244 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); 245 log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages);
245 disallowed_features_.multisampling = 246 disallowed_features_.multisampling =
246 command_line->HasSwitch(switches::kDisableGLMultisampling); 247 command_line->HasSwitch(switches::kDisableGLMultisampling);
247 #if defined(OS_ANDROID) 248 #if defined(OS_ANDROID)
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 354 }
354 355
355 if (!channel_.get()) { 356 if (!channel_.get()) {
356 delete message; 357 delete message;
357 return false; 358 return false;
358 } 359 }
359 360
360 return channel_->Send(message); 361 return channel_->Send(message);
361 } 362 }
362 363
364 void GpuChannel::RequeueMessage() {
365 DCHECK(currently_processing_message_);
366 deferred_messages_.push_front(
367 new IPC::Message(*currently_processing_message_));
368 unprocessed_messages_->IncCount();
369 currently_processing_message_ = NULL;
370 }
371
363 void GpuChannel::OnScheduled() { 372 void GpuChannel::OnScheduled() {
364 if (handle_messages_scheduled_) 373 if (handle_messages_scheduled_)
365 return; 374 return;
366 // Post a task to handle any deferred messages. The deferred message queue is 375 // Post a task to handle any deferred messages. The deferred message queue is
367 // not emptied here, which ensures that OnMessageReceived will continue to 376 // not emptied here, which ensures that OnMessageReceived will continue to
368 // defer newly received messages until the ones in the queue have all been 377 // defer newly received messages until the ones in the queue have all been
369 // handled by HandleMessage. HandleMessage is invoked as a 378 // handled by HandleMessage. HandleMessage is invoked as a
370 // task to prevent reentrancy. 379 // task to prevent reentrancy.
371 MessageLoop::current()->PostTask( 380 MessageLoop::current()->PostTask(
372 FROM_HERE, 381 FROM_HERE,
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 542 }
534 return; 543 return;
535 } 544 }
536 545
537 scoped_ptr<IPC::Message> message(m); 546 scoped_ptr<IPC::Message> message(m);
538 deferred_messages_.pop_front(); 547 deferred_messages_.pop_front();
539 unprocessed_messages_->DecCount(); 548 unprocessed_messages_->DecCount();
540 549
541 processed_get_state_fast_ = 550 processed_get_state_fast_ =
542 (message->type() == GpuCommandBufferMsg_GetStateFast::ID); 551 (message->type() == GpuCommandBufferMsg_GetStateFast::ID);
552
553 currently_processing_message_ = message.get();
554 bool result = router_.RouteMessage(*message);
555 currently_processing_message_ = NULL;
556
543 // Handle deferred control messages. 557 // Handle deferred control messages.
544 if (!router_.RouteMessage(*message)) { 558 if (!result) {
545 // Respond to sync messages even if router failed to route. 559 // Respond to sync messages even if router failed to route.
546 if (message->is_sync()) { 560 if (message->is_sync()) {
547 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&*message); 561 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&*message);
548 reply->set_reply_error(); 562 reply->set_reply_error();
549 Send(reply); 563 Send(reply);
550 } 564 }
551 } else { 565 } else {
552 // If the command buffer becomes unscheduled as a result of handling the 566 // If the command buffer becomes unscheduled as a result of handling the
553 // message but still has more commands to process, synthesize an IPC 567 // message but still has more commands to process, synthesize an IPC
554 // message to flush that command buffer. 568 // message to flush that command buffer.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 } 686 }
673 } 687 }
674 688
675 GpuChannelMsg_CollectRenderingStatsForSurface::WriteReplyParams( 689 GpuChannelMsg_CollectRenderingStatsForSurface::WriteReplyParams(
676 reply_message, 690 reply_message,
677 stats); 691 stats);
678 Send(reply_message); 692 Send(reply_message);
679 } 693 }
680 694
681 } // namespace content 695 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel.h ('k') | content/common/gpu/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698