| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/net/thread_pipe_manager.h" | 5 #include "blimp/net/thread_pipe_manager.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
| 9 #include "base/threading/sequenced_task_runner_handle.h" | 9 #include "base/threading/task_runner_handle.h" |
| 10 #include "blimp/net/blimp_message_processor.h" | 10 #include "blimp/net/blimp_message_processor.h" |
| 11 #include "blimp/net/blimp_message_thread_pipe.h" | 11 #include "blimp/net/blimp_message_thread_pipe.h" |
| 12 #include "blimp/net/browser_connection_handler.h" | 12 #include "blimp/net/browser_connection_handler.h" |
| 13 | 13 |
| 14 namespace blimp { | 14 namespace blimp { |
| 15 | 15 |
| 16 // ConnectionThreadPipeManager manages ThreadPipeManager resources used on the | 16 // ConnectionThreadPipeManager manages ThreadPipeManager resources used on the |
| 17 // connection thread. It is created on the caller thread, and then has pipe | 17 // connection thread. It is created on the caller thread, and then has pipe |
| 18 // and proxy pairs passed to it on the connection thread, to register with | 18 // and proxy pairs passed to it on the connection thread, to register with |
| 19 // the supplied |connection_handler|. It is finally deleted on the connection | 19 // the supplied |connection_handler|. It is finally deleted on the connection |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // from features on the caller thread to network components on the | 96 // from features on the caller thread to network components on the |
| 97 // connection thread. | 97 // connection thread. |
| 98 std::unique_ptr<BlimpMessageThreadPipe> outgoing_pipe( | 98 std::unique_ptr<BlimpMessageThreadPipe> outgoing_pipe( |
| 99 new BlimpMessageThreadPipe(connection_task_runner_)); | 99 new BlimpMessageThreadPipe(connection_task_runner_)); |
| 100 std::unique_ptr<BlimpMessageProcessor> outgoing_proxy = | 100 std::unique_ptr<BlimpMessageProcessor> outgoing_proxy = |
| 101 outgoing_pipe->CreateProxy(); | 101 outgoing_pipe->CreateProxy(); |
| 102 | 102 |
| 103 // Creates an incoming pipe and a proxy for receiving messages | 103 // Creates an incoming pipe and a proxy for receiving messages |
| 104 // from network components on the connection thread. | 104 // from network components on the connection thread. |
| 105 std::unique_ptr<BlimpMessageThreadPipe> incoming_pipe( | 105 std::unique_ptr<BlimpMessageThreadPipe> incoming_pipe( |
| 106 new BlimpMessageThreadPipe(base::SequencedTaskRunnerHandle::Get())); | 106 new BlimpMessageThreadPipe(base::TaskRunnerHandle::GetSequenced())); |
| 107 incoming_pipe->set_target_processor(incoming_processor); | 107 incoming_pipe->set_target_processor(incoming_processor); |
| 108 std::unique_ptr<BlimpMessageProcessor> incoming_proxy = | 108 std::unique_ptr<BlimpMessageProcessor> incoming_proxy = |
| 109 incoming_pipe->CreateProxy(); | 109 incoming_pipe->CreateProxy(); |
| 110 | 110 |
| 111 // Finishes registration on connection thread. | 111 // Finishes registration on connection thread. |
| 112 connection_task_runner_->PostTask( | 112 connection_task_runner_->PostTask( |
| 113 FROM_HERE, | 113 FROM_HERE, |
| 114 base::Bind(&ConnectionThreadPipeManager::RegisterFeature, | 114 base::Bind(&ConnectionThreadPipeManager::RegisterFeature, |
| 115 base::Unretained(connection_pipe_manager_.get()), feature_case, | 115 base::Unretained(connection_pipe_manager_.get()), feature_case, |
| 116 base::Passed(std::move(outgoing_pipe)), | 116 base::Passed(std::move(outgoing_pipe)), |
| 117 base::Passed(std::move(incoming_proxy)))); | 117 base::Passed(std::move(incoming_proxy)))); |
| 118 | 118 |
| 119 incoming_pipes_.push_back(std::move(incoming_pipe)); | 119 incoming_pipes_.push_back(std::move(incoming_pipe)); |
| 120 return outgoing_proxy; | 120 return outgoing_proxy; |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace blimp | 123 } // namespace blimp |
| OLD | NEW |