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 #ifndef BLIMP_NET_THREAD_PIPE_MANAGER_H_ | 5 #ifndef BLIMP_NET_THREAD_PIPE_MANAGER_H_ |
6 #define BLIMP_NET_THREAD_PIPE_MANAGER_H_ | 6 #define BLIMP_NET_THREAD_PIPE_MANAGER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Caller is responsible for ensuring that |connection_handler| outlives | 32 // Caller is responsible for ensuring that |connection_handler| outlives |
33 // |this|. | 33 // |this|. |
34 explicit ThreadPipeManager( | 34 explicit ThreadPipeManager( |
35 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | 35 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
36 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, | 36 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
37 BrowserConnectionHandler* connection_handler); | 37 BrowserConnectionHandler* connection_handler); |
38 | 38 |
39 ~ThreadPipeManager(); | 39 ~ThreadPipeManager(); |
40 | 40 |
41 // Registers a message processor |incoming_processor| which will receive all | 41 // Registers a message processor |incoming_processor| which will receive all |
42 // messages of the |type| specified. Returns a BlimpMessageProcessor object | 42 // messages of the |feature_case| specified. Returns a BlimpMessageProcessor |
43 // for sending messages of type |type|. | 43 // object for sending messages of the given feature. |
44 std::unique_ptr<BlimpMessageProcessor> RegisterFeature( | 44 std::unique_ptr<BlimpMessageProcessor> RegisterFeature( |
45 BlimpMessage::Type type, | 45 BlimpMessage::FeatureCase feature_case, |
46 BlimpMessageProcessor* incoming_processor); | 46 BlimpMessageProcessor* incoming_processor); |
47 | 47 |
48 private: | 48 private: |
49 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; | 49 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; |
50 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 50 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
51 | 51 |
52 // Container for BlimpMessageThreadPipes that are destroyed on IO thread. | 52 // Container for BlimpMessageThreadPipes that are destroyed on IO thread. |
53 std::unique_ptr<IoThreadPipeManager> io_pipe_manager_; | 53 std::unique_ptr<IoThreadPipeManager> io_pipe_manager_; |
54 | 54 |
55 // Pipes for routing messages from the IO to the UI thread. | 55 // Pipes for routing messages from the IO to the UI thread. |
56 // Incoming messages are only routed to the UI thread since all features run | 56 // Incoming messages are only routed to the UI thread since all features run |
57 // there. | 57 // there. |
58 std::vector<std::unique_ptr<BlimpMessageThreadPipe>> incoming_pipes_; | 58 std::vector<std::unique_ptr<BlimpMessageThreadPipe>> incoming_pipes_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(ThreadPipeManager); | 60 DISALLOW_COPY_AND_ASSIGN(ThreadPipeManager); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace blimp | 63 } // namespace blimp |
64 | 64 |
65 #endif // BLIMP_NET_THREAD_PIPE_MANAGER_H_ | 65 #endif // BLIMP_NET_THREAD_PIPE_MANAGER_H_ |
OLD | NEW |