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

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

Issue 843453002: Replace NULL with nullptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 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_transport.h" 5 #include "extensions/browser/api/cast_channel/cast_transport.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 VLOG_WITH_CONNECTION(2) << "DoReadComplete result = " << result; 388 VLOG_WITH_CONNECTION(2) << "DoReadComplete result = " << result;
389 389
390 if (result <= 0) { 390 if (result <= 0) {
391 VLOG_WITH_CONNECTION(1) << "Read error, peer closed the socket."; 391 VLOG_WITH_CONNECTION(1) << "Read error, peer closed the socket.";
392 SetErrorState(CHANNEL_ERROR_SOCKET_ERROR); 392 SetErrorState(CHANNEL_ERROR_SOCKET_ERROR);
393 SetReadState(READ_STATE_ERROR); 393 SetReadState(READ_STATE_ERROR);
394 return result == 0 ? net::ERR_FAILED : result; 394 return result == 0 ? net::ERR_FAILED : result;
395 } 395 }
396 396
397 size_t message_size; 397 size_t message_size;
398 DCHECK(current_message_.get() == NULL); 398 DCHECK(current_message_.get() == nullptr);
imcheng 2015/01/15 19:26:45 DCHECK(!current_message_); ?
Kevin M 2015/01/27 00:56:45 Done.
399 ChannelError framing_error; 399 ChannelError framing_error;
400 current_message_ = framer_->Ingest(result, &message_size, &framing_error); 400 current_message_ = framer_->Ingest(result, &message_size, &framing_error);
401 if (current_message_.get() && (framing_error == CHANNEL_ERROR_NONE)) { 401 if (current_message_.get() && (framing_error == CHANNEL_ERROR_NONE)) {
402 DCHECK_GT(message_size, static_cast<size_t>(0)); 402 DCHECK_GT(message_size, static_cast<size_t>(0));
403 logger_->LogSocketEventForMessage( 403 logger_->LogSocketEventForMessage(
404 channel_id_, proto::MESSAGE_READ, current_message_->namespace_(), 404 channel_id_, proto::MESSAGE_READ, current_message_->namespace_(),
405 base::StringPrintf("Message size: %u", 405 base::StringPrintf("Message size: %u",
406 static_cast<uint32>(message_size))); 406 static_cast<uint32>(message_size)));
407 SetReadState(READ_STATE_DO_CALLBACK); 407 SetReadState(READ_STATE_DO_CALLBACK);
408 } else if (framing_error != CHANNEL_ERROR_NONE) { 408 } else if (framing_error != CHANNEL_ERROR_NONE) {
409 DCHECK(current_message_.get() == NULL); 409 DCHECK(current_message_.get() == nullptr);
imcheng 2015/01/15 19:26:45 ditto
Kevin M 2015/01/27 00:56:45 Done.
410 SetErrorState(CHANNEL_ERROR_INVALID_MESSAGE); 410 SetErrorState(CHANNEL_ERROR_INVALID_MESSAGE);
411 SetReadState(READ_STATE_ERROR); 411 SetReadState(READ_STATE_ERROR);
412 } else { 412 } else {
413 DCHECK(current_message_.get() == NULL); 413 DCHECK(current_message_.get() == nullptr);
imcheng 2015/01/15 19:26:45 ditto
Kevin M 2015/01/27 00:56:45 Done.
414 SetReadState(READ_STATE_READ); 414 SetReadState(READ_STATE_READ);
415 } 415 }
416 return net::OK; 416 return net::OK;
417 } 417 }
418 418
419 int CastTransportImpl::DoReadCallback() { 419 int CastTransportImpl::DoReadCallback() {
420 VLOG_WITH_CONNECTION(2) << "DoReadCallback"; 420 VLOG_WITH_CONNECTION(2) << "DoReadCallback";
421 if (!IsCastMessageValid(*current_message_)) { 421 if (!IsCastMessageValid(*current_message_)) {
422 SetReadState(READ_STATE_ERROR); 422 SetReadState(READ_STATE_ERROR);
423 SetErrorState(CHANNEL_ERROR_INVALID_MESSAGE); 423 SetErrorState(CHANNEL_ERROR_INVALID_MESSAGE);
(...skipping 12 matching lines...) Expand all
436 int CastTransportImpl::DoReadError(int result) { 436 int CastTransportImpl::DoReadError(int result) {
437 VLOG_WITH_CONNECTION(2) << "DoReadError"; 437 VLOG_WITH_CONNECTION(2) << "DoReadError";
438 DCHECK_NE(CHANNEL_ERROR_NONE, error_state_); 438 DCHECK_NE(CHANNEL_ERROR_NONE, error_state_);
439 DCHECK_LE(result, 0); 439 DCHECK_LE(result, 0);
440 return net::ERR_FAILED; 440 return net::ERR_FAILED;
441 } 441 }
442 442
443 } // namespace cast_channel 443 } // namespace cast_channel
444 } // namespace core_api 444 } // namespace core_api
445 } // namespace extensions 445 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698