diff options
author | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 03:36:18 +0000 |
---|---|---|
committer | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 03:36:18 +0000 |
commit | 60398ccd46e3f31d5d4541c0b6de0edde7f98504 (patch) | |
tree | 4a196ebfcc9e4d9588d97eefe95c900154c2b0f9 | |
parent | 0fb9fcfe900b38f806253024852c8d9648ed7293 (diff) | |
download | chromium_src-60398ccd46e3f31d5d4541c0b6de0edde7f98504.zip chromium_src-60398ccd46e3f31d5d4541c0b6de0edde7f98504.tar.gz chromium_src-60398ccd46e3f31d5d4541c0b6de0edde7f98504.tar.bz2 |
Used MessageLoopProxy instead of MessageLoop in RectangleUpdateDecoder.
BUG=NONE
TEST=Chromoting client
Review URL: http://codereview.chromium.org/9049011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116279 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/client/client_context.cc | 6 | ||||
-rw-r--r-- | remoting/client/client_context.h | 4 | ||||
-rw-r--r-- | remoting/client/rectangle_update_decoder.cc | 23 | ||||
-rw-r--r-- | remoting/client/rectangle_update_decoder.h | 10 |
4 files changed, 23 insertions, 20 deletions
diff --git a/remoting/client/client_context.cc b/remoting/client/client_context.cc index e1bca5e..b0bc941 100644 --- a/remoting/client/client_context.cc +++ b/remoting/client/client_context.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -28,8 +28,8 @@ base::MessageLoopProxy* ClientContext::main_message_loop() { return main_message_loop_proxy_; } -MessageLoop* ClientContext::decode_message_loop() { - return decode_thread_.message_loop(); +base::MessageLoopProxy* ClientContext::decode_message_loop() { + return decode_thread_.message_loop_proxy(); } base::MessageLoopProxy* ClientContext::network_message_loop() { diff --git a/remoting/client/client_context.h b/remoting/client/client_context.h index 41e5b16..b6955b8 100644 --- a/remoting/client/client_context.h +++ b/remoting/client/client_context.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -23,7 +23,7 @@ class ClientContext { void Stop(); base::MessageLoopProxy* main_message_loop(); - MessageLoop* decode_message_loop(); + base::MessageLoopProxy* decode_message_loop(); base::MessageLoopProxy* network_message_loop(); private: diff --git a/remoting/client/rectangle_update_decoder.cc b/remoting/client/rectangle_update_decoder.cc index 7c20438..697a913 100644 --- a/remoting/client/rectangle_update_decoder.cc +++ b/remoting/client/rectangle_update_decoder.cc @@ -5,8 +5,9 @@ #include "remoting/client/rectangle_update_decoder.h" #include "base/bind.h" +#include "base/location.h" #include "base/logging.h" -#include "base/message_loop.h" +#include "base/message_loop_proxy.h" #include "remoting/base/decoder.h" #include "remoting/base/decoder_row_based.h" #include "remoting/base/decoder_vp8.h" @@ -19,8 +20,8 @@ using remoting::protocol::SessionConfig; namespace remoting { -RectangleUpdateDecoder::RectangleUpdateDecoder(MessageLoop* message_loop, - FrameConsumer* consumer) +RectangleUpdateDecoder::RectangleUpdateDecoder( + base::MessageLoopProxy* message_loop, FrameConsumer* consumer) : message_loop_(message_loop), consumer_(consumer), screen_size_(SkISize::Make(0, 0)), @@ -47,7 +48,7 @@ void RectangleUpdateDecoder::Initialize(const SessionConfig& config) { void RectangleUpdateDecoder::DecodePacket(const VideoPacket* packet, const base::Closure& done) { - if (message_loop_ != MessageLoop::current()) { + if (!message_loop_->BelongsToCurrentThread()) { message_loop_->PostTask( FROM_HERE, base::Bind(&RectangleUpdateDecoder::DecodePacket, this, packet, done)); @@ -58,7 +59,7 @@ void RectangleUpdateDecoder::DecodePacket(const VideoPacket* packet, void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet, const base::Closure& done) { - if (message_loop_ != MessageLoop::current()) { + if (!message_loop_->BelongsToCurrentThread()) { message_loop_->PostTask( FROM_HERE, base::Bind(&RectangleUpdateDecoder::AllocateFrame, this, packet, done)); @@ -102,7 +103,7 @@ void RectangleUpdateDecoder::AllocateFrame(const VideoPacket* packet, void RectangleUpdateDecoder::ProcessPacketData( const VideoPacket* packet, const base::Closure& done) { - if (message_loop_ != MessageLoop::current()) { + if (!message_loop_->BelongsToCurrentThread()) { message_loop_->PostTask( FROM_HERE, base::Bind(&RectangleUpdateDecoder::ProcessPacketData, this, packet, done)); @@ -127,7 +128,7 @@ void RectangleUpdateDecoder::ProcessPacketData( } void RectangleUpdateDecoder::SetOutputSize(const SkISize& size) { - if (message_loop_ != MessageLoop::current()) { + if (!message_loop_->BelongsToCurrentThread()) { message_loop_->PostTask( FROM_HERE, base::Bind(&RectangleUpdateDecoder::SetOutputSize, this, size)); @@ -150,7 +151,7 @@ void RectangleUpdateDecoder::SetOutputSize(const SkISize& size) { } void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) { - if (message_loop_ != MessageLoop::current()) { + if (!message_loop_->BelongsToCurrentThread()) { message_loop_->PostTask( FROM_HERE, base::Bind(&RectangleUpdateDecoder::UpdateClipRect, this, new_clip_rect)); @@ -174,7 +175,7 @@ void RectangleUpdateDecoder::UpdateClipRect(const SkIRect& new_clip_rect) { } void RectangleUpdateDecoder::RefreshFullFrame() { - if (message_loop_ != MessageLoop::current()) { + if (!message_loop_->BelongsToCurrentThread()) { message_loop_->PostTask( FROM_HERE, base::Bind(&RectangleUpdateDecoder::RefreshFullFrame, this)); return; @@ -205,7 +206,7 @@ void RectangleUpdateDecoder::SubmitToConsumer() { } void RectangleUpdateDecoder::DoRefresh() { - DCHECK_EQ(message_loop_, MessageLoop::current()); + DCHECK(message_loop_->BelongsToCurrentThread()); if (refresh_rects_.empty()) return; @@ -216,7 +217,7 @@ void RectangleUpdateDecoder::DoRefresh() { } void RectangleUpdateDecoder::OnFrameConsumed(RectVector* rects) { - if (message_loop_ != MessageLoop::current()) { + if (!message_loop_->BelongsToCurrentThread()) { message_loop_->PostTask( FROM_HERE, base::Bind(&RectangleUpdateDecoder::OnFrameConsumed, this, rects)); diff --git a/remoting/client/rectangle_update_decoder.h b/remoting/client/rectangle_update_decoder.h index 1e319da..4ff4d93 100644 --- a/remoting/client/rectangle_update_decoder.h +++ b/remoting/client/rectangle_update_decoder.h @@ -6,11 +6,14 @@ #define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ #include "base/callback_forward.h" +#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "media/base/video_frame.h" #include "remoting/base/decoder.h" -class MessageLoop; +namespace base { +class MessageLoopProxy; +} // namespace base namespace remoting { @@ -27,7 +30,7 @@ class SessionConfig; class RectangleUpdateDecoder : public base::RefCountedThreadSafe<RectangleUpdateDecoder> { public: - RectangleUpdateDecoder(MessageLoop* message_loop, + RectangleUpdateDecoder(base::MessageLoopProxy* message_loop, FrameConsumer* consumer); // Initializes decoder with the infromation from the protocol config. @@ -70,8 +73,7 @@ class RectangleUpdateDecoder : // Callback for FrameConsumer::OnPartialFrameOutput() void OnFrameConsumed(RectVector* rects); - // Pointers to infrastructure objects. Not owned. - MessageLoop* message_loop_; + scoped_refptr<base::MessageLoopProxy> message_loop_; FrameConsumer* consumer_; SkISize screen_size_; |