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

Unified Diff: content/renderer/pepper/pepper_websocket_host.cc

Issue 225903006: PPAPI: Run clang_format.py on content/renderer/pepper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/pepper_websocket_host.h ('k') | content/renderer/pepper/plugin_module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_websocket_host.cc
diff --git a/content/renderer/pepper/pepper_websocket_host.cc b/content/renderer/pepper/pepper_websocket_host.cc
index 7df7796c82f48ac4b4e15ae5fd91d2f6c7f38869..e5bfe7aaa2c738a2bfc060ab3ade4dcb92761905 100644
--- a/content/renderer/pepper/pepper_websocket_host.cc
+++ b/content/renderer/pepper/pepper_websocket_host.cc
@@ -30,10 +30,10 @@ using blink::WebURL;
namespace content {
-#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \
- COMPILE_ASSERT(static_cast<int>(WebSocket::webkit_name) \
- == static_cast<int>(np_name), \
- mismatching_enums)
+#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \
+ COMPILE_ASSERT( \
+ static_cast<int>(WebSocket::webkit_name) == static_cast<int>(np_name), \
+ mismatching_enums)
COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeNormalClosure,
PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE);
@@ -64,17 +64,15 @@ COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeMinimumUserDefined,
COMPILE_ASSERT_MATCHING_ENUM(CloseEventCodeMaximumUserDefined,
PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX);
-PepperWebSocketHost::PepperWebSocketHost(
- RendererPpapiHost* host,
- PP_Instance instance,
- PP_Resource resource)
+PepperWebSocketHost::PepperWebSocketHost(RendererPpapiHost* host,
+ PP_Instance instance,
+ PP_Resource resource)
: ResourceHost(host->GetPpapiHost(), instance, resource),
renderer_ppapi_host_(host),
connecting_(false),
initiating_close_(false),
accepting_close_(false),
- error_was_received_(false) {
-}
+ error_was_received_(false) {}
PepperWebSocketHost::~PepperWebSocketHost() {
if (websocket_)
@@ -85,16 +83,15 @@ int32_t PepperWebSocketHost::OnResourceMessageReceived(
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) {
IPC_BEGIN_MESSAGE_MAP(PepperWebSocketHost, msg)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Connect,
- OnHostMsgConnect)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Close,
- OnHostMsgClose)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendText,
- OnHostMsgSendText)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendBinary,
- OnHostMsgSendBinary)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Fail,
- OnHostMsgFail)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Connect,
+ OnHostMsgConnect)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Close,
+ OnHostMsgClose)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendText,
+ OnHostMsgSendText)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_SendBinary,
+ OnHostMsgSendBinary)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_WebSocket_Fail, OnHostMsgFail)
IPC_END_MESSAGE_MAP()
return PP_ERROR_FAILED;
}
@@ -106,9 +103,7 @@ void PepperWebSocketHost::didConnect() {
connecting_ = false;
connect_reply_.params.set_result(PP_OK);
host()->SendReply(connect_reply_,
- PpapiPluginMsg_WebSocket_ConnectReply(
- url_,
- protocol));
+ PpapiPluginMsg_WebSocket_ConnectReply(url_, protocol));
}
void PepperWebSocketHost::didReceiveMessage(const blink::WebString& message) {
@@ -118,9 +113,8 @@ void PepperWebSocketHost::didReceiveMessage(const blink::WebString& message) {
// Send an IPC to transport received data.
std::string string_message = message.utf8();
- host()->SendUnsolicitedReply(pp_resource(),
- PpapiPluginMsg_WebSocket_ReceiveTextReply(
- string_message));
+ host()->SendUnsolicitedReply(
+ pp_resource(), PpapiPluginMsg_WebSocket_ReceiveTextReply(string_message));
}
void PepperWebSocketHost::didReceiveArrayBuffer(
@@ -132,9 +126,9 @@ void PepperWebSocketHost::didReceiveArrayBuffer(
// Send an IPC to transport received data.
uint8_t* data = static_cast<uint8_t*>(binaryData.data());
std::vector<uint8_t> array_message(data, data + binaryData.byteLength());
- host()->SendUnsolicitedReply(pp_resource(),
- PpapiPluginMsg_WebSocket_ReceiveBinaryReply(
- array_message));
+ host()->SendUnsolicitedReply(
+ pp_resource(),
+ PpapiPluginMsg_WebSocket_ReceiveBinaryReply(array_message));
}
void PepperWebSocketHost::didReceiveMessageError() {
@@ -152,18 +146,18 @@ void PepperWebSocketHost::didReceiveMessageError() {
void PepperWebSocketHost::didUpdateBufferedAmount(
unsigned long buffered_amount) {
// Send an IPC to update buffered amount.
- host()->SendUnsolicitedReply(pp_resource(),
- PpapiPluginMsg_WebSocket_BufferedAmountReply(
- buffered_amount));
+ host()->SendUnsolicitedReply(
+ pp_resource(),
+ PpapiPluginMsg_WebSocket_BufferedAmountReply(buffered_amount));
}
void PepperWebSocketHost::didStartClosingHandshake() {
accepting_close_ = true;
// Send an IPC to notice that server starts closing handshake.
- host()->SendUnsolicitedReply(pp_resource(),
- PpapiPluginMsg_WebSocket_StateReply(
- PP_WEBSOCKETREADYSTATE_CLOSING));
+ host()->SendUnsolicitedReply(
+ pp_resource(),
+ PpapiPluginMsg_WebSocket_StateReply(PP_WEBSOCKETREADYSTATE_CLOSING));
}
void PepperWebSocketHost::didClose(unsigned long unhandled_buffered_amount,
@@ -179,27 +173,23 @@ void PepperWebSocketHost::didClose(unsigned long unhandled_buffered_amount,
}
// Set close_was_clean_.
- bool was_clean =
- (initiating_close_ || accepting_close_) &&
- !unhandled_buffered_amount &&
- status == WebSocketClient::ClosingHandshakeComplete;
+ bool was_clean = (initiating_close_ || accepting_close_) &&
+ !unhandled_buffered_amount &&
+ status == WebSocketClient::ClosingHandshakeComplete;
if (initiating_close_) {
initiating_close_ = false;
close_reply_.params.set_result(PP_OK);
- host()->SendReply(close_reply_, PpapiPluginMsg_WebSocket_CloseReply(
- unhandled_buffered_amount,
- was_clean,
- code,
- reason.utf8()));
+ host()->SendReply(
+ close_reply_,
+ PpapiPluginMsg_WebSocket_CloseReply(
+ unhandled_buffered_amount, was_clean, code, reason.utf8()));
} else {
accepting_close_ = false;
- host()->SendUnsolicitedReply(pp_resource(),
- PpapiPluginMsg_WebSocket_ClosedReply(
- unhandled_buffered_amount,
- was_clean,
- code,
- reason.utf8()));
+ host()->SendUnsolicitedReply(
+ pp_resource(),
+ PpapiPluginMsg_WebSocket_ClosedReply(
+ unhandled_buffered_amount, was_clean, code, reason.utf8()));
}
// Disconnect.
@@ -232,8 +222,8 @@ int32_t PepperWebSocketHost::OnHostMsgConnect(
// Check containing characters.
for (std::string::const_iterator string_it = vector_it->begin();
- string_it != vector_it->end();
- ++string_it) {
+ string_it != vector_it->end();
+ ++string_it) {
uint8_t character = *string_it;
// WebSocket specification says "(Subprotocol string must consist of)
// characters in the range U+0021 to U+007E not including separator
@@ -241,12 +231,13 @@ int32_t PepperWebSocketHost::OnHostMsgConnect(
const uint8_t minimumProtocolCharacter = '!'; // U+0021.
const uint8_t maximumProtocolCharacter = '~'; // U+007E.
if (character < minimumProtocolCharacter ||
- character > maximumProtocolCharacter ||
- character == '"' || character == '(' || character == ')' ||
- character == ',' || character == '/' ||
+ character > maximumProtocolCharacter || character == '"' ||
+ character == '(' || character == ')' || character == ',' ||
+ character == '/' ||
(character >= ':' && character <= '@') || // U+003A - U+0040
(character >= '[' && character <= ']') || // U+005B - u+005D
- character == '{' || character == '}')
+ character == '{' ||
+ character == '}')
return PP_ERROR_BADARGUMENT;
}
// Join protocols with the comma separator.
@@ -289,7 +280,7 @@ int32_t PepperWebSocketHost::OnHostMsgClose(
initiating_close_ = true;
blink::WebSocket::CloseEventCode event_code =
- static_cast<blink::WebSocket::CloseEventCode>(code);
+ static_cast<blink::WebSocket::CloseEventCode>(code);
if (code == PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED) {
// PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED and CloseEventCodeNotSpecified are
// assigned to different values. A conversion is needed if
« no previous file with comments | « content/renderer/pepper/pepper_websocket_host.h ('k') | content/renderer/pepper/plugin_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698