| 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 "content/common/gpu/gpu_channel.h" | 5 #include "content/common/gpu/gpu_channel.h" | 
| 6 | 6 | 
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) | 
| 8 #include <windows.h> | 8 #include <windows.h> | 
| 9 #endif | 9 #endif | 
| 10 | 10 | 
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 586 } | 586 } | 
| 587 | 587 | 
| 588 bool GpuChannel::StreamState::HasRoute(int32 route_id) const { | 588 bool GpuChannel::StreamState::HasRoute(int32 route_id) const { | 
| 589   return routes_.find(route_id) != routes_.end(); | 589   return routes_.find(route_id) != routes_.end(); | 
| 590 } | 590 } | 
| 591 | 591 | 
| 592 bool GpuChannel::StreamState::HasRoutes() const { | 592 bool GpuChannel::StreamState::HasRoutes() const { | 
| 593   return !routes_.empty(); | 593   return !routes_.empty(); | 
| 594 } | 594 } | 
| 595 | 595 | 
|  | 596 GpuChannel::OrderCallback::OrderCallback(uint32_t order_num, | 
|  | 597                                          const base::Closure& callback) | 
|  | 598     : order_number(order_num), callback_closure(callback) {} | 
|  | 599 | 
|  | 600 GpuChannel::OrderCallback::~OrderCallback() {} | 
|  | 601 | 
| 596 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, | 602 GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, | 
| 597                        GpuWatchdog* watchdog, | 603                        GpuWatchdog* watchdog, | 
| 598                        gfx::GLShareGroup* share_group, | 604                        gfx::GLShareGroup* share_group, | 
| 599                        gpu::gles2::MailboxManager* mailbox, | 605                        gpu::gles2::MailboxManager* mailbox, | 
| 600                        base::SingleThreadTaskRunner* task_runner, | 606                        base::SingleThreadTaskRunner* task_runner, | 
| 601                        base::SingleThreadTaskRunner* io_task_runner, | 607                        base::SingleThreadTaskRunner* io_task_runner, | 
| 602                        int client_id, | 608                        int client_id, | 
| 603                        uint64_t client_tracing_id, | 609                        uint64_t client_tracing_id, | 
| 604                        bool software, | 610                        bool software, | 
| 605                        bool allow_future_sync_points, | 611                        bool allow_future_sync_points, | 
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 705 void GpuChannel::OnAddSubscription(unsigned int target) { | 711 void GpuChannel::OnAddSubscription(unsigned int target) { | 
| 706   gpu_channel_manager()->Send( | 712   gpu_channel_manager()->Send( | 
| 707       new GpuHostMsg_AddSubscription(client_id_, target)); | 713       new GpuHostMsg_AddSubscription(client_id_, target)); | 
| 708 } | 714 } | 
| 709 | 715 | 
| 710 void GpuChannel::OnRemoveSubscription(unsigned int target) { | 716 void GpuChannel::OnRemoveSubscription(unsigned int target) { | 
| 711   gpu_channel_manager()->Send( | 717   gpu_channel_manager()->Send( | 
| 712       new GpuHostMsg_RemoveSubscription(client_id_, target)); | 718       new GpuHostMsg_RemoveSubscription(client_id_, target)); | 
| 713 } | 719 } | 
| 714 | 720 | 
|  | 721 void GpuChannel::AddProcessedOrderNumberCallback( | 
|  | 722     uint32_t order_number, | 
|  | 723     const base::Closure& callback) { | 
|  | 724   processed_order_callbacks_.push(OrderCallback(order_number, callback)); | 
|  | 725 } | 
|  | 726 | 
| 715 void GpuChannel::StubSchedulingChanged(bool scheduled) { | 727 void GpuChannel::StubSchedulingChanged(bool scheduled) { | 
| 716   bool a_stub_was_descheduled = num_stubs_descheduled_ > 0; | 728   bool a_stub_was_descheduled = num_stubs_descheduled_ > 0; | 
| 717   if (scheduled) { | 729   if (scheduled) { | 
| 718     num_stubs_descheduled_--; | 730     num_stubs_descheduled_--; | 
| 719     message_queue_->ScheduleHandleMessage(); | 731     message_queue_->ScheduleHandleMessage(); | 
| 720   } else { | 732   } else { | 
| 721     num_stubs_descheduled_++; | 733     num_stubs_descheduled_++; | 
| 722   } | 734   } | 
| 723   DCHECK_LE(num_stubs_descheduled_, stubs_.size()); | 735   DCHECK_LE(num_stubs_descheduled_, stubs_.size()); | 
| 724   bool a_stub_is_descheduled = num_stubs_descheduled_ > 0; | 736   bool a_stub_is_descheduled = num_stubs_descheduled_ > 0; | 
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1076     jpeg_decoder_.reset(new GpuJpegDecodeAccelerator(this, io_task_runner_)); | 1088     jpeg_decoder_.reset(new GpuJpegDecodeAccelerator(this, io_task_runner_)); | 
| 1077   } | 1089   } | 
| 1078   jpeg_decoder_->AddClient(route_id, reply_msg); | 1090   jpeg_decoder_->AddClient(route_id, reply_msg); | 
| 1079 } | 1091 } | 
| 1080 | 1092 | 
| 1081 void GpuChannel::MessageProcessed(uint32_t order_number) { | 1093 void GpuChannel::MessageProcessed(uint32_t order_number) { | 
| 1082   if (order_number != kOutOfOrderNumber) { | 1094   if (order_number != kOutOfOrderNumber) { | 
| 1083     DCHECK(current_order_num_ == order_number); | 1095     DCHECK(current_order_num_ == order_number); | 
| 1084     DCHECK(processed_order_num_ < order_number); | 1096     DCHECK(processed_order_num_ < order_number); | 
| 1085     processed_order_num_ = order_number; | 1097     processed_order_num_ = order_number; | 
|  | 1098 | 
|  | 1099     while (!processed_order_callbacks_.empty() && | 
|  | 1100            processed_order_callbacks_.top().order_number <= order_number) { | 
|  | 1101       processed_order_callbacks_.top().callback_closure.Run(); | 
|  | 1102       processed_order_callbacks_.pop(); | 
|  | 1103     } | 
| 1086   } | 1104   } | 
| 1087   if (preempting_flag_.get()) { | 1105   if (preempting_flag_.get()) { | 
| 1088     io_task_runner_->PostTask( | 1106     io_task_runner_->PostTask( | 
| 1089         FROM_HERE, | 1107         FROM_HERE, | 
| 1090         base::Bind(&GpuChannelMessageFilter::OnMessageProcessed, filter_)); | 1108         base::Bind(&GpuChannelMessageFilter::OnMessageProcessed, filter_)); | 
| 1091   } | 1109   } | 
| 1092 } | 1110 } | 
| 1093 | 1111 | 
| 1094 void GpuChannel::CacheShader(const std::string& key, | 1112 void GpuChannel::CacheShader(const std::string& key, | 
| 1095                              const std::string& shader) { | 1113                              const std::string& shader) { | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1158 void GpuChannel::HandleUpdateValueState( | 1176 void GpuChannel::HandleUpdateValueState( | 
| 1159     unsigned int target, const gpu::ValueState& state) { | 1177     unsigned int target, const gpu::ValueState& state) { | 
| 1160   pending_valuebuffer_state_->UpdateState(target, state); | 1178   pending_valuebuffer_state_->UpdateState(target, state); | 
| 1161 } | 1179 } | 
| 1162 | 1180 | 
| 1163 uint32_t GpuChannel::GetUnprocessedOrderNum() const { | 1181 uint32_t GpuChannel::GetUnprocessedOrderNum() const { | 
| 1164   return message_queue_->GetUnprocessedOrderNum(); | 1182   return message_queue_->GetUnprocessedOrderNum(); | 
| 1165 } | 1183 } | 
| 1166 | 1184 | 
| 1167 }  // namespace content | 1185 }  // namespace content | 
| OLD | NEW | 
|---|