diff options
author | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 23:26:12 +0000 |
---|---|---|
committer | jbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-03 23:26:12 +0000 |
commit | 9d860f9e509797e7e07af026440db28b72392f6d (patch) | |
tree | 21d4da3f1d59be0d46d2274a7c3133cb5b08146a /content | |
parent | b4cb09136ad55f2e72093d723d287fe63094dd88 (diff) | |
download | chromium_src-9d860f9e509797e7e07af026440db28b72392f6d.zip chromium_src-9d860f9e509797e7e07af026440db28b72392f6d.tar.gz chromium_src-9d860f9e509797e7e07af026440db28b72392f6d.tar.bz2 |
Avoid processing two GetStateFast messages back to back.
Require that one non-getstatefast message be processed in between, to prevent starvation.
BUG=102214
TEST=
Review URL: http://codereview.chromium.org/8440061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108576 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/common/gpu/gpu_channel.cc | 28 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel.h | 1 |
2 files changed, 25 insertions, 4 deletions
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index 5bc3877..9bb1ee5 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -1,4 +1,4 @@ - +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -37,6 +37,7 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager, watchdog_(watchdog), software_(software), handle_messages_scheduled_(false), + processed_get_state_fast_(false), num_contexts_preferring_discrete_gpu_(0), task_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { DCHECK(gpu_channel_manager); @@ -79,9 +80,26 @@ bool GpuChannel::OnMessageReceived(const IPC::Message& message) { return OnControlMessageReceived(message); if (message.type() == GpuCommandBufferMsg_GetStateFast::ID) { - // Move GetStateFast commands to the head of the queue, so the renderer - // doesn't have to wait any longer than necessary. - deferred_messages_.push_front(new IPC::Message(message)); + if (processed_get_state_fast_) { + // Require a non-GetStateFast message in between two GetStateFast + // messages, to ensure progress is made. + std::deque<IPC::Message*>::iterator point = deferred_messages_.begin(); + + while (point != deferred_messages_.end() && + (*point)->type() == GpuCommandBufferMsg_GetStateFast::ID) { + ++point; + } + + if (point != deferred_messages_.end()) { + ++point; + } + + deferred_messages_.insert(point, new IPC::Message(message)); + } else { + // Move GetStateFast commands to the head of the queue, so the renderer + // doesn't have to wait any longer than necessary. + deferred_messages_.push_front(new IPC::Message(message)); + } } else { deferred_messages_.push_back(new IPC::Message(message)); } @@ -234,6 +252,8 @@ void GpuChannel::HandleMessage() { if (!deferred_messages_.empty()) { scoped_ptr<IPC::Message> message(deferred_messages_.front()); deferred_messages_.pop_front(); + processed_get_state_fast_ = + (message->type() == GpuCommandBufferMsg_GetStateFast::ID); // Handle deferred control messages. if (message->routing_id() == MSG_ROUTING_CONTROL) OnControlMessageReceived(*message); diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h index e55d4d6..2594f48 100644 --- a/content/common/gpu/gpu_channel.h +++ b/content/common/gpu/gpu_channel.h @@ -188,6 +188,7 @@ class GpuChannel : public IPC::Channel::Listener, GpuWatchdog* watchdog_; bool software_; bool handle_messages_scheduled_; + bool processed_get_state_fast_; int32 num_contexts_preferring_discrete_gpu_; ScopedRunnableMethodFactory<GpuChannel> task_factory_; |