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

Side by Side Diff: media/cast/test/utility/udp_proxy.cc

Issue 1116683002: [media] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased patch Created 5 years, 7 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
« no previous file with comments | « media/cast/test/utility/tap_proxy.cc ('k') | media/cast/test/utility/udp_proxy_main.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <math.h> 5 #include <math.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <vector> 7 #include <vector>
8 8
9 #include "media/cast/test/utility/udp_proxy.h" 9 #include "media/cast/test/utility/udp_proxy.h"
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/single_thread_task_runner.h"
13 #include "base/synchronization/waitable_event.h" 14 #include "base/synchronization/waitable_event.h"
15 #include "base/thread_task_runner_handle.h"
14 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
15 #include "base/time/default_tick_clock.h" 17 #include "base/time/default_tick_clock.h"
16 #include "net/base/io_buffer.h" 18 #include "net/base/io_buffer.h"
17 #include "net/base/net_errors.h" 19 #include "net/base/net_errors.h"
18 #include "net/udp/udp_server_socket.h" 20 #include "net/udp/udp_server_socket.h"
19 21
20 namespace media { 22 namespace media {
21 namespace cast { 23 namespace cast {
22 namespace test { 24 namespace test {
23 25
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 LOG(ERROR) << "Failed to write packet."; 736 LOG(ERROR) << "Failed to write packet.";
735 } 737 }
736 } 738 }
737 739
738 private: 740 private:
739 void Start(base::WaitableEvent* start_event, 741 void Start(base::WaitableEvent* start_event,
740 net::NetLog* net_log) { 742 net::NetLog* net_log) {
741 socket_.reset(new net::UDPServerSocket(net_log, net::NetLog::Source())); 743 socket_.reset(new net::UDPServerSocket(net_log, net::NetLog::Source()));
742 BuildPipe(&to_dest_pipe_, new PacketSender(this, &destination_)); 744 BuildPipe(&to_dest_pipe_, new PacketSender(this, &destination_));
743 BuildPipe(&from_dest_pipe_, new PacketSender(this, &return_address_)); 745 BuildPipe(&from_dest_pipe_, new PacketSender(this, &return_address_));
744 to_dest_pipe_->InitOnIOThread(base::MessageLoopProxy::current(), 746 to_dest_pipe_->InitOnIOThread(base::ThreadTaskRunnerHandle::Get(),
745 &tick_clock_); 747 &tick_clock_);
746 from_dest_pipe_->InitOnIOThread(base::MessageLoopProxy::current(), 748 from_dest_pipe_->InitOnIOThread(base::ThreadTaskRunnerHandle::Get(),
747 &tick_clock_); 749 &tick_clock_);
748 750
749 VLOG(0) << "From:" << local_port_.ToString(); 751 VLOG(0) << "From:" << local_port_.ToString();
750 if (!destination_is_mutable_) 752 if (!destination_is_mutable_)
751 VLOG(0) << "To:" << destination_.ToString(); 753 VLOG(0) << "To:" << destination_.ToString();
752 754
753 CHECK_GE(socket_->Listen(local_port_), 0); 755 CHECK_GE(socket_->Listen(local_port_), 0);
754 756
755 start_event->Signal(); 757 start_event->Signal();
756 PollRead(); 758 PollRead();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 destination, 857 destination,
856 to_dest_pipe.Pass(), 858 to_dest_pipe.Pass(),
857 from_dest_pipe.Pass(), 859 from_dest_pipe.Pass(),
858 net_log)); 860 net_log));
859 return ret.Pass(); 861 return ret.Pass();
860 } 862 }
861 863
862 } // namespace test 864 } // namespace test
863 } // namespace cast 865 } // namespace cast
864 } // namespace media 866 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/utility/tap_proxy.cc ('k') | media/cast/test/utility/udp_proxy_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698