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/sequenced_task_runner_handle.h" |
10 #include "blimp/net/blimp_message_processor.h" | 10 #include "blimp/net/blimp_message_processor.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 ThreadPipeManager::ThreadPipeManager( | 76 ThreadPipeManager::ThreadPipeManager( |
77 const scoped_refptr<base::SequencedTaskRunner>& connection_task_runner, | 77 const scoped_refptr<base::SequencedTaskRunner>& connection_task_runner, |
78 BrowserConnectionHandler* connection_handler) | 78 BrowserConnectionHandler* connection_handler) |
79 : connection_task_runner_(connection_task_runner), | 79 : connection_task_runner_(connection_task_runner), |
80 connection_pipe_manager_( | 80 connection_pipe_manager_( |
81 new ConnectionThreadPipeManager(connection_handler)) {} | 81 new ConnectionThreadPipeManager(connection_handler)) {} |
82 | 82 |
83 ThreadPipeManager::~ThreadPipeManager() { | 83 ThreadPipeManager::~ThreadPipeManager() { |
84 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 84 DCHECK(sequence_checker_.CalledOnValidSequence()); |
85 | 85 |
86 connection_task_runner_->DeleteSoon(FROM_HERE, | 86 connection_task_runner_->DeleteSoon(FROM_HERE, |
87 connection_pipe_manager_.release()); | 87 connection_pipe_manager_.release()); |
88 } | 88 } |
89 | 89 |
90 std::unique_ptr<BlimpMessageProcessor> ThreadPipeManager::RegisterFeature( | 90 std::unique_ptr<BlimpMessageProcessor> ThreadPipeManager::RegisterFeature( |
91 BlimpMessage::FeatureCase feature_case, | 91 BlimpMessage::FeatureCase feature_case, |
92 BlimpMessageProcessor* incoming_processor) { | 92 BlimpMessageProcessor* incoming_processor) { |
93 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 93 DCHECK(sequence_checker_.CalledOnValidSequence()); |
94 | 94 |
95 // Creates an outgoing pipe and a proxy for forwarding messages | 95 // Creates an outgoing pipe and a proxy for forwarding messages |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
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 |