Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: services/shell/public/cpp/interface_registry.h

Issue 2108343002: Defer Mojo interface binding in the gpu process until OnInitialize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | services/shell/public/cpp/lib/interface_registry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ 5 #ifndef SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
6 #define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ 6 #define SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback, 97 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback,
98 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner = 98 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner =
99 nullptr); 99 nullptr);
100 100
101 template <typename Interface> 101 template <typename Interface>
102 void RemoveInterface() { 102 void RemoveInterface() {
103 RemoveInterface(Interface::Name_); 103 RemoveInterface(Interface::Name_);
104 } 104 }
105 void RemoveInterface(const std::string& name); 105 void RemoveInterface(const std::string& name);
106 106
107 // Temporarily prevent incoming interface requests from being bound. Incoming
108 // requests will be queued internally and dispatched once UnpauseBinding() is
109 // called.
110 void PauseBinding();
111
112 // Resumes incoming interface request binding.
113 void ResumeBinding();
114
107 private: 115 private:
108 using NameToInterfaceBinderMap = 116 using NameToInterfaceBinderMap =
109 std::map<std::string, std::unique_ptr<InterfaceBinder>>; 117 std::map<std::string, std::unique_ptr<InterfaceBinder>>;
110 118
111 // mojom::InterfaceProvider: 119 // mojom::InterfaceProvider:
112 void GetInterface(const mojo::String& interface_name, 120 void GetInterface(const mojo::String& interface_name,
113 mojo::ScopedMessagePipeHandle handle) override; 121 mojo::ScopedMessagePipeHandle handle) override;
114 122
115 // Returns true if the binder was set, false if it was not set (e.g. by 123 // Returns true if the binder was set, false if it was not set (e.g. by
116 // some filtering policy preventing this interface from being exposed). 124 // some filtering policy preventing this interface from being exposed).
117 bool SetInterfaceBinderForName(std::unique_ptr<InterfaceBinder> binder, 125 bool SetInterfaceBinderForName(std::unique_ptr<InterfaceBinder> binder,
118 const std::string& name); 126 const std::string& name);
119 127
128 mojom::InterfaceProviderRequest pending_request_;
129
120 mojo::Binding<mojom::InterfaceProvider> binding_; 130 mojo::Binding<mojom::InterfaceProvider> binding_;
121 Connection* connection_; 131 Connection* connection_;
122 132
123 NameToInterfaceBinderMap name_to_binder_; 133 NameToInterfaceBinderMap name_to_binder_;
124 134
125 base::WeakPtrFactory<InterfaceRegistry> weak_factory_; 135 base::WeakPtrFactory<InterfaceRegistry> weak_factory_;
126 136
127 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry); 137 DISALLOW_COPY_AND_ASSIGN(InterfaceRegistry);
128 }; 138 };
129 139
130 } // namespace shell 140 } // namespace shell
131 141
132 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_ 142 #endif // SERVICES_SHELL_PUBLIC_CPP_INTERFACE_REGISTRY_H_
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | services/shell/public/cpp/lib/interface_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698