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

Side by Side Diff: google_apis/gcm/engine/fake_connection_handler.h

Issue 980433003: [GCM] Fix crash during connection races (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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 GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_HANDLER_H_ 5 #ifndef GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_HANDLER_H_
6 #define GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_HANDLER_H_ 6 #define GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_HANDLER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "google_apis/gcm/base/mcs_message.h" 10 #include "google_apis/gcm/base/mcs_message.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void set_fail_login(bool fail_login) { 44 void set_fail_login(bool fail_login) {
45 fail_login_ = fail_login; 45 fail_login_ = fail_login;
46 } 46 }
47 47
48 // Whether to invoke the write callback on the next send attempt or fake a 48 // Whether to invoke the write callback on the next send attempt or fake a
49 // connection error instead. 49 // connection error instead.
50 void set_fail_send(bool fail_send) { 50 void set_fail_send(bool fail_send) {
51 fail_send_ = fail_send; 51 fail_send_ = fail_send;
52 } 52 }
53 53
54 // Whether a socket-level error was encountered or not.
55 void set_had_error(bool had_error) {
56 had_error_ = had_error;
57 }
58
59 bool initialized() const { return initialized_; }
60
54 private: 61 private:
55 ConnectionHandler::ProtoReceivedCallback read_callback_; 62 ConnectionHandler::ProtoReceivedCallback read_callback_;
56 ConnectionHandler::ProtoSentCallback write_callback_; 63 ConnectionHandler::ProtoSentCallback write_callback_;
57 64
58 std::list<MCSMessage> expected_outgoing_messages_; 65 std::list<MCSMessage> expected_outgoing_messages_;
59 66
60 // Whether to fail the login or not. 67 // Whether to fail the login or not.
61 bool fail_login_; 68 bool fail_login_;
62 69
63 // Whether to fail a SendMessage call or not. 70 // Whether to fail a SendMessage call or not.
64 bool fail_send_; 71 bool fail_send_;
65 72
66 // Whether a successful login has completed. 73 // Whether a successful login has completed.
67 bool initialized_; 74 bool initialized_;
68 75
76 // Whether an error was encountered after a successful login.
77 bool had_error_;
78
69 DISALLOW_COPY_AND_ASSIGN(FakeConnectionHandler); 79 DISALLOW_COPY_AND_ASSIGN(FakeConnectionHandler);
70 }; 80 };
71 81
72 } // namespace gcm 82 } // namespace gcm
73 83
74 #endif // GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_HANDLER_H_ 84 #endif // GOOGLE_APIS_GCM_ENGINE_FAKE_CONNECTION_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698