forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Move Ash off Service Manager"
This reverts commit 008b726. Reason for revert: causing ARC-related tast tests to fail eg https://ci.chromium.org/p/chrome/builders/ci/chromeos-kevin-chrome/2 Original change's description: > Move Ash off Service Manager > > This removes all dependences on the Service Manager from within Ash and > clients of Ash. The "Ash Service" is deleted, and the few interfaces > which the browser bound through it are now bound through a handful of > public helper functions that route through Shell. > > The only service interfaces used from within Ash are from the > Device Service, and those are now acquired through ShellDelegate. > > Bug: 977637 > Change-Id: Ia117241f4adddd14303176af78075d0df6c5b563 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1956160 > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Scott Violet <sky@chromium.org> > Commit-Queue: Ken Rockot <rockot@google.com> > Cr-Commit-Position: refs/heads/master@{#723475} TBR=sky@chromium.org,rockot@google.com,tsepez@chromium.org Change-Id: I60bd3b9803f7017e44f2adc41b3304beee5fddd2 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 977637, 1032816 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1961271 Reviewed-by: Ben Pastene <bpastene@chromium.org> Commit-Queue: Ben Pastene <bpastene@chromium.org> Cr-Commit-Position: refs/heads/master@{#723623}
- Loading branch information
Showing
86 changed files
with
704 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2018 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. | ||
|
||
#include "ash/ash_service.h" | ||
|
||
#include "ash/mojo_interface_factory.h" | ||
|
||
namespace ash { | ||
|
||
AshService::AshService(service_manager::mojom::ServiceRequest request) | ||
: service_binding_(this, std::move(request)) {} | ||
|
||
AshService::~AshService() = default; | ||
|
||
void AshService::OnStart() { | ||
mojo_interface_factory::RegisterInterfaces( | ||
®istry_, base::ThreadTaskRunnerHandle::Get()); | ||
} | ||
|
||
void AshService::OnBindInterface( | ||
const service_manager::BindSourceInfo& remote_info, | ||
const std::string& interface_name, | ||
mojo::ScopedMessagePipeHandle handle) { | ||
registry_.BindInterface(interface_name, std::move(handle)); | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2018 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 ASH_ASH_SERVICE_H_ | ||
#define ASH_ASH_SERVICE_H_ | ||
|
||
#include "ash/ash_export.h" | ||
#include "base/macros.h" | ||
#include "services/service_manager/public/cpp/binder_registry.h" | ||
#include "services/service_manager/public/cpp/service.h" | ||
#include "services/service_manager/public/cpp/service_binding.h" | ||
#include "services/service_manager/public/mojom/service.mojom.h" | ||
|
||
namespace ash { | ||
|
||
// Used to export Ash's mojo services, specifically the interfaces defined in | ||
// Ash's manifest. | ||
class ASH_EXPORT AshService : public service_manager::Service { | ||
public: | ||
explicit AshService(service_manager::mojom::ServiceRequest request); | ||
~AshService() override; | ||
|
||
// service_manager::Service: | ||
void OnStart() override; | ||
void OnBindInterface(const service_manager::BindSourceInfo& remote_info, | ||
const std::string& interface_name, | ||
mojo::ScopedMessagePipeHandle handle) override; | ||
|
||
private: | ||
service_manager::ServiceBinding service_binding_; | ||
service_manager::BinderRegistry registry_; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(AshService); | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_ASH_SERVICE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright 2016 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. | ||
|
||
#include "ash/mojo_interface_factory.h" | ||
|
||
#include <utility> | ||
|
||
#include "ash/app_list/app_list_controller_impl.h" | ||
#include "ash/display/cros_display_config.h" | ||
#include "ash/ime/ime_controller_impl.h" | ||
#include "ash/login/login_screen_controller.h" | ||
#include "ash/media/media_controller_impl.h" | ||
#include "ash/public/cpp/ash_features.h" | ||
#include "ash/public/mojom/cros_display_config.mojom.h" | ||
#include "ash/shell.h" | ||
#include "ash/shell_delegate.h" | ||
#include "ash/tray_action/tray_action.h" | ||
#include "base/bind.h" | ||
#include "base/lazy_instance.h" | ||
#include "base/single_thread_task_runner.h" | ||
#include "chromeos/constants/chromeos_features.h" | ||
#include "mojo/public/cpp/bindings/pending_receiver.h" | ||
|
||
namespace ash { | ||
namespace mojo_interface_factory { | ||
namespace { | ||
|
||
base::LazyInstance<RegisterInterfacesCallback>::Leaky | ||
g_register_interfaces_callback = LAZY_INSTANCE_INITIALIZER; | ||
|
||
void BindCrosDisplayConfigControllerReceiverOnMainThread( | ||
mojo::PendingReceiver<mojom::CrosDisplayConfigController> receiver) { | ||
if (Shell::HasInstance()) | ||
Shell::Get()->cros_display_config()->BindReceiver(std::move(receiver)); | ||
} | ||
|
||
void BindTrayActionReceiverOnMainThread( | ||
mojo::PendingReceiver<mojom::TrayAction> receiver) { | ||
if (Shell::HasInstance()) | ||
Shell::Get()->tray_action()->BindReceiver(std::move(receiver)); | ||
} | ||
|
||
} // namespace | ||
|
||
void RegisterInterfaces( | ||
service_manager::BinderRegistry* registry, | ||
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) { | ||
registry->AddInterface( | ||
base::BindRepeating(&BindCrosDisplayConfigControllerReceiverOnMainThread), | ||
main_thread_task_runner); | ||
registry->AddInterface( | ||
base::BindRepeating(&BindTrayActionReceiverOnMainThread), | ||
main_thread_task_runner); | ||
|
||
// Inject additional optional interfaces. | ||
if (g_register_interfaces_callback.Get()) { | ||
std::move(g_register_interfaces_callback.Get()) | ||
.Run(registry, main_thread_task_runner); | ||
} | ||
} | ||
|
||
void SetRegisterInterfacesCallback(RegisterInterfacesCallback callback) { | ||
g_register_interfaces_callback.Get() = std::move(callback); | ||
} | ||
|
||
} // namespace mojo_interface_factory | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright 2016 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 ASH_MOJO_INTERFACE_FACTORY_H_ | ||
#define ASH_MOJO_INTERFACE_FACTORY_H_ | ||
|
||
#include "ash/ash_export.h" | ||
#include "base/callback_forward.h" | ||
#include "base/macros.h" | ||
#include "base/memory/ref_counted.h" | ||
#include "services/service_manager/public/cpp/binder_registry.h" | ||
|
||
namespace base { | ||
class SingleThreadTaskRunner; | ||
} | ||
|
||
namespace ash { | ||
|
||
namespace mojo_interface_factory { | ||
|
||
// Registers all mojo services provided by ash. May be called on IO thread | ||
// (when running ash in-process in chrome) or on the main thread (when running | ||
// in mash). | ||
ASH_EXPORT void RegisterInterfaces( | ||
service_manager::BinderRegistry* registry, | ||
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner); | ||
|
||
// Registers a callback that runs during |RegisterInterfaces|. Can be used to | ||
// inject interfaces from test-only build targets. | ||
using RegisterInterfacesCallback = | ||
base::OnceCallback<void(service_manager::BinderRegistry*, | ||
scoped_refptr<base::SingleThreadTaskRunner>)>; | ||
ASH_EXPORT void SetRegisterInterfacesCallback(RegisterInterfacesCallback cb); | ||
|
||
} // namespace mojo_interface_factory | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_MOJO_INTERFACE_FACTORY_H_ |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.