| OLD | NEW |
| 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 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" | 5 #include "mojo/public/cpp/bindings/lib/multiplex_router.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 313 } |
| 314 | 314 |
| 315 void MultiplexRouter::EnableTestingMode() { | 315 void MultiplexRouter::EnableTestingMode() { |
| 316 DCHECK(thread_checker_.CalledOnValidThread()); | 316 DCHECK(thread_checker_.CalledOnValidThread()); |
| 317 base::AutoLock locker(lock_); | 317 base::AutoLock locker(lock_); |
| 318 | 318 |
| 319 testing_mode_ = true; | 319 testing_mode_ = true; |
| 320 connector_.set_enforce_errors_from_incoming_receiver(false); | 320 connector_.set_enforce_errors_from_incoming_receiver(false); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void MultiplexRouter::SetAllowSyncDispatch(bool allowed) { |
| 324 connector_.SetAllowSyncDispatch(allowed); |
| 325 } |
| 326 |
| 323 bool MultiplexRouter::Accept(Message* message) { | 327 bool MultiplexRouter::Accept(Message* message) { |
| 324 DCHECK(thread_checker_.CalledOnValidThread()); | 328 DCHECK(thread_checker_.CalledOnValidThread()); |
| 325 | 329 |
| 326 scoped_refptr<MultiplexRouter> protector(this); | 330 scoped_refptr<MultiplexRouter> protector(this); |
| 327 base::AutoLock locker(lock_); | 331 base::AutoLock locker(lock_); |
| 328 tasks_.push_back(Task::CreateIncomingMessageTask(message)); | 332 tasks_.push_back(Task::CreateIncomingMessageTask(message)); |
| 329 ProcessTasks(false); | 333 ProcessTasks(false); |
| 330 | 334 |
| 331 // Always return true. If we see errors during message processing, we will | 335 // Always return true. If we see errors during message processing, we will |
| 332 // explicitly call Connector::RaiseError() to disconnect the message pipe. | 336 // explicitly call Connector::RaiseError() to disconnect the message pipe. |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 } | 532 } |
| 529 | 533 |
| 530 void MultiplexRouter::RaiseErrorInNonTestingMode() { | 534 void MultiplexRouter::RaiseErrorInNonTestingMode() { |
| 531 lock_.AssertAcquired(); | 535 lock_.AssertAcquired(); |
| 532 if (!testing_mode_) | 536 if (!testing_mode_) |
| 533 RaiseError(); | 537 RaiseError(); |
| 534 } | 538 } |
| 535 | 539 |
| 536 } // namespace internal | 540 } // namespace internal |
| 537 } // namespace mojo | 541 } // namespace mojo |
| OLD | NEW |