|
20 | 20 | #include <string>
|
21 | 21 |
|
22 | 22 | #include "app/memory/unique_ptr.h"
|
23 |
| -#include "app/rest/transport_curl.h" |
24 | 23 | #include "app/src/future_manager.h"
|
25 | 24 | #include "app/src/include/firebase/app.h"
|
26 | 25 | #include "app/src/include/firebase/future.h"
|
27 | 26 | #include "app/src/mutex.h"
|
28 | 27 | #include "app/src/scheduler.h"
|
29 | 28 | #include "app/src/secure/user_secure_manager.h"
|
30 | 29 | #include "app/src/semaphore.h"
|
31 |
| -#include "flatbuffers/stl_emulation.h" |
32 | 30 |
|
33 | 31 | namespace firebase {
|
| 32 | + |
| 33 | +namespace rest { |
| 34 | +class Request; |
| 35 | +class Transport; |
| 36 | +} // namespace rest |
| 37 | + |
34 | 38 | namespace instance_id {
|
35 | 39 | namespace internal {
|
36 | 40 |
|
37 | 41 | class InstanceIdDesktopImplTest; // For testing.
|
| 42 | +class NetworkOperation; // Defined in instance_id_desktop_impl.cc |
| 43 | +class SignalSemaphoreResponse; // Defined in instance_id_desktop_impl.cc |
38 | 44 |
|
39 | 45 | class InstanceIdDesktopImpl {
|
40 | 46 | public:
|
@@ -103,52 +109,6 @@ class InstanceIdDesktopImpl {
|
103 | 109 |
|
104 | 110 | private:
|
105 | 111 | friend class InstanceIdDesktopImplTest;
|
106 |
| - // Response that signals this class when it's complete or canceled. |
107 |
| - class SignalSemaphoreResponse : public rest::Response { |
108 |
| - public: |
109 |
| - explicit SignalSemaphoreResponse(Semaphore* complete) |
110 |
| - : complete_(complete) {} |
111 |
| - |
112 |
| - void MarkCompleted() override { |
113 |
| - rest::Response::MarkCompleted(); |
114 |
| - complete_->Post(); |
115 |
| - } |
116 |
| - |
117 |
| - void MarkCanceled() override { |
118 |
| - rest::Response::MarkCompleted(); |
119 |
| - complete_->Post(); |
120 |
| - } |
121 |
| - |
122 |
| - void Wait() { complete_->Wait(); } |
123 |
| - |
124 |
| - private: |
125 |
| - Semaphore* complete_; |
126 |
| - }; |
127 |
| - |
128 |
| - // State for the current network operation. |
129 |
| - struct NetworkOperation { |
130 |
| - NetworkOperation(const std::string& request_data, Semaphore* complete) |
131 |
| - : request(request_data.c_str(), request_data.length()), |
132 |
| - response(complete) {} |
133 |
| - |
134 |
| - // Schedule the network operation. |
135 |
| - void Perform(rest::Transport* transport) { |
136 |
| - transport->Perform(request, &response, &controller); |
137 |
| - } |
138 |
| - |
139 |
| - // Cancel the current operation. |
140 |
| - void Cancel() { |
141 |
| - rest::Controller* ctrl = controller.get(); |
142 |
| - if (ctrl) ctrl->Cancel(); |
143 |
| - } |
144 |
| - |
145 |
| - // Data sent to the server. |
146 |
| - rest::Request request; |
147 |
| - // Data returned by the server. |
148 |
| - SignalSemaphoreResponse response; |
149 |
| - // Progress of the request and allows us to cancel the request. |
150 |
| - flatbuffers::unique_ptr<rest::Controller> controller; |
151 |
| - }; |
152 | 112 |
|
153 | 113 | // Data cached from a check-in and required to perform instance ID operations.
|
154 | 114 | struct CheckinData {
|
|
0 commit comments