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

Side by Side Diff: content/common/mojo/mojo_shell_connection_impl.cc

Issue 2257693003: Handle early ServiceRequest errors in shell::ServiceContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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 | « no previous file | services/shell/public/cpp/lib/service_context.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 #include "content/common/mojo/mojo_shell_connection_impl.h" 5 #include "content/common/mojo/mojo_shell_connection_impl.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } 184 }
185 185
186 // Resetting the ServiceContext below may otherwise release the last 186 // Resetting the ServiceContext below may otherwise release the last
187 // reference to this IOThreadContext. We keep it alive until the stack 187 // reference to this IOThreadContext. We keep it alive until the stack
188 // unwinds. 188 // unwinds.
189 scoped_refptr<IOThreadContext> keepalive(this); 189 scoped_refptr<IOThreadContext> keepalive(this);
190 190
191 factory_bindings_.CloseAllBindings(); 191 factory_bindings_.CloseAllBindings();
192 service_context_.reset(); 192 service_context_.reset();
193 193
194 ClearConnectionFiltersOnIOThread();
195 }
196
197 void ClearConnectionFiltersOnIOThread() {
194 base::AutoLock lock(lock_); 198 base::AutoLock lock(lock_);
195 connection_filters_.clear(); 199 connection_filters_.clear();
196 } 200 }
197 201
198 void RemoveConnectionFilterOnIOThread(int filter_id) { 202 void RemoveConnectionFilterOnIOThread(int filter_id) {
199 base::AutoLock lock(lock_); 203 base::AutoLock lock(lock_);
200 auto it = connection_filters_.find(filter_id); 204 auto it = connection_filters_.find(filter_id);
201 DCHECK(it != connection_filters_.end()); 205 DCHECK(it != connection_filters_.end());
202 connection_filters_.erase(it); 206 connection_filters_.erase(it);
203 } 207 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 registry->SetConnectionLostClosure( 249 registry->SetConnectionLostClosure(
246 base::Bind(&IOThreadContext::OnBrowserConnectionLost, this)); 250 base::Bind(&IOThreadContext::OnBrowserConnectionLost, this));
247 return true; 251 return true;
248 } 252 }
249 253
250 // If no filters were interested, reject the connection. 254 // If no filters were interested, reject the connection.
251 return accept; 255 return accept;
252 } 256 }
253 257
254 bool OnStop() override { 258 bool OnStop() override {
259 ClearConnectionFiltersOnIOThread();
255 callback_task_runner_->PostTask(FROM_HERE, stop_callback_); 260 callback_task_runner_->PostTask(FROM_HERE, stop_callback_);
256 return true; 261 return true;
257 } 262 }
258 263
259 ///////////////////////////////////////////////////////////////////////////// 264 /////////////////////////////////////////////////////////////////////////////
260 // shell::InterfaceFactory<shell::mojom::ServiceFactory> implementation 265 // shell::InterfaceFactory<shell::mojom::ServiceFactory> implementation
261 266
262 void Create(const shell::Identity& remote_identity, 267 void Create(const shell::Identity& remote_identity,
263 shell::mojom::ServiceFactoryRequest request) override { 268 shell::mojom::ServiceFactoryRequest request) override {
264 DCHECK(io_thread_checker_.CalledOnValidThread()); 269 DCHECK(io_thread_checker_.CalledOnValidThread());
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 495
491 void MojoShellConnectionImpl::GetInterface( 496 void MojoShellConnectionImpl::GetInterface(
492 shell::mojom::InterfaceProvider* provider, 497 shell::mojom::InterfaceProvider* provider,
493 const std::string& interface_name, 498 const std::string& interface_name,
494 mojo::ScopedMessagePipeHandle request_handle) { 499 mojo::ScopedMessagePipeHandle request_handle) {
495 provider->GetInterface(interface_name, std::move(request_handle)); 500 provider->GetInterface(interface_name, std::move(request_handle));
496 } 501 }
497 502
498 } // namespace content 503 } // namespace content
499 504
OLDNEW
« no previous file with comments | « no previous file | services/shell/public/cpp/lib/service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698