OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "blimp/net/fake_pipe_manager.h" | |
6 | |
7 #include "base/memory/ptr_util.h" | |
8 #include "blimp/net/blimp_message_processor.h" | |
9 | |
10 namespace blimp { | |
11 | |
12 FakePipeManager::FakePipeManager() = default; | |
13 | |
14 FakePipeManager::~FakePipeManager() = default; | |
15 | |
16 std::unique_ptr<BlimpMessageProcessor> FakePipeManager::RegisterFeature( | |
17 BlimpMessage::FeatureCase feature_case, | |
18 BlimpMessageProcessor* incoming_processor) { | |
19 incoming_processors_.insert( | |
20 std::pair<BlimpMessage::FeatureCase, BlimpMessageProcessor*>( | |
21 feature_case, incoming_processor)); | |
22 | |
23 std::unique_ptr<FakeBlimpMessageProcessor> outgoing_processor = | |
24 base::MakeUnique<FakeBlimpMessageProcessor>(); | |
25 | |
26 outgoing_processors_.insert( | |
27 std::pair<BlimpMessage::FeatureCase, FakeBlimpMessageProcessor*>( | |
28 feature_case, outgoing_processor.get())); | |
29 | |
30 return std::move(outgoing_processor); | |
31 } | |
32 | |
33 FakeBlimpMessageProcessor* FakePipeManager::GetOutgoingMessageProcessor( | |
34 BlimpMessage::FeatureCase feature_case) { | |
35 return outgoing_processors_.at(feature_case); | |
36 } | |
37 | |
38 } // namespace blimp | |
OLD | NEW |