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

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_api.cc

Issue 2252373002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | extensions/browser/api/extensions_api_client.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 "extensions/browser/api/cast_channel/cast_channel_api.h" 5 #include "extensions/browser/api/cast_channel/cast_channel_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 : kDefaultConnectTimeoutMillis), 317 : kDefaultConnectTimeoutMillis),
318 liveness_timeout_ > base::TimeDelta(), api_->GetLogger(), 318 liveness_timeout_ > base::TimeDelta(), api_->GetLogger(),
319 connect_info.capabilities.get() ? *connect_info.capabilities 319 connect_info.capabilities.get() ? *connect_info.capabilities
320 : CastDeviceCapability::NONE); 320 : CastDeviceCapability::NONE);
321 } 321 }
322 new_channel_id_ = AddSocket(socket); 322 new_channel_id_ = AddSocket(socket);
323 api_->GetLogger()->LogNewSocketEvent(*socket); 323 api_->GetLogger()->LogNewSocketEvent(*socket);
324 324
325 // Construct read delegates. 325 // Construct read delegates.
326 std::unique_ptr<api::cast_channel::CastTransport::Delegate> delegate( 326 std::unique_ptr<api::cast_channel::CastTransport::Delegate> delegate(
327 base::WrapUnique(new CastMessageHandler( 327 base::MakeUnique<CastMessageHandler>(
328 base::Bind(&CastChannelAPI::SendEvent, api_->AsWeakPtr()), socket, 328 base::Bind(&CastChannelAPI::SendEvent, api_->AsWeakPtr()), socket,
329 api_->GetLogger()))); 329 api_->GetLogger()));
330 if (socket->keep_alive()) { 330 if (socket->keep_alive()) {
331 // Wrap read delegate in a KeepAliveDelegate for timeout handling. 331 // Wrap read delegate in a KeepAliveDelegate for timeout handling.
332 api::cast_channel::KeepAliveDelegate* keep_alive = 332 api::cast_channel::KeepAliveDelegate* keep_alive =
333 new api::cast_channel::KeepAliveDelegate( 333 new api::cast_channel::KeepAliveDelegate(
334 socket, api_->GetLogger(), std::move(delegate), ping_interval_, 334 socket, api_->GetLogger(), std::move(delegate), ping_interval_,
335 liveness_timeout_); 335 liveness_timeout_);
336 std::unique_ptr<base::Timer> injected_timer = 336 std::unique_ptr<base::Timer> injected_timer =
337 api_->GetInjectedTimeoutTimerForTest(); 337 api_->GetInjectedTimeoutTimerForTest();
338 if (injected_timer) { 338 if (injected_timer) {
339 keep_alive->SetTimersForTest( 339 keep_alive->SetTimersForTest(base::MakeUnique<base::Timer>(false, false),
340 base::WrapUnique(new base::Timer(false, false)), 340 std::move(injected_timer));
341 std::move(injected_timer));
342 } 341 }
343 delegate.reset(keep_alive); 342 delegate.reset(keep_alive);
344 } 343 }
345 344
346 api_->GetLogger()->LogNewSocketEvent(*socket); 345 api_->GetLogger()->LogNewSocketEvent(*socket);
347 socket->Connect(std::move(delegate), 346 socket->Connect(std::move(delegate),
348 base::Bind(&CastChannelOpenFunction::OnOpen, this)); 347 base::Bind(&CastChannelOpenFunction::OnOpen, this));
349 } 348 }
350 349
351 void CastChannelOpenFunction::OnOpen(cast_channel::ChannelError result) { 350 void CastChannelOpenFunction::OnOpen(cast_channel::ChannelError result) {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 return true; 557 return true;
559 } 558 }
560 559
561 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() { 560 void CastChannelSetAuthorityKeysFunction::AsyncWorkStart() {
562 // TODO(eroman): crbug.com/601171: Delete this once the API is 561 // TODO(eroman): crbug.com/601171: Delete this once the API is
563 // removed. It is currently a no-op. 562 // removed. It is currently a no-op.
564 AsyncWorkCompleted(); 563 AsyncWorkCompleted();
565 } 564 }
566 565
567 } // namespace extensions 566 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/api/extensions_api_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698