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

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

Issue 598333003: Fix uninitialized memory error in CastTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback Created 6 years, 2 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 | tools/valgrind/drmemory/suppressions_full.txt » ('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_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 14 matching lines...) Expand all
25 namespace core_api { 25 namespace core_api {
26 namespace cast_channel { 26 namespace cast_channel {
27 27
28 CastTransport::CastTransport(CastSocketInterface* socket, 28 CastTransport::CastTransport(CastSocketInterface* socket,
29 Delegate* read_delegate, 29 Delegate* read_delegate,
30 scoped_refptr<Logger> logger) 30 scoped_refptr<Logger> logger)
31 : socket_(socket), 31 : socket_(socket),
32 read_delegate_(read_delegate), 32 read_delegate_(read_delegate),
33 write_state_(WRITE_STATE_NONE), 33 write_state_(WRITE_STATE_NONE),
34 read_state_(READ_STATE_NONE), 34 read_state_(READ_STATE_NONE),
35 error_state_(CHANNEL_ERROR_NONE),
35 logger_(logger) { 36 logger_(logger) {
36 DCHECK(socket); 37 DCHECK(socket);
37 DCHECK(read_delegate); 38 DCHECK(read_delegate);
38 39
39 // Buffer is reused across messages to minimize unnecessary buffer 40 // Buffer is reused across messages to minimize unnecessary buffer
40 // [re]allocations. 41 // [re]allocations.
41 read_buffer_ = new net::GrowableIOBuffer(); 42 read_buffer_ = new net::GrowableIOBuffer();
42 read_buffer_->SetCapacity(MessageFramer::MessageHeader::max_message_size()); 43 read_buffer_->SetCapacity(MessageFramer::MessageHeader::max_message_size());
43 framer_.reset(new MessageFramer(read_buffer_)); 44 framer_.reset(new MessageFramer(read_buffer_));
44 } 45 }
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 int CastTransport::DoReadError(int result) { 438 int CastTransport::DoReadError(int result) {
438 VLOG_WITH_CONNECTION(2) << "DoReadError"; 439 VLOG_WITH_CONNECTION(2) << "DoReadError";
439 DCHECK_NE(CHANNEL_ERROR_NONE, error_state_); 440 DCHECK_NE(CHANNEL_ERROR_NONE, error_state_);
440 DCHECK_LE(result, 0); 441 DCHECK_LE(result, 0);
441 return net::ERR_FAILED; 442 return net::ERR_FAILED;
442 } 443 }
443 444
444 } // namespace cast_channel 445 } // namespace cast_channel
445 } // namespace core_api 446 } // namespace core_api
446 } // namespace extensions 447 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | tools/valgrind/drmemory/suppressions_full.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698