| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_ | 5 #ifndef NET_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_ |
| 6 #define NET_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_ | 6 #define NET_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 int* result_code, | 95 int* result_code, |
| 96 std::string* data_received); | 96 std::string* data_received); |
| 97 | 97 |
| 98 // Performs the command sending on the IO thread. Called on the IO thread. | 98 // Performs the command sending on the IO thread. Called on the IO thread. |
| 99 void SendCommandAndWaitForResultOnIOThread(const std::string& command, | 99 void SendCommandAndWaitForResultOnIOThread(const std::string& command, |
| 100 const std::string& post_data, | 100 const std::string& post_data, |
| 101 int* result_code, | 101 int* result_code, |
| 102 std::string* data_received); | 102 std::string* data_received); |
| 103 | 103 |
| 104 // URLRequest::Delegate methods. Called on the IO thread. | 104 // URLRequest::Delegate methods. Called on the IO thread. |
| 105 void OnResponseStarted(URLRequest* request) override; | 105 void OnResponseStarted(URLRequest* request, int net_error) override; |
| 106 void OnReadCompleted(URLRequest* request, int num_bytes) override; | 106 void OnReadCompleted(URLRequest* request, int num_bytes) override; |
| 107 | 107 |
| 108 // Reads Result from the response. Called on the IO thread. | 108 // Reads Result from the response. Called on the IO thread. |
| 109 void ReadResult(URLRequest* request); | 109 void ReadResult(URLRequest* request); |
| 110 | 110 |
| 111 // Called on the IO thread upon completion of the spawner command. | 111 // Called on the IO thread upon completion of the spawner command. |
| 112 void OnSpawnerCommandCompleted(URLRequest* request); | 112 void OnSpawnerCommandCompleted(URLRequest* request, int net_error); |
| 113 | 113 |
| 114 // Callback on the IO thread for time-out task of request with id |id|. | 114 // Callback on the IO thread for time-out task of request with id |id|. |
| 115 void OnTimeout(int id); | 115 void OnTimeout(int id); |
| 116 | 116 |
| 117 // A thread to communicate with test_spawner server. | 117 // A thread to communicate with test_spawner server. |
| 118 base::Thread io_thread_; | 118 base::Thread io_thread_; |
| 119 | 119 |
| 120 // WaitableEvent to notify whether the communication is done. | 120 // WaitableEvent to notify whether the communication is done. |
| 121 base::WaitableEvent event_; | 121 base::WaitableEvent event_; |
| 122 | 122 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 144 // Factory for creating the time-out task. This takes care of revoking | 144 // Factory for creating the time-out task. This takes care of revoking |
| 145 // outstanding tasks when |this| is deleted. | 145 // outstanding tasks when |this| is deleted. |
| 146 base::WeakPtrFactory<SpawnerCommunicator> weak_factory_; | 146 base::WeakPtrFactory<SpawnerCommunicator> weak_factory_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(SpawnerCommunicator); | 148 DISALLOW_COPY_AND_ASSIGN(SpawnerCommunicator); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace net | 151 } // namespace net |
| 152 | 152 |
| 153 #endif // NET_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_ | 153 #endif // NET_TEST_SPAWNED_TEST_SERVER_SPAWNER_COMMUNICATOR_H_ |
| OLD | NEW |