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

Side by Side Diff: mojo/public/cpp/bindings/interface_endpoint_client.h

Issue 2720403003: Remove the MessageLoop::DestructionObserver from mojo bindings. (Closed)
Patch Set: Created 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 19 matching lines...) Expand all
30 namespace mojo { 30 namespace mojo {
31 31
32 class AssociatedGroup; 32 class AssociatedGroup;
33 class AssociatedGroupController; 33 class AssociatedGroupController;
34 class InterfaceEndpointController; 34 class InterfaceEndpointController;
35 35
36 // InterfaceEndpointClient handles message sending and receiving of an interface 36 // InterfaceEndpointClient handles message sending and receiving of an interface
37 // endpoint, either the implementation side or the client side. 37 // endpoint, either the implementation side or the client side.
38 // It should only be accessed and destructed on the creating thread. 38 // It should only be accessed and destructed on the creating thread.
39 class MOJO_CPP_BINDINGS_EXPORT InterfaceEndpointClient 39 class MOJO_CPP_BINDINGS_EXPORT InterfaceEndpointClient
40 : NON_EXPORTED_BASE(public MessageReceiverWithResponder), 40 : NON_EXPORTED_BASE(public MessageReceiverWithResponder) {
41 public base::MessageLoop::DestructionObserver {
42 public: 41 public:
43 // |receiver| is okay to be null. If it is not null, it must outlive this 42 // |receiver| is okay to be null. If it is not null, it must outlive this
44 // object. 43 // object.
45 InterfaceEndpointClient(ScopedInterfaceEndpointHandle handle, 44 InterfaceEndpointClient(ScopedInterfaceEndpointHandle handle,
46 MessageReceiverWithResponderStatus* receiver, 45 MessageReceiverWithResponderStatus* receiver,
47 std::unique_ptr<MessageReceiver> payload_validator, 46 std::unique_ptr<MessageReceiver> payload_validator,
48 bool expect_sync_requests, 47 bool expect_sync_requests,
49 scoped_refptr<base::SingleThreadTaskRunner> runner, 48 scoped_refptr<base::SingleThreadTaskRunner> runner,
50 uint32_t interface_version); 49 uint32_t interface_version);
51 ~InterfaceEndpointClient() override; 50 ~InterfaceEndpointClient() override;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // MessageReceiver implementation: 141 // MessageReceiver implementation:
143 bool Accept(Message* message) override; 142 bool Accept(Message* message) override;
144 143
145 private: 144 private:
146 InterfaceEndpointClient* const owner_; 145 InterfaceEndpointClient* const owner_;
147 146
148 DISALLOW_COPY_AND_ASSIGN(HandleIncomingMessageThunk); 147 DISALLOW_COPY_AND_ASSIGN(HandleIncomingMessageThunk);
149 }; 148 };
150 149
151 bool HandleValidatedMessage(Message* message); 150 bool HandleValidatedMessage(Message* message);
152 void StopObservingIfNecessary();
153
154 // base::MessageLoop::DestructionObserver:
155 void WillDestroyCurrentMessageLoop() override;
156 151
157 ScopedInterfaceEndpointHandle handle_; 152 ScopedInterfaceEndpointHandle handle_;
158 std::unique_ptr<AssociatedGroup> associated_group_; 153 std::unique_ptr<AssociatedGroup> associated_group_;
159 InterfaceEndpointController* controller_; 154 InterfaceEndpointController* controller_;
160 155
161 MessageReceiverWithResponderStatus* const incoming_receiver_; 156 MessageReceiverWithResponderStatus* const incoming_receiver_;
162 HandleIncomingMessageThunk thunk_; 157 HandleIncomingMessageThunk thunk_;
163 FilterChain filters_; 158 FilterChain filters_;
164 159
165 AsyncResponderMap async_responders_; 160 AsyncResponderMap async_responders_;
166 SyncResponseMap sync_responses_; 161 SyncResponseMap sync_responses_;
167 162
168 uint64_t next_request_id_; 163 uint64_t next_request_id_;
169 164
170 base::Closure error_handler_; 165 base::Closure error_handler_;
171 ConnectionErrorWithReasonCallback error_with_reason_handler_; 166 ConnectionErrorWithReasonCallback error_with_reason_handler_;
172 bool encountered_error_; 167 bool encountered_error_;
173 168
174 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 169 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
175 170
176 internal::ControlMessageProxy control_message_proxy_; 171 internal::ControlMessageProxy control_message_proxy_;
177 internal::ControlMessageHandler control_message_handler_; 172 internal::ControlMessageHandler control_message_handler_;
178 173
179 bool observing_message_loop_destruction_ = true;
180
181 base::ThreadChecker thread_checker_; 174 base::ThreadChecker thread_checker_;
182 175
183 base::WeakPtrFactory<InterfaceEndpointClient> weak_ptr_factory_; 176 base::WeakPtrFactory<InterfaceEndpointClient> weak_ptr_factory_;
184 177
185 DISALLOW_COPY_AND_ASSIGN(InterfaceEndpointClient); 178 DISALLOW_COPY_AND_ASSIGN(InterfaceEndpointClient);
186 }; 179 };
187 180
188 } // namespace mojo 181 } // namespace mojo
189 182
190 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_ 183 #endif // MOJO_PUBLIC_CPP_BINDINGS_INTERFACE_ENDPOINT_CLIENT_H_
OLDNEW
« no previous file with comments | « mojo/android/system/watcher_impl.cc ('k') | mojo/public/cpp/bindings/lib/interface_endpoint_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698