| 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 "services/shell/public/cpp/interface_registry.h" | 5 #include "services/shell/public/cpp/interface_registry.h" |
| 6 | 6 |
| 7 #include "services/shell/public/cpp/connection.h" | 7 #include "services/shell/public/cpp/connection.h" |
| 8 | 8 |
| 9 namespace shell { | 9 namespace shell { |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 DCHECK(is_paused_); | 47 DCHECK(is_paused_); |
| 48 is_paused_ = false; | 48 is_paused_ = false; |
| 49 | 49 |
| 50 while (!pending_interface_requests_.empty()) { | 50 while (!pending_interface_requests_.empty()) { |
| 51 auto& request = pending_interface_requests_.front(); | 51 auto& request = pending_interface_requests_.front(); |
| 52 GetInterface(request.first, std::move(request.second)); | 52 GetInterface(request.first, std::move(request.second)); |
| 53 pending_interface_requests_.pop(); | 53 pending_interface_requests_.pop(); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 void InterfaceRegistry::GetInterfaceNames( |
| 58 std::set<std::string>* interface_names) { |
| 59 DCHECK(interface_names); |
| 60 for (auto& entry : name_to_binder_) |
| 61 interface_names->insert(entry.first); |
| 62 } |
| 63 |
| 57 // mojom::InterfaceProvider: | 64 // mojom::InterfaceProvider: |
| 58 void InterfaceRegistry::GetInterface(const mojo::String& interface_name, | 65 void InterfaceRegistry::GetInterface(const mojo::String& interface_name, |
| 59 mojo::ScopedMessagePipeHandle handle) { | 66 mojo::ScopedMessagePipeHandle handle) { |
| 60 if (is_paused_) { | 67 if (is_paused_) { |
| 61 pending_interface_requests_.emplace(interface_name, std::move(handle)); | 68 pending_interface_requests_.emplace(interface_name, std::move(handle)); |
| 62 return; | 69 return; |
| 63 } | 70 } |
| 64 | 71 |
| 65 auto iter = name_to_binder_.find(interface_name); | 72 auto iter = name_to_binder_.find(interface_name); |
| 66 if (iter != name_to_binder_.end()) { | 73 if (iter != name_to_binder_.end()) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 87 if (!connection_ || | 94 if (!connection_ || |
| 88 (connection_ && connection_->AllowsInterface(interface_name))) { | 95 (connection_ && connection_->AllowsInterface(interface_name))) { |
| 89 RemoveInterface(interface_name); | 96 RemoveInterface(interface_name); |
| 90 name_to_binder_[interface_name] = std::move(binder); | 97 name_to_binder_[interface_name] = std::move(binder); |
| 91 return true; | 98 return true; |
| 92 } | 99 } |
| 93 return false; | 100 return false; |
| 94 } | 101 } |
| 95 | 102 |
| 96 } // namespace shell | 103 } // namespace shell |
| OLD | NEW |