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

Side by Side Diff: webrtc/examples/peerconnection/server/peer_channel.cc

Issue 1504283004: Enable cpplint for webrtc/examples and fix all uncovered cpplint errors. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add "henrike" to TODO markers 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/examples/peerconnection/server/peer_channel.h" 11 #include "webrtc/examples/peerconnection/server/peer_channel.h"
12 12
13 #include <stdio.h> 13 #include <stdio.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 #include <string.h> 15 #include <string.h>
16 16
17 #include <algorithm> 17 #include <algorithm>
18 18
19 #include "webrtc/examples/peerconnection/server/data_socket.h" 19 #include "webrtc/examples/peerconnection/server/data_socket.h"
20 #include "webrtc/examples/peerconnection/server/utils.h" 20 #include "webrtc/examples/peerconnection/server/utils.h"
21 #include "webrtc/base/stringutils.h" 21 #include "webrtc/base/stringutils.h"
22 #include "webrtc/base/urlencode.h"
22 23
23 using rtc::sprintfn; 24 using rtc::sprintfn;
24 25
25 // Set to the peer id of the originator when messages are being 26 // Set to the peer id of the originator when messages are being
26 // exchanged between peers, but set to the id of the receiving peer 27 // exchanged between peers, but set to the id of the receiving peer
27 // itself when notifications are sent from the server about the state 28 // itself when notifications are sent from the server about the state
28 // of other peers. 29 // of other peers.
29 // 30 //
30 // WORKAROUND: Since support for CORS varies greatly from one browser to the 31 // WORKAROUND: Since support for CORS varies greatly from one browser to the
31 // next, we don't use a custom name for our peer-id header (originally it was 32 // next, we don't use a custom name for our peer-id header (originally it was
(...skipping 20 matching lines...) Expand all
52 // 53 //
53 54
54 int ChannelMember::s_member_id_ = 0; 55 int ChannelMember::s_member_id_ = 0;
55 56
56 ChannelMember::ChannelMember(DataSocket* socket) 57 ChannelMember::ChannelMember(DataSocket* socket)
57 : waiting_socket_(NULL), id_(++s_member_id_), 58 : waiting_socket_(NULL), id_(++s_member_id_),
58 connected_(true), timestamp_(time(NULL)) { 59 connected_(true), timestamp_(time(NULL)) {
59 assert(socket); 60 assert(socket);
60 assert(socket->method() == DataSocket::GET); 61 assert(socket->method() == DataSocket::GET);
61 assert(socket->PathEquals("/sign_in")); 62 assert(socket->PathEquals("/sign_in"));
62 name_ = socket->request_arguments(); // TODO: urldecode 63 name_ = rtc::UrlDecodeString(socket->request_arguments());
63 if (name_.empty()) 64 if (name_.empty())
64 name_ = "peer_" + int2str(id_); 65 name_ = "peer_" + int2str(id_);
65 else if (name_.length() > kMaxNameLength) 66 else if (name_.length() > kMaxNameLength)
66 name_.resize(kMaxNameLength); 67 name_.resize(kMaxNameLength);
67 68
68 std::replace(name_.begin(), name_.end(), ',', '_'); 69 std::replace(name_.begin(), name_.end(), ',', '_');
69 } 70 }
70 71
71 ChannelMember::~ChannelMember() { 72 ChannelMember::~ChannelMember() {
72 } 73 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 std::string response(member.GetEntry()); 355 std::string response(member.GetEntry());
355 for (Members::iterator i = members_.begin(); i != members_.end(); ++i) { 356 for (Members::iterator i = members_.begin(); i != members_.end(); ++i) {
356 if (member.id() != (*i)->id()) { 357 if (member.id() != (*i)->id()) {
357 assert((*i)->connected()); 358 assert((*i)->connected());
358 response += (*i)->GetEntry(); 359 response += (*i)->GetEntry();
359 } 360 }
360 } 361 }
361 362
362 return response; 363 return response;
363 } 364 }
OLDNEW
« no previous file with comments | « webrtc/examples/peerconnection/server/peer_channel.h ('k') | webrtc/examples/peerconnection/server/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698