0
Files
src/content/browser/system_connector_impl.h
Ken Rockot 5edbff193d Always start ServiceManager before BrowserMainLoop
This ensures the Service Manager is always initialized by
ContentMainRunnerImpl early in process startup, rather than potentially
deferring until BrowserMainLoop runs. The main motivation here is to
have only one place in browser code where the Service Manager is
initialized.

This also begins peeling away at some of the unnecessary dependencies on
ServiceManagerConnection and ServiceManagerContext, since both are slated
for deletion.

Finally, this adds a public content::GetSystemConnector API to
content/public/browser as a drop-in replacement for
ServiceManagerConnection::GetForProcess()->GetConnector(). Moving
forward, this is the API that new browser code should use when
connecting to services. The API is available very early in browser
startup, even before BrowserMainLoop is instantiated.

Bug: 904240, 968147
Change-Id: I933dc8a4bf268cec92eaa4cbdc452c1fc2a08898
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1650155
Commit-Queue: Ken Rockot <rockot@google.com>
Reviewed-by: Xi Han <hanxi@chromium.org>
Reviewed-by: Olga Sharonova <olka@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#668977}
2019-06-13 22:19:15 +00:00

21 lines
791 B
C++

// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_SYSTEM_CONNECTOR_IMPL_H_
#define CONTENT_BROWSER_SYSTEM_CONNECTOR_IMPL_H_
#include "content/public/browser/system_connector.h"
#include "services/service_manager/public/cpp/connector.h"
namespace content {
// Sets the system Connector on the main thread. Called very early in browser
// process startup (i.e. before BrowserMainLoop is instantiated). For unit test
// environments, see |SetSystemConnectorForTesting()| in the public header.
void SetSystemConnector(std::unique_ptr<service_manager::Connector> connector);
} // namespace content
#endif // CONTENT_BROWSER_SYSTEM_CONNECTOR_IMPL_H_