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

Side by Side Diff: content/browser/service_manager/service_manager_context.cc

Issue 2854713002: Network service: start the process as early as possible. (Closed)
Patch Set: Created 3 years, 7 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/service_manager/service_manager_context.h" 5 #include "content/browser/service_manager/service_manager_context.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 "media", base::Bind(&StartServiceInGpuProcess, "media")); 350 "media", base::Bind(&StartServiceInGpuProcess, "media"));
351 #endif 351 #endif
352 352
353 packaged_services_connection_->AddServiceRequestHandler( 353 packaged_services_connection_->AddServiceRequestHandler(
354 shape_detection::mojom::kServiceName, 354 shape_detection::mojom::kServiceName,
355 base::Bind(&StartServiceInGpuProcess, 355 base::Bind(&StartServiceInGpuProcess,
356 shape_detection::mojom::kServiceName)); 356 shape_detection::mojom::kServiceName));
357 357
358 packaged_services_connection_->Start(); 358 packaged_services_connection_->Start();
359 ServiceManagerConnection::GetForProcess()->Start(); 359 ServiceManagerConnection::GetForProcess()->Start();
360
361 // Start the network service process as soon as possible, since it is critical
362 // to start up performance.
363 ServiceManagerConnection::GetForProcess()->GetConnector()->StartService(
364 mojom::kNetworkServiceName);
360 } 365 }
361 366
362 ServiceManagerContext::~ServiceManagerContext() { 367 ServiceManagerContext::~ServiceManagerContext() {
363 // NOTE: The in-process ServiceManager MUST be destroyed before the browser 368 // NOTE: The in-process ServiceManager MUST be destroyed before the browser
364 // process-wide ServiceManagerConnection. Otherwise it's possible for the 369 // process-wide ServiceManagerConnection. Otherwise it's possible for the
365 // ServiceManager to receive connection requests for service:content_browser 370 // ServiceManager to receive connection requests for service:content_browser
366 // which it may attempt to service by launching a new instance of the browser. 371 // which it may attempt to service by launching a new instance of the browser.
367 if (in_process_context_) 372 if (in_process_context_)
368 in_process_context_->ShutDown(); 373 in_process_context_->ShutDown();
369 if (ServiceManagerConnection::GetForProcess()) 374 if (ServiceManagerConnection::GetForProcess())
370 ServiceManagerConnection::DestroyForProcess(); 375 ServiceManagerConnection::DestroyForProcess();
371 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 376 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
372 base::Bind(&DestroyConnectorOnIOThread)); 377 base::Bind(&DestroyConnectorOnIOThread));
373 } 378 }
374 379
375 // static 380 // static
376 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() { 381 service_manager::Connector* ServiceManagerContext::GetConnectorForIOThread() {
377 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 382 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
378 return g_io_thread_connector.Get().get(); 383 return g_io_thread_connector.Get().get();
379 } 384 }
380 385
381 } // namespace content 386 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698