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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 2253233004: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/client/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <nacl_io/nacl_io.h> 7 #include <nacl_io/nacl_io.h>
8 #include <sys/mount.h> 8 #include <sys/mount.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 // Resister this instance to handle debug log messsages. 187 // Resister this instance to handle debug log messsages.
188 RegisterLoggingInstance(); 188 RegisterLoggingInstance();
189 189
190 // Initialize random seed for libjingle. It's necessary only with OpenSSL. 190 // Initialize random seed for libjingle. It's necessary only with OpenSSL.
191 char random_seed[kRandomSeedSize]; 191 char random_seed[kRandomSeedSize];
192 crypto::RandBytes(random_seed, sizeof(random_seed)); 192 crypto::RandBytes(random_seed, sizeof(random_seed));
193 rtc::InitRandom(random_seed, sizeof(random_seed)); 193 rtc::InitRandom(random_seed, sizeof(random_seed));
194 194
195 // Send hello message. 195 // Send hello message.
196 PostLegacyJsonMessage("hello", base::WrapUnique(new base::DictionaryValue())); 196 PostLegacyJsonMessage("hello", base::MakeUnique<base::DictionaryValue>());
197 } 197 }
198 198
199 ChromotingInstance::~ChromotingInstance() { 199 ChromotingInstance::~ChromotingInstance() {
200 DCHECK(plugin_task_runner_->BelongsToCurrentThread()); 200 DCHECK(plugin_task_runner_->BelongsToCurrentThread());
201 201
202 // Disconnect the client. 202 // Disconnect the client.
203 Disconnect(); 203 Disconnect();
204 204
205 // Unregister this instance so that debug log messages will no longer be sent 205 // Unregister this instance so that debug log messages will no longer be sent
206 // to it. This will stop all logging in all Chromoting instances. 206 // to it. This will stop all logging in all Chromoting instances.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // Assume that the decoder failure was caused by the host not encoding video 335 // Assume that the decoder failure was caused by the host not encoding video
336 // correctly and report it as a protocol error. 336 // correctly and report it as a protocol error.
337 // TODO(sergeyu): Consider using a different error code in case the decoder 337 // TODO(sergeyu): Consider using a different error code in case the decoder
338 // error was caused by some other problem. 338 // error was caused by some other problem.
339 OnConnectionState(protocol::ConnectionToHost::FAILED, 339 OnConnectionState(protocol::ConnectionToHost::FAILED,
340 protocol::INCOMPATIBLE_PROTOCOL); 340 protocol::INCOMPATIBLE_PROTOCOL);
341 } 341 }
342 342
343 void ChromotingInstance::OnVideoFirstFrameReceived() { 343 void ChromotingInstance::OnVideoFirstFrameReceived() {
344 PostLegacyJsonMessage("onFirstFrameReceived", 344 PostLegacyJsonMessage("onFirstFrameReceived",
345 base::WrapUnique(new base::DictionaryValue())); 345 base::MakeUnique<base::DictionaryValue>());
346 } 346 }
347 347
348 void ChromotingInstance::OnVideoFrameDirtyRegion( 348 void ChromotingInstance::OnVideoFrameDirtyRegion(
349 const webrtc::DesktopRegion& dirty_region) { 349 const webrtc::DesktopRegion& dirty_region) {
350 std::unique_ptr<base::ListValue> rects_value(new base::ListValue()); 350 std::unique_ptr<base::ListValue> rects_value(new base::ListValue());
351 for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd(); 351 for (webrtc::DesktopRegion::Iterator i(dirty_region); !i.IsAtEnd();
352 i.Advance()) { 352 i.Advance()) {
353 const webrtc::DesktopRect& rect = i.rect(); 353 const webrtc::DesktopRect& rect = i.rect();
354 std::unique_ptr<base::ListValue> rect_value(new base::ListValue()); 354 std::unique_ptr<base::ListValue> rect_value(new base::ListValue());
355 rect_value->AppendInteger(rect.left()); 355 rect_value->AppendInteger(rect.left());
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 671
672 // Setup the signal strategy. 672 // Setup the signal strategy.
673 signal_strategy_.reset(new DelegatingSignalStrategy( 673 signal_strategy_.reset(new DelegatingSignalStrategy(
674 local_jid, base::Bind(&ChromotingInstance::SendOutgoingIq, 674 local_jid, base::Bind(&ChromotingInstance::SendOutgoingIq,
675 weak_factory_.GetWeakPtr()))); 675 weak_factory_.GetWeakPtr())));
676 676
677 // Create TransportContext. 677 // Create TransportContext.
678 scoped_refptr<protocol::TransportContext> transport_context( 678 scoped_refptr<protocol::TransportContext> transport_context(
679 new protocol::TransportContext( 679 new protocol::TransportContext(
680 signal_strategy_.get(), 680 signal_strategy_.get(),
681 base::WrapUnique(new PepperPortAllocatorFactory(this)), 681 base::MakeUnique<PepperPortAllocatorFactory>(this),
682 base::WrapUnique(new PepperUrlRequestFactory(this)), 682 base::MakeUnique<PepperUrlRequestFactory>(this),
683 protocol::NetworkSettings( 683 protocol::NetworkSettings(
684 protocol::NetworkSettings::NAT_TRAVERSAL_FULL), 684 protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
685 protocol::TransportRole::CLIENT)); 685 protocol::TransportRole::CLIENT));
686 686
687 std::unique_ptr<protocol::CandidateSessionConfig> config = 687 std::unique_ptr<protocol::CandidateSessionConfig> config =
688 protocol::CandidateSessionConfig::CreateDefault(); 688 protocol::CandidateSessionConfig::CreateDefault();
689 if (std::find(experiments_list.begin(), experiments_list.end(), "vp9") != 689 if (std::find(experiments_list.begin(), experiments_list.end(), "vp9") !=
690 experiments_list.end()) { 690 experiments_list.end()) {
691 config->set_vp9_experiment_enabled(true); 691 config->set_vp9_experiment_enabled(true);
692 } 692 }
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 if (is_custom_counts_histogram) { 1126 if (is_custom_counts_histogram) {
1127 uma.HistogramCustomCounts(histogram_name, value, histogram_min, 1127 uma.HistogramCustomCounts(histogram_name, value, histogram_min,
1128 histogram_max, histogram_buckets); 1128 histogram_max, histogram_buckets);
1129 } else { 1129 } else {
1130 uma.HistogramCustomTimes(histogram_name, value, histogram_min, 1130 uma.HistogramCustomTimes(histogram_name, value, histogram_min,
1131 histogram_max, histogram_buckets); 1131 histogram_max, histogram_buckets);
1132 } 1132 }
1133 } 1133 }
1134 1134
1135 } // namespace remoting 1135 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/jni/jni_gl_display_handler.cc ('k') | remoting/client/plugin/pepper_port_allocator_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698