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

Unified Diff: extensions/browser/api/cast_channel/cast_channel_api.cc

Issue 2937153002: [cast_channel] Create KeepAliveDelegate in CastSocket instead of in CastChannelOpenFunction (Closed)
Patch Set: rebase with master Created 3 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
Index: extensions/browser/api/cast_channel/cast_channel_api.cc
diff --git a/extensions/browser/api/cast_channel/cast_channel_api.cc b/extensions/browser/api/cast_channel/cast_channel_api.cc
index 89273a0ce7194ca7c47d7f67618c820fc8e233a6..bdbea3316955c9ad8b0f6ecfab1826e53c05c2f9 100644
--- a/extensions/browser/api/cast_channel/cast_channel_api.cc
+++ b/extensions/browser/api/cast_channel/cast_channel_api.cc
@@ -164,15 +164,6 @@ content::BrowserContext* CastChannelAPI::GetBrowserContext() const {
return browser_context_;
}
-void CastChannelAPI::SetPingTimeoutTimerForTest(
- std::unique_ptr<base::Timer> timer) {
- injected_timeout_timer_ = std::move(timer);
-}
-
-std::unique_ptr<base::Timer> CastChannelAPI::GetInjectedTimeoutTimerForTest() {
- return std::move(injected_timeout_timer_);
-}
-
CastChannelAPI::~CastChannelAPI() {}
CastChannelAsyncApiFunction::CastChannelAsyncApiFunction()
@@ -297,7 +288,7 @@ void CastChannelOpenFunction::AsyncWorkStart() {
base::TimeDelta::FromMilliseconds(connect_info.timeout.get()
? *connect_info.timeout
: kDefaultConnectTimeoutMillis),
- liveness_timeout_ > base::TimeDelta(), api_->GetLogger(),
+ liveness_timeout_, ping_interval_, api_->GetLogger(),
connect_info.capabilities.get() ? *connect_info.capabilities
: CastDeviceCapability::NONE);
}
@@ -309,20 +300,6 @@ void CastChannelOpenFunction::AsyncWorkStart() {
base::Bind(&CastChannelAPI::SendEvent, api_->AsWeakPtr(),
extension_->id()),
socket, api_->GetLogger()));
- if (socket->keep_alive()) {
- // Wrap read delegate in a KeepAliveDelegate for timeout handling.
- KeepAliveDelegate* keep_alive =
- new KeepAliveDelegate(socket, api_->GetLogger(), std::move(delegate),
- ping_interval_, liveness_timeout_);
- std::unique_ptr<base::Timer> injected_timer =
- api_->GetInjectedTimeoutTimerForTest();
- if (injected_timer) {
- keep_alive->SetTimersForTest(base::MakeUnique<base::Timer>(false, false),
- std::move(injected_timer));
- }
- delegate.reset(keep_alive);
- }
-
socket->Connect(std::move(delegate),
base::Bind(&CastChannelOpenFunction::OnOpen, this));
}
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_api.h ('k') | extensions/browser/api/cast_channel/cast_channel_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698