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

Side by Side Diff: mojo/services/network/http_connection_impl.cc

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 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 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 "mojo/services/network/http_connection_impl.h" 5 #include "mojo/services/network/http_connection_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // WebSocket implementation. 149 // WebSocket implementation.
150 void Connect(const String& url, 150 void Connect(const String& url,
151 Array<String> protocols, 151 Array<String> protocols,
152 const String& origin, 152 const String& origin,
153 ScopedDataPipeConsumerHandle send_stream, 153 ScopedDataPipeConsumerHandle send_stream,
154 WebSocketClientPtr client) override { 154 WebSocketClientPtr client) override {
155 NOTREACHED(); 155 NOTREACHED();
156 } 156 }
157 157
158 void Send(bool fin, MessageType type, uint32_t num_bytes) override { 158 void Send(bool fin, MessageType type, uint32_t num_bytes) override {
159 if (!fin || type != MESSAGE_TYPE_TEXT) { 159 if (!fin || type != MessageType::TEXT) {
160 NOTIMPLEMENTED(); 160 NOTIMPLEMENTED();
161 Close(); 161 Close();
162 } 162 }
163 163
164 // TODO(yzshen): It shouldn't be an issue to pass an empty message. However, 164 // TODO(yzshen): It shouldn't be an issue to pass an empty message. However,
165 // WebSocket{Read,Write}Queue doesn't handle that correctly. 165 // WebSocket{Read,Write}Queue doesn't handle that correctly.
166 if (num_bytes == 0) 166 if (num_bytes == 0)
167 return; 167 return;
168 168
169 pending_send_count_++; 169 pending_send_count_++;
(...skipping 19 matching lines...) Expand all
189 189
190 if (IsClosing()) 190 if (IsClosing())
191 NotifyOwnerCloseIfAllDone(); 191 NotifyOwnerCloseIfAllDone();
192 } 192 }
193 193
194 void OnFinishedWritingReceiveStream(uint32_t num_bytes, const char* buffer) { 194 void OnFinishedWritingReceiveStream(uint32_t num_bytes, const char* buffer) {
195 if (IsClosing()) 195 if (IsClosing())
196 return; 196 return;
197 197
198 if (buffer) 198 if (buffer)
199 client_->DidReceiveData(true, MESSAGE_TYPE_TEXT, num_bytes); 199 client_->DidReceiveData(true, MessageType::TEXT, num_bytes);
200 } 200 }
201 201
202 // Checks whether Close() has been called. 202 // Checks whether Close() has been called.
203 bool IsClosing() const { return !binding_.is_bound(); } 203 bool IsClosing() const { return !binding_.is_bound(); }
204 204
205 void NotifyOwnerCloseIfAllDone() { 205 void NotifyOwnerCloseIfAllDone() {
206 DCHECK(IsClosing()); 206 DCHECK(IsClosing());
207 207
208 if (pending_send_count_ == 0) 208 if (pending_send_count_ == 0)
209 connection_->OnWebSocketClosed(); 209 connection_->OnWebSocketClosed();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // The close operation is initiated by this object. 418 // The close operation is initiated by this object.
419 NotifyOwnerCloseIfAllDone(); 419 NotifyOwnerCloseIfAllDone();
420 } else { 420 } else {
421 // The close operation is initiated by |web_socket_|; start closing this 421 // The close operation is initiated by |web_socket_|; start closing this
422 // object. 422 // object.
423 Close(); 423 Close();
424 } 424 }
425 } 425 }
426 426
427 } // namespace mojo 427 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/generator.py ('k') | mojo/services/network/http_server_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698