-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathpackage_updating_loader.h
More file actions
52 lines (39 loc) · 1.72 KB
/
package_updating_loader.h
File metadata and controls
52 lines (39 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2016 The Fuchsia 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 GARNET_BIN_SYSMGR_PACKAGE_UPDATING_LOADER_H_
#define GARNET_BIN_SYSMGR_PACKAGE_UPDATING_LOADER_H_
#include <string>
#include <unordered_set>
#include <fuchsia/pkg/cpp/fidl.h>
#include <lib/async/cpp/wait.h>
#include <lib/async/dispatcher.h>
#include <lib/fit/function.h>
#include "garnet/lib/loader/package_loader.h"
#include "lib/fxl/macros.h"
#include "lib/pkg_url/fuchsia_pkg_url.h"
namespace sysmgr {
// A component loader that updates a package (or installs it for the first time)
// before running a component in it. Requires a connection to the package
// resolver.
class PackageUpdatingLoader final : public component::PackageLoader {
public:
typedef fit::function<void(std::string)> DoneCallback;
PackageUpdatingLoader(std::unordered_set<std::string> update_dependency_urls,
fuchsia::sys::ServiceProviderPtr service_provider,
async_dispatcher_t* dispatcher);
~PackageUpdatingLoader() override;
void Bind(fidl::InterfaceRequest<fuchsia::sys::Loader> request);
void LoadUrl(std::string url, LoadUrlCallback callback) override;
private:
const std::unordered_set<std::string> update_dependency_urls_;
fuchsia::pkg::PackageResolverPtr resolver_;
fuchsia::sys::ServiceProviderPtr service_provider_;
fidl::BindingSet<fuchsia::sys::Loader> bindings_;
async_dispatcher_t* const dispatcher_; // Not owned.
bool needs_reconnect_;
void EnsureConnectedToResolver();
FXL_DISALLOW_COPY_AND_ASSIGN(PackageUpdatingLoader);
};
} // namespace sysmgr
#endif // GARNET_BIN_SYSMGR_PACKAGE_UPDATING_LOADER_H_