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

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

Issue 14081010: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix some gtk issues Created 7 years, 8 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 | Annotate | Revision Log
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 if (message.type() == GpuCommandBufferMsg_RetireSyncPoint::ID) { 120 if (message.type() == GpuCommandBufferMsg_RetireSyncPoint::ID) {
121 // This message should not be sent explicitly by the renderer. 121 // This message should not be sent explicitly by the renderer.
122 NOTREACHED(); 122 NOTREACHED();
123 handled = true; 123 handled = true;
124 } 124 }
125 125
126 // All other messages get processed by the GpuChannel. 126 // All other messages get processed by the GpuChannel.
127 if (!handled) { 127 if (!handled) {
128 messages_forwarded_to_channel_++; 128 messages_forwarded_to_channel_++;
129 if (preempting_flag_.get()) 129 if (preempting_flag_)
130 pending_messages_.push(PendingMessage(messages_forwarded_to_channel_)); 130 pending_messages_.push(PendingMessage(messages_forwarded_to_channel_));
131 UpdatePreemptionState(); 131 UpdatePreemptionState();
132 } 132 }
133 133
134 if (message.type() == GpuCommandBufferMsg_InsertSyncPoint::ID) { 134 if (message.type() == GpuCommandBufferMsg_InsertSyncPoint::ID) {
135 uint32 sync_point = sync_point_manager_->GenerateSyncPoint(); 135 uint32 sync_point = sync_point_manager_->GenerateSyncPoint();
136 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message); 136 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&message);
137 GpuCommandBufferMsg_InsertSyncPoint::WriteReplyParams(reply, sync_point); 137 GpuCommandBufferMsg_InsertSyncPoint::WriteReplyParams(reply, sync_point);
138 Send(reply); 138 Send(reply);
139 message_loop_->PostTask(FROM_HERE, base::Bind( 139 message_loop_->PostTask(FROM_HERE, base::Bind(
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 return true; 491 return true;
492 } 492 }
493 493
494 std::string GpuChannel::GetChannelName() { 494 std::string GpuChannel::GetChannelName() {
495 return channel_id_; 495 return channel_id_;
496 } 496 }
497 497
498 #if defined(OS_POSIX) 498 #if defined(OS_POSIX)
499 int GpuChannel::TakeRendererFileDescriptor() { 499 int GpuChannel::TakeRendererFileDescriptor() {
500 if (!channel_.get()) { 500 if (!channel_) {
501 NOTREACHED(); 501 NOTREACHED();
502 return -1; 502 return -1;
503 } 503 }
504 return channel_->TakeClientFileDescriptor(); 504 return channel_->TakeClientFileDescriptor();
505 } 505 }
506 #endif // defined(OS_POSIX) 506 #endif // defined(OS_POSIX)
507 507
508 bool GpuChannel::OnMessageReceived(const IPC::Message& message) { 508 bool GpuChannel::OnMessageReceived(const IPC::Message& message) {
509 bool message_processed = true; 509 bool message_processed = true;
510 if (log_messages_) { 510 if (log_messages_) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 554
555 bool GpuChannel::Send(IPC::Message* message) { 555 bool GpuChannel::Send(IPC::Message* message) {
556 // The GPU process must never send a synchronous IPC message to the renderer 556 // The GPU process must never send a synchronous IPC message to the renderer
557 // process. This could result in deadlock. 557 // process. This could result in deadlock.
558 DCHECK(!message->is_sync()); 558 DCHECK(!message->is_sync());
559 if (log_messages_) { 559 if (log_messages_) {
560 DVLOG(1) << "sending message @" << message << " on channel @" << this 560 DVLOG(1) << "sending message @" << message << " on channel @" << this
561 << " with type " << message->type(); 561 << " with type " << message->type();
562 } 562 }
563 563
564 if (!channel_.get()) { 564 if (!channel_) {
565 delete message; 565 delete message;
566 return false; 566 return false;
567 } 567 }
568 568
569 return channel_->Send(message); 569 return channel_->Send(message);
570 } 570 }
571 571
572 void GpuChannel::RequeueMessage() { 572 void GpuChannel::RequeueMessage() {
573 DCHECK(currently_processing_message_); 573 DCHECK(currently_processing_message_);
574 deferred_messages_.push_front( 574 deferred_messages_.push_front(
(...skipping 21 matching lines...) Expand all
596 if (scheduled) { 596 if (scheduled) {
597 num_stubs_descheduled_--; 597 num_stubs_descheduled_--;
598 OnScheduled(); 598 OnScheduled();
599 } else { 599 } else {
600 num_stubs_descheduled_++; 600 num_stubs_descheduled_++;
601 } 601 }
602 DCHECK_LE(num_stubs_descheduled_, stubs_.size()); 602 DCHECK_LE(num_stubs_descheduled_, stubs_.size());
603 bool a_stub_is_descheduled = num_stubs_descheduled_ > 0; 603 bool a_stub_is_descheduled = num_stubs_descheduled_ > 0;
604 604
605 if (a_stub_is_descheduled != a_stub_was_descheduled) { 605 if (a_stub_is_descheduled != a_stub_was_descheduled) {
606 if (preempting_flag_.get()) { 606 if (preempting_flag_) {
607 io_message_loop_->PostTask( 607 io_message_loop_->PostTask(
608 FROM_HERE, 608 FROM_HERE,
609 base::Bind(&GpuChannelMessageFilter::UpdateStubSchedulingState, 609 base::Bind(&GpuChannelMessageFilter::UpdateStubSchedulingState,
610 filter_, a_stub_is_descheduled)); 610 filter_, a_stub_is_descheduled));
611 } 611 }
612 } 612 }
613 } 613 }
614 614
615 void GpuChannel::CreateViewCommandBuffer( 615 void GpuChannel::CreateViewCommandBuffer(
616 const gfx::GLSurfaceHandle& window, 616 const gfx::GLSurfaceHandle& window,
(...skipping 30 matching lines...) Expand all
647 disallowed_features_, 647 disallowed_features_,
648 init_params.allowed_extensions, 648 init_params.allowed_extensions,
649 init_params.attribs, 649 init_params.attribs,
650 init_params.gpu_preference, 650 init_params.gpu_preference,
651 use_virtualized_gl_context, 651 use_virtualized_gl_context,
652 *route_id, 652 *route_id,
653 surface_id, 653 surface_id,
654 watchdog_, 654 watchdog_,
655 software_, 655 software_,
656 init_params.active_url)); 656 init_params.active_url));
657 if (preempted_flag_.get()) 657 if (preempted_flag_)
658 stub->SetPreemptByFlag(preempted_flag_); 658 stub->SetPreemptByFlag(preempted_flag_);
659 router_.AddRoute(*route_id, stub.get()); 659 router_.AddRoute(*route_id, stub.get());
660 stubs_.AddWithID(stub.release(), *route_id); 660 stubs_.AddWithID(stub.release(), *route_id);
661 #endif // ENABLE_GPU 661 #endif // ENABLE_GPU
662 } 662 }
663 663
664 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) { 664 GpuCommandBufferStub* GpuChannel::LookupCommandBuffer(int32 route_id) {
665 return stubs_.Lookup(route_id); 665 return stubs_.Lookup(route_id);
666 } 666 }
667 667
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 714
715 void GpuChannel::AddRoute(int32 route_id, IPC::Listener* listener) { 715 void GpuChannel::AddRoute(int32 route_id, IPC::Listener* listener) {
716 router_.AddRoute(route_id, listener); 716 router_.AddRoute(route_id, listener);
717 } 717 }
718 718
719 void GpuChannel::RemoveRoute(int32 route_id) { 719 void GpuChannel::RemoveRoute(int32 route_id) {
720 router_.RemoveRoute(route_id); 720 router_.RemoveRoute(route_id);
721 } 721 }
722 722
723 gpu::PreemptionFlag* GpuChannel::GetPreemptionFlag() { 723 gpu::PreemptionFlag* GpuChannel::GetPreemptionFlag() {
724 if (!preempting_flag_.get()) { 724 if (!preempting_flag_) {
725 preempting_flag_ = new gpu::PreemptionFlag; 725 preempting_flag_ = new gpu::PreemptionFlag;
726 io_message_loop_->PostTask( 726 io_message_loop_->PostTask(
727 FROM_HERE, base::Bind( 727 FROM_HERE, base::Bind(
728 &GpuChannelMessageFilter::SetPreemptingFlagAndSchedulingState, 728 &GpuChannelMessageFilter::SetPreemptingFlagAndSchedulingState,
729 filter_, preempting_flag_, num_stubs_descheduled_ > 0)); 729 filter_, preempting_flag_, num_stubs_descheduled_ > 0));
730 } 730 }
731 return preempting_flag_.get(); 731 return preempting_flag_.get();
732 } 732 }
733 733
734 void GpuChannel::SetPreemptByFlag( 734 void GpuChannel::SetPreemptByFlag(
735 scoped_refptr<gpu::PreemptionFlag> preempted_flag) { 735 scoped_refptr<gpu::PreemptionFlag> preempted_flag) {
736 preempted_flag_ = preempted_flag; 736 preempted_flag_ = preempted_flag;
737 737
738 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); 738 for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_);
739 !it.IsAtEnd(); it.Advance()) { 739 !it.IsAtEnd(); it.Advance()) {
740 it.GetCurrentValue()->SetPreemptByFlag(preempted_flag_); 740 it.GetCurrentValue()->SetPreemptByFlag(preempted_flag_);
741 } 741 }
742 } 742 }
743 743
744 GpuChannel::~GpuChannel() { 744 GpuChannel::~GpuChannel() {
745 if (preempting_flag_.get()) 745 if (preempting_flag_)
746 preempting_flag_->Reset(); 746 preempting_flag_->Reset();
747 } 747 }
748 748
749 void GpuChannel::OnDestroy() { 749 void GpuChannel::OnDestroy() {
750 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy"); 750 TRACE_EVENT0("gpu", "GpuChannel::OnDestroy");
751 gpu_channel_manager_->RemoveChannel(client_id_); 751 gpu_channel_manager_->RemoveChannel(client_id_);
752 } 752 }
753 753
754 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) { 754 bool GpuChannel::OnControlMessageReceived(const IPC::Message& msg) {
755 bool handled = true; 755 bool handled = true;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 disallowed_features_, 865 disallowed_features_,
866 init_params.allowed_extensions, 866 init_params.allowed_extensions,
867 init_params.attribs, 867 init_params.attribs,
868 init_params.gpu_preference, 868 init_params.gpu_preference,
869 false, 869 false,
870 *route_id, 870 *route_id,
871 0, 871 0,
872 watchdog_, 872 watchdog_,
873 software_, 873 software_,
874 init_params.active_url)); 874 init_params.active_url));
875 if (preempted_flag_.get()) 875 if (preempted_flag_)
876 stub->SetPreemptByFlag(preempted_flag_); 876 stub->SetPreemptByFlag(preempted_flag_);
877 router_.AddRoute(*route_id, stub.get()); 877 router_.AddRoute(*route_id, stub.get());
878 stubs_.AddWithID(stub.release(), *route_id); 878 stubs_.AddWithID(stub.release(), *route_id);
879 TRACE_EVENT1("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer", 879 TRACE_EVENT1("gpu", "GpuChannel::OnCreateOffscreenCommandBuffer",
880 "route_id", route_id); 880 "route_id", route_id);
881 } 881 }
882 882
883 void GpuChannel::OnDestroyCommandBuffer(int32 route_id) { 883 void GpuChannel::OnDestroyCommandBuffer(int32 route_id) {
884 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer", 884 TRACE_EVENT1("gpu", "GpuChannel::OnDestroyCommandBuffer",
885 "route_id", route_id); 885 "route_id", route_id);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 if (it.GetCurrentValue()->surface_id() == surface_id) { 935 if (it.GetCurrentValue()->surface_id() == surface_id) {
936 stats->texture_upload_count += texture_upload_count; 936 stats->texture_upload_count += texture_upload_count;
937 stats->total_texture_upload_time += total_texture_upload_time; 937 stats->total_texture_upload_time += total_texture_upload_time;
938 stats->total_processing_commands_time += total_processing_commands_time; 938 stats->total_processing_commands_time += total_processing_commands_time;
939 } 939 }
940 } 940 }
941 } 941 }
942 942
943 void GpuChannel::MessageProcessed() { 943 void GpuChannel::MessageProcessed() {
944 messages_processed_++; 944 messages_processed_++;
945 if (preempting_flag_.get()) { 945 if (preempting_flag_) {
946 io_message_loop_->PostTask( 946 io_message_loop_->PostTask(
947 FROM_HERE, 947 FROM_HERE,
948 base::Bind(&GpuChannelMessageFilter::MessageProcessed, 948 base::Bind(&GpuChannelMessageFilter::MessageProcessed,
949 filter_, messages_processed_)); 949 filter_, messages_processed_));
950 } 950 }
951 } 951 }
952 952
953 void GpuChannel::CacheShader(const std::string& key, 953 void GpuChannel::CacheShader(const std::string& key,
954 const std::string& shader) { 954 const std::string& shader) {
955 gpu_channel_manager_->Send( 955 gpu_channel_manager_->Send(
956 new GpuHostMsg_CacheShader(client_id_, key, shader)); 956 new GpuHostMsg_CacheShader(client_id_, key, shader));
957 } 957 }
958 958
959 } // namespace content 959 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc ('k') | content/common/gpu/gpu_channel_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698