| 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 MOJO_PUBLIC_CPP_BINDINGS_CONNECTOR_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_CONNECTOR_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_CONNECTOR_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_CONNECTOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 void HandleError(bool force_pipe_reset, bool force_async_handler); | 168 void HandleError(bool force_pipe_reset, bool force_async_handler); |
| 169 | 169 |
| 170 // Cancels any calls made to |waiter_|. | 170 // Cancels any calls made to |waiter_|. |
| 171 void CancelWait(); | 171 void CancelWait(); |
| 172 | 172 |
| 173 void EnsureSyncWatcherExists(); | 173 void EnsureSyncWatcherExists(); |
| 174 | 174 |
| 175 base::Closure connection_error_handler_; | 175 base::Closure connection_error_handler_; |
| 176 | 176 |
| 177 ScopedMessagePipeHandle message_pipe_; | 177 ScopedMessagePipeHandle message_pipe_; |
| 178 MessageReceiver* incoming_receiver_; | 178 MessageReceiver* incoming_receiver_ = nullptr; |
| 179 | 179 |
| 180 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 180 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 181 Watcher handle_watcher_; | 181 Watcher handle_watcher_; |
| 182 | 182 |
| 183 bool error_; | 183 bool error_ = false; |
| 184 bool drop_writes_; | 184 bool drop_writes_ = false; |
| 185 bool enforce_errors_from_incoming_receiver_; | 185 bool enforce_errors_from_incoming_receiver_ = true; |
| 186 | 186 |
| 187 bool paused_; | 187 bool paused_ = false; |
| 188 | 188 |
| 189 // If sending messages is allowed from multiple threads, |lock_| is used to | 189 // If sending messages is allowed from multiple threads, |lock_| is used to |
| 190 // protect modifications to |message_pipe_| and |drop_writes_|. | 190 // protect modifications to |message_pipe_| and |drop_writes_|. |
| 191 std::unique_ptr<base::Lock> lock_; | 191 std::unique_ptr<base::Lock> lock_; |
| 192 | 192 |
| 193 std::unique_ptr<SyncHandleWatcher> sync_watcher_; | 193 std::unique_ptr<SyncHandleWatcher> sync_watcher_; |
| 194 bool allow_woken_up_by_others_; | 194 bool allow_woken_up_by_others_ = false; |
| 195 // If non-zero, currently the control flow is inside the sync handle watcher | 195 // If non-zero, currently the control flow is inside the sync handle watcher |
| 196 // callback. | 196 // callback. |
| 197 size_t sync_handle_watcher_callback_count_; | 197 size_t sync_handle_watcher_callback_count_ = 0; |
| 198 | 198 |
| 199 base::ThreadChecker thread_checker_; | 199 base::ThreadChecker thread_checker_; |
| 200 | 200 |
| 201 base::Lock connected_lock_; |
| 202 bool connected_ = true; |
| 203 |
| 201 // Create a single weak ptr and use it everywhere, to avoid the malloc/free | 204 // Create a single weak ptr and use it everywhere, to avoid the malloc/free |
| 202 // cost of creating a new weak ptr whenever it is needed. | 205 // cost of creating a new weak ptr whenever it is needed. |
| 203 base::WeakPtr<Connector> weak_self_; | 206 base::WeakPtr<Connector> weak_self_; |
| 204 base::WeakPtrFactory<Connector> weak_factory_; | 207 base::WeakPtrFactory<Connector> weak_factory_; |
| 205 | 208 |
| 206 DISALLOW_COPY_AND_ASSIGN(Connector); | 209 DISALLOW_COPY_AND_ASSIGN(Connector); |
| 207 }; | 210 }; |
| 208 | 211 |
| 209 } // namespace mojo | 212 } // namespace mojo |
| 210 | 213 |
| 211 #endif // MOJO_PUBLIC_CPP_BINDINGS_CONNECTOR_H_ | 214 #endif // MOJO_PUBLIC_CPP_BINDINGS_CONNECTOR_H_ |
| OLD | NEW |