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

Side by Side Diff: blimp/net/stream_packet_writer.cc

Issue 1538253002: Switch to standard integer types in blimp/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « blimp/net/stream_packet_reader.cc ('k') | blimp/net/tcp_transport_unittest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/net/stream_packet_writer.h" 5 #include "blimp/net/stream_packet_writer.h"
6 6
7 #include <iostream> 7 #include <iostream>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 StreamPacketWriter::~StreamPacketWriter() {} 48 StreamPacketWriter::~StreamPacketWriter() {}
49 49
50 void StreamPacketWriter::WritePacket(scoped_refptr<net::DrainableIOBuffer> data, 50 void StreamPacketWriter::WritePacket(scoped_refptr<net::DrainableIOBuffer> data,
51 const net::CompletionCallback& callback) { 51 const net::CompletionCallback& callback) {
52 DCHECK_EQ(WriteState::IDLE, write_state_); 52 DCHECK_EQ(WriteState::IDLE, write_state_);
53 DCHECK(data); 53 DCHECK(data);
54 CHECK(data->BytesRemaining()); 54 CHECK(data->BytesRemaining());
55 55
56 write_state_ = WriteState::HEADER; 56 write_state_ = WriteState::HEADER;
57 header_buffer_->SetOffset(0); 57 header_buffer_->SetOffset(0);
58 *reinterpret_cast<uint32*>(header_buffer_->data()) = 58 *reinterpret_cast<uint32_t*>(header_buffer_->data()) =
59 base::HostToNet32(data->BytesRemaining()); 59 base::HostToNet32(data->BytesRemaining());
60 payload_buffer_ = data; 60 payload_buffer_ = data;
61 61
62 int result = DoWriteLoop(net::OK); 62 int result = DoWriteLoop(net::OK);
63 if (result != net::ERR_IO_PENDING) { 63 if (result != net::ERR_IO_PENDING) {
64 // Release the payload buffer, since the write operation has completed 64 // Release the payload buffer, since the write operation has completed
65 // synchronously. 65 // synchronously.
66 payload_buffer_ = nullptr; 66 payload_buffer_ = nullptr;
67 67
68 // Adapt synchronous completion to an asynchronous style. 68 // Adapt synchronous completion to an asynchronous style.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 // If the write finished, either successfully or by error, inform the 142 // If the write finished, either successfully or by error, inform the
143 // caller. 143 // caller.
144 if (result != net::ERR_IO_PENDING) { 144 if (result != net::ERR_IO_PENDING) {
145 payload_buffer_ = nullptr; 145 payload_buffer_ = nullptr;
146 base::ResetAndReturn(&callback_).Run(result); 146 base::ResetAndReturn(&callback_).Run(result);
147 } 147 }
148 } 148 }
149 149
150 } // namespace blimp 150 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/stream_packet_reader.cc ('k') | blimp/net/tcp_transport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698