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

Side by Side Diff: chrome/browser/net/probe_message.h

Issue 1550593002: Switch to standard integer types in chrome/browser/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | chrome/browser/net/probe_message.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_NET_PROBE_MESSAGE_H_ 5 #ifndef CHROME_BROWSER_NET_PROBE_MESSAGE_H_
6 #define CHROME_BROWSER_NET_PROBE_MESSAGE_H_ 6 #define CHROME_BROWSER_NET_PROBE_MESSAGE_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 11
10 #include "base/basictypes.h"
11 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h"
12 #include "chrome/browser/net/probe_message.pb.h" 14 #include "chrome/browser/net/probe_message.pb.h"
13 15
14 namespace chrome_browser_net { 16 namespace chrome_browser_net {
15 17
16 // Packet format between client and server is defined in probe_message.proto. 18 // Packet format between client and server is defined in probe_message.proto.
17 class ProbeMessage { 19 class ProbeMessage {
18 public: 20 public:
19 ProbeMessage(); 21 ProbeMessage();
20 22
21 // Generate a ProbeRequest packet. 23 // Generate a ProbeRequest packet.
22 void GenerateProbeRequest(const ProbePacket_Token& received_token, 24 void GenerateProbeRequest(const ProbePacket_Token& received_token,
23 uint32 group_id, 25 uint32_t group_id,
24 uint32 probe_size, 26 uint32_t probe_size,
25 uint32 pacing_interval_micros, 27 uint32_t pacing_interval_micros,
26 uint32 number_probe_packets, 28 uint32_t number_probe_packets,
27 ProbePacket* output); 29 ProbePacket* output);
28 // Make an encoded packet (string) from a ProbePacket object. 30 // Make an encoded packet (string) from a ProbePacket object.
29 std::string MakeEncodedPacket(const ProbePacket& packet) const; 31 std::string MakeEncodedPacket(const ProbePacket& packet) const;
30 // Fill some common fields in the packet header. 32 // Fill some common fields in the packet header.
31 void SetPacketHeader(ProbePacket_Type packet_type, 33 void SetPacketHeader(ProbePacket_Type packet_type,
32 ProbePacket* probe_packet) const; 34 ProbePacket* probe_packet) const;
33 // Parse the input string (which is an encoded packet) and save the result to 35 // Parse the input string (which is an encoded packet) and save the result to
34 // packet. Return true if there is no error and false otherwise. 36 // packet. Return true if there is no error and false otherwise.
35 bool ParseInput(const std::string& input, ProbePacket* packet) const; 37 bool ParseInput(const std::string& input, ProbePacket* packet) const;
36 38
37 static const uint32 kMaxProbePacketBytes; 39 static const uint32_t kMaxProbePacketBytes;
38 40
39 private: 41 private:
40 // For unittest. 42 // For unittest.
41 friend class ProbeMessageTest; 43 friend class ProbeMessageTest;
42 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestChecksum); 44 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestChecksum);
43 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestEncode); 45 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestEncode);
44 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestGenerateProbeRequest); 46 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestGenerateProbeRequest);
45 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestSetPacketHeader); 47 FRIEND_TEST_ALL_PREFIXES(ProbeMessageTest, TestSetPacketHeader);
46 48
47 // Compute the checksum of the padding string. 49 // Compute the checksum of the padding string.
48 uint32 Checksum(const std::string& str) const; 50 uint32_t Checksum(const std::string& str) const;
49 51
50 // Encode the packet with kEncodingString. This is also used for decoding. 52 // Encode the packet with kEncodingString. This is also used for decoding.
51 std::string Encode(const std::string& input) const; 53 std::string Encode(const std::string& input) const;
52 54
53 static const uint32 kVersion; 55 static const uint32_t kVersion;
54 static const uint32 kMaxNumberProbePackets; 56 static const uint32_t kMaxNumberProbePackets;
55 static const uint32 kMaxPacingIntervalMicros; 57 static const uint32_t kMaxPacingIntervalMicros;
56 static const char kEncodingString[]; 58 static const char kEncodingString[];
57 59
58 DISALLOW_COPY_AND_ASSIGN(ProbeMessage); 60 DISALLOW_COPY_AND_ASSIGN(ProbeMessage);
59 }; 61 };
60 } // namespace chrome_browser_net 62 } // namespace chrome_browser_net
61 #endif // CHROME_BROWSER_NET_PROBE_MESSAGE_H_ 63 #endif // CHROME_BROWSER_NET_PROBE_MESSAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | chrome/browser/net/probe_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698