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

Unified Diff: remoting/test/protocol_perftest.cc

Issue 2080723008: [Chromoting] Use device::PowerSaveBlocker to block screen saver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve review comments Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« remoting/DEPS ('K') | « remoting/test/it2me_standalone_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/test/protocol_perftest.cc
diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc
index df566af0808fb27a534cf8cdd6aec95445345773..a5e81dd83755e8deb18ad0296fd2e766377d2c79 100644
--- a/remoting/test/protocol_perftest.cc
+++ b/remoting/test/protocol_perftest.cc
@@ -18,6 +18,8 @@
#include "jingle/glue/thread_wrapper.h"
#include "net/test/test_data_directory.h"
#include "net/url_request/url_request_context_getter.h"
+#include "remoting/base/auto_thread.h"
+#include "remoting/base/auto_thread_task_runner.h"
#include "remoting/base/rsa_key_pair.h"
#include "remoting/base/url_request.h"
#include "remoting/client/audio_player.h"
@@ -106,23 +108,18 @@ class ProtocolPerfTest
public HostStatusObserver {
public:
ProtocolPerfTest()
- : host_thread_("host"),
- capture_thread_("capture"),
- encode_thread_("encode"),
- decode_thread_("decode") {
+ : host_thread_(new AutoThreadTaskRunner(
+ message_loop_.task_runner(), run_loop_.QuitClosure())) {
Sergey Ulanov 2016/06/27 18:20:24 Previously the host was running on a separate thre
protocol::VideoFramePump::EnableTimestampsForTests();
- host_thread_.StartWithOptions(
- base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
- capture_thread_.Start();
- encode_thread_.Start();
- decode_thread_.Start();
+ context_ = ChromotingHostContext::Create(host_thread_);
}
virtual ~ProtocolPerfTest() {
- host_thread_.task_runner()->DeleteSoon(FROM_HERE, host_.release());
- host_thread_.task_runner()->DeleteSoon(FROM_HERE,
- host_signaling_.release());
- message_loop_.RunUntilIdle();
+ host_thread_->DeleteSoon(FROM_HERE, host_.release());
+ host_thread_->DeleteSoon(FROM_HERE, host_signaling_.release());
+ host_thread_->DeleteSoon(FROM_HERE, context_.release());
+ host_thread_ = nullptr;
+ run_loop_.QuitWhenIdle();
}
// ClientUserInterface interface.
@@ -171,7 +168,7 @@ class ProtocolPerfTest
std::unique_ptr<webrtc::DesktopFrame> frame(
new webrtc::BasicDesktopFrame(frame_size_));
base::PostTaskAndReplyWithResult(
- decode_thread_.task_runner().get(), FROM_HERE,
+ context_->video_encode_task_runner().get(), FROM_HERE,
Sergey Ulanov 2016/06/27 18:20:24 We want to use separate threads for encoding and d
base::Bind(&DoDecodeFrame, video_decoder_.get(), packet.get(),
base::Passed(&frame)),
base::Bind(&ProtocolPerfTest::OnFrameDecoded, base::Unretained(this),
@@ -300,13 +297,13 @@ class ProtocolPerfTest
NOTREACHED();
}
- host_thread_.task_runner()->PostTask(
+ host_thread_->PostTask(
FROM_HERE,
base::Bind(&ProtocolPerfTest::StartHost, base::Unretained(this)));
}
void StartHost() {
- DCHECK(host_thread_.task_runner()->BelongsToCurrentThread());
+ DCHECK(host_thread_->BelongsToCurrentThread());
jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop();
@@ -336,8 +333,8 @@ class ProtocolPerfTest
// else.
host_.reset(new ChromotingHost(
&desktop_environment_factory_, std::move(session_manager),
- transport_context, host_thread_.task_runner(),
- encode_thread_.task_runner()));
+ transport_context,
+ *context_));
base::FilePath certs_dir(net::GetTestCertsDirectory());
@@ -468,13 +465,13 @@ class ProtocolPerfTest
}
base::MessageLoopForIO message_loop_;
+ base::RunLoop run_loop_;
+
+ std::unique_ptr<ChromotingHostContext> context_;
scoped_refptr<FakeNetworkDispatcher> fake_network_dispatcher_;
- base::Thread host_thread_;
- base::Thread capture_thread_;
- base::Thread encode_thread_;
- base::Thread decode_thread_;
+ scoped_refptr<AutoThreadTaskRunner> host_thread_;
Sergey Ulanov 2016/06/27 18:20:24 this is a task_runner, so it shouldn't be called h
FakeDesktopEnvironmentFactory desktop_environment_factory_;
FakeCursorShapeStub cursor_shape_stub_;
« remoting/DEPS ('K') | « remoting/test/it2me_standalone_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698