Skip to content

Commit

Permalink
Rename WebSocketChannel::SendIOBuffer to SendFrameFromIOBuffer
Browse files Browse the repository at this point in the history
SendIOBuffer sounds like sending raw data from an IOBuffer. I'd like to
add Frame to make it look like dealing with structured data representing
a frame.

BUG=none

Review URL: https://codereview.chromium.org/196473009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258943 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tyoshino@chromium.org committed Mar 24, 2014
1 parent ecd7c10 commit a691b6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions net/websockets/websocket_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void WebSocketChannel::SendFrame(bool fin,
// server is not saturated.
scoped_refptr<IOBuffer> buffer(new IOBuffer(data.size()));
std::copy(data.begin(), data.end(), buffer->data());
AllowUnused(SendIOBuffer(fin, op_code, buffer, data.size()));
AllowUnused(SendFrameFromIOBuffer(fin, op_code, buffer, data.size()));
// |this| may have been deleted.
}

Expand Down Expand Up @@ -768,7 +768,7 @@ ChannelState WebSocketChannel::HandleFrameByState(
case WebSocketFrameHeader::kOpCodePing:
VLOG(1) << "Got Ping of size " << size;
if (state_ == CONNECTED)
return SendIOBuffer(
return SendFrameFromIOBuffer(
true, WebSocketFrameHeader::kOpCodePong, data_buffer, size);
VLOG(3) << "Ignored ping in state " << state_;
return CHANNEL_ALIVE;
Expand Down Expand Up @@ -907,7 +907,7 @@ ChannelState WebSocketChannel::HandleDataFrame(
return event_interface_->OnDataFrame(final, opcode_to_send, data);
}

ChannelState WebSocketChannel::SendIOBuffer(
ChannelState WebSocketChannel::SendFrameFromIOBuffer(
bool fin,
WebSocketFrameHeader::OpCode op_code,
const scoped_refptr<IOBuffer>& buffer,
Expand Down Expand Up @@ -985,7 +985,8 @@ ChannelState WebSocketChannel::SendClose(uint16 code,
FROM_HERE,
timeout_,
base::Bind(&WebSocketChannel::CloseTimeout, base::Unretained(this)));
if (SendIOBuffer(true, WebSocketFrameHeader::kOpCodeClose, body, size) ==
if (SendFrameFromIOBuffer(
true, WebSocketFrameHeader::kOpCodeClose, body, size) ==
CHANNEL_DELETED)
return CHANNEL_DELETED;
return CHANNEL_ALIVE;
Expand Down
8 changes: 4 additions & 4 deletions net/websockets/websocket_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ class NET_EXPORT WebSocketChannel {
// when the current write finishes. |fin| and |op_code| are defined as for
// SendFrame() above, except that |op_code| may also be a control frame
// opcode.
ChannelState SendIOBuffer(bool fin,
WebSocketFrameHeader::OpCode op_code,
const scoped_refptr<IOBuffer>& buffer,
size_t size) WARN_UNUSED_RESULT;
ChannelState SendFrameFromIOBuffer(bool fin,
WebSocketFrameHeader::OpCode op_code,
const scoped_refptr<IOBuffer>& buffer,
size_t size) WARN_UNUSED_RESULT;

// Performs the "Fail the WebSocket Connection" operation as defined in
// RFC6455. A NotifyFailure message is sent to the renderer with |message|.
Expand Down

0 comments on commit a691b6c

Please sign in to comment.