OLD | NEW |
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 NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_ | 5 #ifndef NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_ |
6 #define NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_ | 6 #define NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 uint32 window_secs, | 23 uint32 window_secs, |
24 const uint8 orbit[8], | 24 const uint8 orbit[8], |
25 StrikeRegister::StartupType startup); | 25 StrikeRegister::StartupType startup); |
26 virtual ~DelayedVerifyStrikeRegisterClient(); | 26 virtual ~DelayedVerifyStrikeRegisterClient(); |
27 | 27 |
28 virtual void VerifyNonceIsValidAndUnique(base::StringPiece nonce, | 28 virtual void VerifyNonceIsValidAndUnique(base::StringPiece nonce, |
29 QuicWallTime now, | 29 QuicWallTime now, |
30 ResultCallback* cb) OVERRIDE; | 30 ResultCallback* cb) OVERRIDE; |
31 | 31 |
32 // Start queueing verifications instead of executing them immediately. | 32 // Start queueing verifications instead of executing them immediately. |
33 void StartDelayingVerification() { | 33 void StartDelayingVerification() { delay_verifications_ = true; } |
34 delay_verifications_ = true; | |
35 } | |
36 // Number of verifications that are queued. | 34 // Number of verifications that are queued. |
37 int PendingVerifications() const; | 35 int PendingVerifications() const; |
38 // Run all pending verifications. | 36 // Run all pending verifications. |
39 void RunPendingVerifications(); | 37 void RunPendingVerifications(); |
40 | 38 |
41 private: | 39 private: |
42 struct VerifyArgs { | 40 struct VerifyArgs { |
43 VerifyArgs(base::StringPiece in_nonce, | 41 VerifyArgs(base::StringPiece in_nonce, |
44 QuicWallTime in_now, | 42 QuicWallTime in_now, |
45 ResultCallback* in_cb) | 43 ResultCallback* in_cb) |
46 : nonce(in_nonce.as_string()), | 44 : nonce(in_nonce.as_string()), now(in_now), cb(in_cb) {} |
47 now(in_now), | |
48 cb(in_cb) { | |
49 } | |
50 | 45 |
51 std::string nonce; | 46 std::string nonce; |
52 QuicWallTime now; | 47 QuicWallTime now; |
53 ResultCallback* cb; | 48 ResultCallback* cb; |
54 }; | 49 }; |
55 | 50 |
56 bool delay_verifications_; | 51 bool delay_verifications_; |
57 std::vector<VerifyArgs> pending_verifications_; | 52 std::vector<VerifyArgs> pending_verifications_; |
58 | 53 |
59 DISALLOW_COPY_AND_ASSIGN(DelayedVerifyStrikeRegisterClient); | 54 DISALLOW_COPY_AND_ASSIGN(DelayedVerifyStrikeRegisterClient); |
60 }; | 55 }; |
61 | 56 |
62 } // namespace test | 57 } // namespace test |
63 } // namespace net | 58 } // namespace net |
64 | 59 |
65 #endif // NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_ | 60 #endif // NET_QUIC_TEST_TOOLS_DELAYED_VERIFY_STRIKE_REGISTER_CLIENT_H_ |
OLD | NEW |